summaryrefslogtreecommitdiffstats
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog12
-rw-r--r--ld/emultempl/aix.em45
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-powerpc/aix-export-1-all.dd11
-rw-r--r--ld/testsuite/ld-powerpc/aix-export-1-full.dd21
-rw-r--r--ld/testsuite/ld-powerpc/aix-export-1a.s14
-rw-r--r--ld/testsuite/ld-powerpc/aix-export-1b.s9
-rw-r--r--ld/testsuite/ld-powerpc/aix52.exp20
8 files changed, 136 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 40434ebe76..d41dd9b9de 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,17 @@
2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+ * emultempl/aix.em (auto_export_flags): New variable.
+ (explicit_auto_export_flags): Likewise.
+ (OPTION_EXPALL, OPTION_EXPFULL): New enum values.
+ (OPTION_NOEXPALL, OPTION_NOEXPFULL): Likewise.
+ (gld${EMULATION_NAME}_add_options): Add -bexpall, -bexpfull,
+ -bnoexpall and -bnoexpfull.
+ (gld${EMULATION_NAME}_handle_option): Handle them.
+ (gld${EMULATION_NAME}_before_allocation): Update the call to
+ bfd_size_dynamic_sections.
+
+2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+
* emultempl/aix.em (gld${EMULATION_NAME}_handle_option): Make
-berok and -bernotok control link_info.unresolved_syms_in_objects
and link_info.unresolved_syms_in_shared_libs instead of
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index a9f3884055..85586607b5 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -84,6 +84,14 @@ static unsigned short modtype = ('1' << 8) | 'L';
permitted). */
static int textro;
+/* A mask of XCOFF_EXPALL and XCOFF_EXPFULL flags, as set by their
+ associated -b and -bno options. */
+static unsigned int auto_export_flags;
+
+/* A mask of auto_export_flags bits that were explicitly set on the
+ command line. */
+static unsigned int explicit_auto_export_flags;
+
/* Whether to implement Unix like linker semantics. */
static int unix_ld;
@@ -156,6 +164,8 @@ enum
OPTION_AUTOIMP,
OPTION_ERNOTOK,
OPTION_EROK,
+ OPTION_EXPALL,
+ OPTION_EXPFULL,
OPTION_EXPORT,
OPTION_IMPORT,
OPTION_INITFINI,
@@ -164,6 +174,8 @@ enum
OPTION_MAXSTACK,
OPTION_MODTYPE,
OPTION_NOAUTOIMP,
+ OPTION_NOEXPALL,
+ OPTION_NOEXPFULL,
OPTION_NOSTRCMPCT,
OPTION_PD,
OPTION_PT,
@@ -201,6 +213,8 @@ gld${EMULATION_NAME}_add_options
{"bernotok", no_argument, NULL, OPTION_ERNOTOK},
{"berok", no_argument, NULL, OPTION_EROK},
{"berrmsg", no_argument, NULL, OPTION_IGNORE},
+ {"bexpall", no_argument, NULL, OPTION_EXPALL},
+ {"bexpfull", no_argument, NULL, OPTION_EXPFULL},
{"bexport", required_argument, NULL, OPTION_EXPORT},
{"bf", no_argument, NULL, OPTION_ERNOTOK},
{"bgc", no_argument, &gc, 1},
@@ -216,6 +230,8 @@ gld${EMULATION_NAME}_add_options
{"bM", required_argument, NULL, OPTION_MODTYPE},
{"bmodtype", required_argument, NULL, OPTION_MODTYPE},
{"bnoautoimp", no_argument, NULL, OPTION_NOAUTOIMP},
+ {"bnoexpall", no_argument, NULL, OPTION_NOEXPALL},
+ {"bnoexpfull", no_argument, NULL, OPTION_NOEXPFULL},
{"bnodelcsect", no_argument, NULL, OPTION_IGNORE},
{"bnoentry", no_argument, NULL, OPTION_IGNORE},
{"bnogc", no_argument, &gc, 0},
@@ -388,6 +404,16 @@ gld${EMULATION_NAME}_handle_option (int optc)
link_info.unresolved_syms_in_shared_libs = RM_IGNORE;
break;
+ case OPTION_EXPALL:
+ auto_export_flags |= XCOFF_EXPALL;
+ explicit_auto_export_flags |= XCOFF_EXPALL;
+ break;
+
+ case OPTION_EXPFULL:
+ auto_export_flags |= XCOFF_EXPFULL;
+ explicit_auto_export_flags |= XCOFF_EXPFULL;
+ break;
+
case OPTION_EXPORT:
gld${EMULATION_NAME}_read_file (optarg, FALSE);
break;
@@ -444,6 +470,16 @@ gld${EMULATION_NAME}_handle_option (int optc)
link_info.static_link = TRUE;
break;
+ case OPTION_NOEXPALL:
+ auto_export_flags &= ~XCOFF_EXPALL;
+ explicit_auto_export_flags |= XCOFF_EXPALL;
+ break;
+
+ case OPTION_NOEXPFULL:
+ auto_export_flags &= ~XCOFF_EXPFULL;
+ explicit_auto_export_flags |= XCOFF_EXPFULL;
+ break;
+
case OPTION_NOSTRCMPCT:
link_info.traditional_format = TRUE;
break;
@@ -624,7 +660,7 @@ gld${EMULATION_NAME}_before_allocation (void)
".data",
".bss"
};
- unsigned int i;
+ unsigned int i, flags;
/* Handle the import and export files, if any. */
for (fl = import_files; fl != NULL; fl = fl->next)
@@ -710,11 +746,16 @@ gld${EMULATION_NAME}_before_allocation (void)
}
}
+ /* Default to -bexpfull for SVR4-like semantics. */
+ flags = (unix_ld ? XCOFF_EXPFULL : 0);
+ flags &= ~explicit_auto_export_flags;
+ flags |= auto_export_flags;
+
/* Let the XCOFF backend set up the .loader section. */
if (!bfd_xcoff_size_dynamic_sections
(link_info.output_bfd, &link_info, libpath, entry_symbol.name, file_align,
maxstack, maxdata, gc && !unix_ld ? TRUE : FALSE,
- modtype, textro ? TRUE : FALSE, unix_ld, special_sections,
+ modtype, textro ? TRUE : FALSE, flags, special_sections,
rtld ? TRUE : FALSE))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index a2cdc378e6..df1fd84d68 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+ * ld-powerpc/aix-export-1-all.dd, ld-powerpc/aix-export-1-full.dd,
+ ld-powerpc/aix-export-1a.s, ld-powerpc/aix-export-1b.s: New tests.
+ * ld-powerpc/aix52.exp: Run them.
+
+2009-03-14 Richard Sandiford <r.sandiford@uk.ibm.com>
+
* ld-powerpc/aix-gc-1.s, ld-powerpc/aix-gc-1.ex,
ld-powerpc/aix-gc-1-32.dd, ld-powerpc/aix-gc-1-64.dd,
ld-powerpc/aix-weak-1-gcdso.dnd, ld-powerpc/aix-weak-1-gcdso.hd,
diff --git a/ld/testsuite/ld-powerpc/aix-export-1-all.dd b/ld/testsuite/ld-powerpc/aix-export-1-all.dd
new file mode 100644
index 0000000000..90eec95e97
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-export-1-all.dd
@@ -0,0 +1,11 @@
+
+.*
+
+
+Disassembly of section \.data:
+
+0*10000000 <main1>:
+ *10000000: 10 00 00 04 .*
+
+0*10000004 <lib1>:
+ *10000004: 11 11 00 01 .*
diff --git a/ld/testsuite/ld-powerpc/aix-export-1-full.dd b/ld/testsuite/ld-powerpc/aix-export-1-full.dd
new file mode 100644
index 0000000000..d300fa2a86
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-export-1-full.dd
@@ -0,0 +1,21 @@
+
+.*
+
+
+Disassembly of section .data:
+
+0*10000000 <main1>:
+ *10000000: 10 00 00 08 .*
+
+0*10000004 <_main2>:
+ *10000004: 10 00 00 0c .*
+
+0*10000008 <lib1>:
+ *10000008: 11 11 00 01 .*
+
+0*1000000c <_lib2>:
+ *1000000c: 11 11 00 02 .*
+
+0*10000010 <lib3>:
+ *10000010: 11 11 00 03 .*
+ *10000014: 00 00 00 00 .*
diff --git a/ld/testsuite/ld-powerpc/aix-export-1a.s b/ld/testsuite/ld-powerpc/aix-export-1a.s
new file mode 100644
index 0000000000..69701e5d50
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-export-1a.s
@@ -0,0 +1,14 @@
+ .globl lib1
+ .csect lib1[RW]
+lib1:
+ .long 0x11110001
+
+ .globl _lib2
+ .csect _lib2[RW]
+_lib2:
+ .long 0x11110002
+
+ .globl lib3
+ .csect lib3[RW]
+lib3:
+ .long 0x11110003
diff --git a/ld/testsuite/ld-powerpc/aix-export-1b.s b/ld/testsuite/ld-powerpc/aix-export-1b.s
new file mode 100644
index 0000000000..32c355dbd0
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/aix-export-1b.s
@@ -0,0 +1,9 @@
+ .globl main1
+ .csect main1[RW]
+main1:
+ .long lib1
+
+ .globl _main2
+ .csect _main2[RW]
+_main2:
+ .long _lib2
diff --git a/ld/testsuite/ld-powerpc/aix52.exp b/ld/testsuite/ld-powerpc/aix52.exp
index 330de27785..fb2307a6fd 100644
--- a/ld/testsuite/ld-powerpc/aix52.exp
+++ b/ld/testsuite/ld-powerpc/aix52.exp
@@ -108,6 +108,26 @@ set aix52tests {
{nm -D aix-no-dup-syms-1-dso.dnd} {objdump -R aix-no-dup-syms-1-dso.drd}}
"aix-no-dup-syms-1.so"}
+ {"Export test 1 (archive)" ""
+ "" {aix-export-1a.s}
+ {} "libaix-export-1.a"}
+
+ {"Export test 1 (object)" "-r"
+ "" {aix-export-1b.s}
+ {} "aix-export-1.o"}
+
+ {"Export test 1 (-bexpall)"
+ "-shared -bexpall tmpdir/aix-export-1.o -Ltmpdir -laix-export-1"
+ "" {}
+ {{objdump -dj.data aix-export-1-all.dd}}
+ "aix-export-1-all.so"}
+
+ {"Export test 1 (-bexpfull)"
+ "-shared -bexpfull tmpdir/aix-export-1.o -Ltmpdir -laix-export-1"
+ "" {}
+ {{objdump -dj.data aix-export-1-full.dd}}
+ "aix-export-1-full.so"}
+
{"Garbage collection test 1"
"-shared -binitfini:init_function:fini_function -bE:aix-gc-1.ex"
"" {aix-gc-1.s}
OpenPOWER on IntegriCloud