aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:35:46 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2009-03-14 09:35:46 +0000
commitb64232cca5353c35c503dfe096afec18ac3c90f3 (patch)
tree464ed21110f7c0f37c3e7e044bb27dd96eb5c050 /ld/emultempl
parent7d504122ef2032b3e0d6973a4f4f138481c4b5c2 (diff)
downloadgdb-b64232cca5353c35c503dfe096afec18ac3c90f3.zip
gdb-b64232cca5353c35c503dfe096afec18ac3c90f3.tar.gz
gdb-b64232cca5353c35c503dfe096afec18ac3c90f3.tar.bz2
include/coff/
* xcoff.h (XCOFF_EXPALL, XCOFF_EXPFULL): New flags. (xcoff_loader_info): Add auto_export_flags. bfd/ * bfd-in.h (bfd_xcoff_size_dynamic_sections): Replace the bfd_boolean export_defineds parameter with an unsigned int auto_export_flags parameter. * bfd-in2.h: Regenerate. * xcofflink.c (xcoff_archive_contains_shared_object_p): New function, split out from xcoff_build_ldsyms. (xcoff_covered_by_expall_p): New function. (xcoff_auto_export_p): New function, split out from xcoff_build_ldsyms but with extra code to handle -bexpfull and -bexpall. (xcoff_mark_auto_exports): New function. (xcoff_build_ldsyms): Use xcoff_auto_export_p to decide whether a function should be automatically exported. (bfd_xcoff_size_dynamic_sections): Replace the export_defineds parameter with an auto_export_flags parameter. Update ldinfo accordingly. Use xcoff_mark_auto_exports to mark all automatically- exported symbols. ld/ * 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. ld/testsuite/ * 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.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/aix.em45
1 files changed, 43 insertions, 2 deletions
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index a9f3884..8558660 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");