diff options
author | Nick Clifton <nickc@redhat.com> | 2003-02-17 18:24:40 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2003-02-17 18:24:40 +0000 |
commit | ae9a127f867f404d20b8010b401ca9aaae9018d9 (patch) | |
tree | 94d0a4d7d0df63c27d7405fca51c7b572890e0d7 /ld | |
parent | b5f852ea83a8b30b97837afa7b1cf2c87c013998 (diff) | |
download | gdb-ae9a127f867f404d20b8010b401ca9aaae9018d9.zip gdb-ae9a127f867f404d20b8010b401ca9aaae9018d9.tar.gz gdb-ae9a127f867f404d20b8010b401ca9aaae9018d9.tar.bz2 |
Fix the behaviour of --allow-shlib-undefined, so that it does what it claims
to do. Add an inverse switch. Update the documentation.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 8 | ||||
-rw-r--r-- | ld/ld.texinfo | 34 | ||||
-rw-r--r-- | ld/ldmain.c | 2 | ||||
-rw-r--r-- | ld/lexsup.c | 12 |
4 files changed, 40 insertions, 16 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 807758c..431345f 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2003-02-17 Nick Clifton <nickc@redhat.com> + + * ldmain.c (main) Default allow_shlib_undefined to true. + * lexsup.c (ld_options): Add --no-allow-shlib-undefined. + (parse_args): Parse the new switch. + * ld.texinfo: Document new switch and default behaviour of + allowing undefined symbols in shared libraries. + 2003-02-11 Dmitry Diky <diwil@mail.ru> * scripttempl/elf32msp430.sc: Add new data anchors definitions. diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 412ea88..0255662 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1108,8 +1108,10 @@ while linking a large executable. @item --no-undefined @itemx -z defs 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. +are allowed and left to be resolved by the runtime loader. This option +disallows such undefined symbols if they come from regular object +files. The switch @samp{--no-allow-shlib-undefined} controls the +behaviour for shared objects being linked into the shared library. @kindex --allow-multiple-definition @kindex -z muldefs @@ -1120,17 +1122,25 @@ report a fatal error. These options allow multiple definitions and the first definition will be used. @kindex --allow-shlib-undefined +@kindex --no-allow-shlib-undefined @item --allow-shlib-undefined -Allow undefined symbols in shared objects even when --no-undefined is -set. The net result will be that undefined symbols in regular objects -will still trigger an error, but undefined symbols in shared objects -will be ignored. The implementation of no_undefined makes the -assumption that the runtime linker will choke on undefined symbols. -However there is at least one system (BeOS) where undefined symbols in -shared libraries is normal since the kernel patches them at load time to -select which function is most appropriate for the current architecture. -I.E. dynamically select an appropriate memset function. Apparently it -is also normal for HPPA shared libraries to have undefined symbols. +@itemx --no-allow-shlib-undefined +Allow (the default) or disallow undefined symbols in shared objects. +The setting of this switch overrides @samp {--no-undefined} where +shared objects are concerned. Thus if @samp {--no-undefined} is set +but @samp {--no-allow-shlib-undefined} is not, the net result will be +that undefined symbols in regular object files will trigger an error, +but undefined symbols in shared objects will be ignored. + +The reason that @samp{--allow-shlib-undefined} is the default is that +the shared object being specified at link time may not be the same one +that is available at load time, so the symbols might actually be +resolvable at load time. Plus there are some systems, (eg BeOS) where +undefined symbols in shared libraries is normal since the kernel +patches them at load time to select which function is most appropriate +for the current architecture. eg. to dynamically select an appropriate +memset function. Apparently it is also normal for HPPA shared +libraries to have undefined symbols. @kindex --no-undefined-version @item --no-undefined-version diff --git a/ld/ldmain.c b/ld/ldmain.c index 9be3711..3aaef5d 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -265,7 +265,7 @@ main (argc, argv) link_info.traditional_format = FALSE; link_info.optimize = FALSE; link_info.no_undefined = FALSE; - link_info.allow_shlib_undefined = FALSE; + link_info.allow_shlib_undefined = TRUE; link_info.allow_multiple_definition = FALSE; link_info.allow_undefined_version = TRUE; link_info.keep_memory = TRUE; diff --git a/ld/lexsup.c b/ld/lexsup.c index 87a729a..8102f4e 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -1,6 +1,6 @@ /* Parse options for the GNU linker. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002 + 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -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_ALLOW_MULTIPLE_DEFINITION (OPTION_ALLOW_SHLIB_UNDEFINED + 1) +#define OPTION_NO_ALLOW_SHLIB_UNDEFINED (OPTION_ALLOW_SHLIB_UNDEFINED + 1) +#define OPTION_ALLOW_MULTIPLE_DEFINITION (OPTION_NO_ALLOW_SHLIB_UNDEFINED + 1) #define OPTION_NO_UNDEFINED_VERSION (OPTION_ALLOW_MULTIPLE_DEFINITION + 1) #define OPTION_DISCARD_NONE (OPTION_NO_UNDEFINED_VERSION + 1) #define OPTION_SPARE_DYNAMIC_TAGS (OPTION_DISCARD_NONE + 1) @@ -335,7 +336,9 @@ static const struct ld_option ld_options[] = { {"no-undefined", no_argument, NULL, OPTION_NO_UNDEFINED}, '\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 }, + '\0', NULL, N_("Allow undefined symbols in shared objects (the default)"), TWO_DASHES }, + { {"no-allow-shlib-undefined", no_argument, NULL, OPTION_NO_ALLOW_SHLIB_UNDEFINED}, + '\0', NULL, N_("Do not 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-undefined-version", no_argument, NULL, OPTION_NO_UNDEFINED_VERSION}, @@ -788,6 +791,9 @@ parse_args (argc, argv) case OPTION_ALLOW_SHLIB_UNDEFINED: link_info.allow_shlib_undefined = TRUE; break; + case OPTION_NO_ALLOW_SHLIB_UNDEFINED: + link_info.allow_shlib_undefined = FALSE; + break; case OPTION_ALLOW_MULTIPLE_DEFINITION: link_info.allow_multiple_definition = TRUE; break; |