diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2002-05-22 05:08:31 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2002-05-22 05:08:31 +0000 |
commit | aa713662e8c8349dbf475437e8db72ffd9a9cc4d (patch) | |
tree | 0bbf4d6f1d9d9515dca47cdc30a8e310987e49c3 /ld | |
parent | 6713542fbc51e3bdc0b347ae2bf14a17db67d2bd (diff) | |
download | gdb-aa713662e8c8349dbf475437e8db72ffd9a9cc4d.zip gdb-aa713662e8c8349dbf475437e8db72ffd9a9cc4d.tar.gz gdb-aa713662e8c8349dbf475437e8db72ffd9a9cc4d.tar.bz2 |
2002-05-21 H.J. Lu (hjl@gnu.org)
* emultempl/elf32.em (gld${EMULATION_NAME}_parse_args): Handle
"-z muldefs".
(gld${EMULATION_NAME}_list_options): Add "-z muldefs".
* ld.texinfo: Updated for --allow-multiple-definition and
"-z muldefs".
* ldmain.c (main): Initialize the allow_multiple_definition
field to false.
* lexsup.c (OPTION_ALLOW_MULTIPLE_DEFINITION): New.
(ld_options): Add --allow-multiple-definition.
(parse_args): Support OPTION_ALLOW_MULTIPLE_DEFINITION.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 16 | ||||
-rw-r--r-- | ld/emultempl/elf32.em | 3 | ||||
-rw-r--r-- | ld/ld.texinfo | 9 | ||||
-rw-r--r-- | ld/ldmain.c | 1 | ||||
-rw-r--r-- | ld/lexsup.c | 8 |
5 files changed, 36 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 920129a..4d2bc18 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,19 @@ +2002-05-21 H.J. Lu (hjl@gnu.org) + + * emultempl/elf32.em (gld${EMULATION_NAME}_parse_args): Handle + "-z muldefs". + (gld${EMULATION_NAME}_list_options): Add "-z muldefs". + + * ld.texinfo: Updated for --allow-multiple-definition and + "-z muldefs". + + * ldmain.c (main): Initialize the allow_multiple_definition + field to false. + + * lexsup.c (OPTION_ALLOW_MULTIPLE_DEFINITION): New. + (ld_options): Add --allow-multiple-definition. + (parse_args): Support OPTION_ALLOW_MULTIPLE_DEFINITION. + 2002-05-21 Jason Thorpe <thorpej@wasabisystems.com> * Makefile.am (ALL_EMULATIONS): Add earmelfb_nbsd.o. diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 077a8fc..5f12e69 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -1541,6 +1541,8 @@ cat >>e${EMULATION_NAME}.c <<EOF } else if (strcmp (optarg, "defs") == 0) link_info.no_undefined = true; + else if (strcmp (optarg, "muldefs") == 0) + link_info.allow_multiple_definition = true; else if (strcmp (optarg, "combreloc") == 0) link_info.combreloc = true; else if (strcmp (optarg, "nocombreloc") == 0) @@ -1589,6 +1591,7 @@ cat >>e${EMULATION_NAME}.c <<EOF fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at runtime\n")); fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but executable\n")); fprintf (file, _(" -z loadfltr\t\tMark object requiring immediate process\n")); + fprintf (file, _(" -z muldefs\t\tAllow multiple definitions\n")); fprintf (file, _(" -z nocombreloc\tDon't merge dynamic relocs into one section\n")); fprintf (file, _(" -z nocopyreloc\tDon't create copy relocs\n")); fprintf (file, _(" -z nodefaultlib\tMark object not to use default search paths\n")); diff --git a/ld/ld.texinfo b/ld/ld.texinfo index a884ffd..b7fa2a9 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -859,6 +859,7 @@ of this object will ignore any default library search paths. @code{now} marks the object with the non-lazy runtime binding. @code{origin} marks the object may contain $ORIGIN. @code{defs} disallows undefined symbols. +@code{muldefs} allows multiple definitions. @code{combreloc} combines multiple reloc sections and sorts them to make dynamic symbol lookup caching possible. @code{nocombreloc} disables multiple reloc sections combining. @@ -1080,6 +1081,14 @@ Normally when creating a non-symbolic shared library, undefined symbols are allowed and left to be resolved by the runtime loader. These options disallows such undefined symbols. +@kindex --allow-multiple-definition +@kindex -z muldefs +@item --allow-multiple-definition +@itemx -z muldefs +Normally when a symbol is defined multiple times, the linker will +report a fatal error. These options allow multiple definitions and the +first definition will be used. + @kindex --allow-shlib-undefined @item --allow-shlib-undefined Allow undefined symbols in shared objects even when --no-undefined is diff --git a/ld/ldmain.c b/ld/ldmain.c index 814fc9d..25ae5ec 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -239,6 +239,7 @@ main (argc, argv) link_info.optimize = false; link_info.no_undefined = false; link_info.allow_shlib_undefined = false; + link_info.allow_multiple_definition = false; link_info.strip = strip_none; link_info.discard = discard_sec_merge; link_info.keep_memory = true; diff --git a/ld/lexsup.c b/ld/lexsup.c index cbde509..ddaf692 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -126,7 +126,8 @@ int parsing_defsym = 0; #define OPTION_UNIQUE (OPTION_SECTION_START + 1) #define OPTION_TARGET_HELP (OPTION_UNIQUE + 1) #define OPTION_ALLOW_SHLIB_UNDEFINED (OPTION_TARGET_HELP + 1) -#define OPTION_DISCARD_NONE (OPTION_ALLOW_SHLIB_UNDEFINED + 1) +#define OPTION_ALLOW_MULTIPLE_DEFINITION (OPTION_ALLOW_SHLIB_UNDEFINED + 1) +#define OPTION_DISCARD_NONE (OPTION_ALLOW_MULTIPLE_DEFINITION + 1) #define OPTION_SPARE_DYNAMIC_TAGS (OPTION_DISCARD_NONE + 1) #define OPTION_NO_DEFINE_COMMON (OPTION_SPARE_DYNAMIC_TAGS + 1) #define OPTION_NOSTDLIB (OPTION_NO_DEFINE_COMMON + 1) @@ -319,6 +320,8 @@ static const struct ld_option ld_options[] = '\0', NULL, N_("Allow no undefined symbols"), TWO_DASHES }, { {"allow-shlib-undefined", no_argument, NULL, OPTION_ALLOW_SHLIB_UNDEFINED}, '\0', NULL, N_("Allow undefined symbols in shared objects"), TWO_DASHES }, + { {"allow-multiple-definition", no_argument, NULL, OPTION_ALLOW_MULTIPLE_DEFINITION}, + '\0', NULL, N_("Allow multiple definitions"), TWO_DASHES }, { {"no-warn-mismatch", no_argument, NULL, OPTION_NO_WARN_MISMATCH}, '\0', NULL, N_("Don't warn about mismatched input files"), TWO_DASHES}, { {"no-whole-archive", no_argument, NULL, OPTION_NO_WHOLE_ARCHIVE}, @@ -761,6 +764,9 @@ parse_args (argc, argv) case OPTION_ALLOW_SHLIB_UNDEFINED: link_info.allow_shlib_undefined = true; break; + case OPTION_ALLOW_MULTIPLE_DEFINITION: + link_info.allow_multiple_definition = true; + break; case OPTION_NO_WARN_MISMATCH: command_line.warn_mismatch = false; break; |