diff options
author | Alan Modra <amodra@gmail.com> | 2017-04-19 01:26:57 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-04-19 20:39:52 +0930 |
commit | 954b63d4c8645f86e40c7ef6c6d60acd2bf019de (patch) | |
tree | 7e351a33b44fe2672265e418e9d3d4f9e38215d1 /ld/emulparams | |
parent | 951787ed6d13f8f441d93fc3f6fb870c234774af (diff) | |
download | gdb-954b63d4c8645f86e40c7ef6c6d60acd2bf019de.zip gdb-954b63d4c8645f86e40c7ef6c6d60acd2bf019de.tar.gz gdb-954b63d4c8645f86e40c7ef6c6d60acd2bf019de.tar.bz2 |
Implement -z dynamic-undefined-weak
-z nodynamic-undefined-weak is only implemented for x86. (The sparc
backend has some support code but doesn't enable the option by
including ld/emulparams/dynamic_undefined_weak.sh, and since the
support looks like it may be broken I haven't enabled it.) This patch
adds the complementary -z dynamic-undefined-weak, extends both options
to affect building of shared libraries as well as executables, and
adds support for the option on powerpc.
include/
* bfdlink.h (struct bfd_link_info <dynamic_undefined_weak>):
Revise comment.
bfd/
* elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
or make dynamic for info->dynamic_undefined_weak 0 and 1.
* elf32-ppc.c:Formatting.
(ensure_undefweak_dynamic): Don't make dynamic when
info->dynamic_undefined_weak is zero.
(allocate_dynrelocs): Discard undefweak dyn_relocs for
info->dynamic_undefined_weak. Discard undef dyn_relocs when
not default visibility. Discard undef and undefweak
dyn_relocs earlier.
(ppc_elf_relocate_section): Adjust to suit.
* elf64-ppc.c: Formatting.
(ensure_undefweak_dynamic): Don't make dynamic when
info->dynamic_undefined_weak is zero.
(allocate_dynrelocs): Discard undefweak dyn_relocs for
info->dynamic_undefined_weak. Discard them earlier.
ld/
* ld.texinfo (dynamic-undefined-weak): Document.
(nodynamic-undefined-weak): Document that this option now can
be used with shared libs.
* emulparams/dynamic_undefined_weak.sh: Support -z
dynamic-undefined-weak.
* emulparams/elf32ppccommon.sh: Include dynamic_undefined_weak.sh.
* testsuite/ld-undefined/weak-undef.exp (undef_weak_so),
(undef_weak_exe): New. Use them. Add -z dynamic-undefined-weak
and -z nodynamic-undefined-weak tests.
* Makefile.am: Update powerpc dependencies.
* Makefile.in: Regenerate.
Diffstat (limited to 'ld/emulparams')
-rw-r--r-- | ld/emulparams/dynamic_undefined_weak.sh | 13 | ||||
-rw-r--r-- | ld/emulparams/elf32ppccommon.sh | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/ld/emulparams/dynamic_undefined_weak.sh b/ld/emulparams/dynamic_undefined_weak.sh index 82d88d6..a20bbd4 100644 --- a/ld/emulparams/dynamic_undefined_weak.sh +++ b/ld/emulparams/dynamic_undefined_weak.sh @@ -1,12 +1,15 @@ -PARSE_AND_LIST_OPTIONS_NODYNAMIC_UNDEFINED_WEAK=' +PARSE_AND_LIST_OPTIONS_DYNAMIC_UNDEFINED_WEAK=' fprintf (file, _("\ - -z nodynamic-undefined-weak Do not treat undefined weak symbol as dynamic\n")); + -z dynamic-undefined-weak Make undefined weak symbols dynamic\n\ + -z nodynamic-undefined-weak Do not make undefined weak symbols dynamic\n")); ' -PARSE_AND_LIST_ARGS_CASE_Z_NODYNAMIC_UNDEFINED_WEAK=' +PARSE_AND_LIST_ARGS_CASE_Z_DYNAMIC_UNDEFINED_WEAK=' + else if (strcmp (optarg, "dynamic-undefined-weak") == 0) + link_info.dynamic_undefined_weak = TRUE; else if (strcmp (optarg, "nodynamic-undefined-weak") == 0) link_info.dynamic_undefined_weak = FALSE; ' -PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_NODYNAMIC_UNDEFINED_WEAK" -PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_NODYNAMIC_UNDEFINED_WEAK" +PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_DYNAMIC_UNDEFINED_WEAK" +PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_DYNAMIC_UNDEFINED_WEAK" diff --git a/ld/emulparams/elf32ppccommon.sh b/ld/emulparams/elf32ppccommon.sh index d00cf68..44edbd0 100644 --- a/ld/emulparams/elf32ppccommon.sh +++ b/ld/emulparams/elf32ppccommon.sh @@ -1,5 +1,7 @@ # The PLT-agnostic parts of a generic 32-bit ELF PowerPC target. Included by: # elf32ppc.sh elf32ppcvxworks.sh elf64ppc.sh +. ${srcdir}/emulparams/dynamic_undefined_weak.sh + TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes |