From: Nick Clifton Date: Thu, 4 Aug 2016 15:00:27 +0000 (+0100) Subject: Fix the generation of GOT table entries for the SH in the presence of linker garbage... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dccb2ff522d2afba77301a046b37949356c29f88;p=thirdparty%2Fbinutils-gdb.git Fix the generation of GOT table entries for the SH in the presence of linker garbage collection. PR ld/17739 * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Define with ld valye 'yes'. * emulparams/shelf32.sh: Likewise. * emulparams/shelf32.sh: Likewise. * emulparams/shelf_nto.sh: Likewise. * emulparams/shelf_nto.sh: Likewise. * emulparams/shelf_vxworks.sh: Likewise. * emulparams/shelf_vxworks.sh: Likewise. * emulparams/shlelf32_linux.sh: Likewise. * emulparams/shlelf32_linux.sh: Likewise. * emulparams/shlelf_linux.sh: Likewise. * emulparams/shlelf_linux.sh: Likewise. * emulparams/shlelf_nto.sh: Likewise. * emulparams/shlelf_nto.sh: Likewise. bfd * elf32-sh.c (sh_elf_gc_sweep_hook): Delete. (elf_backend_sweep_hook): Delete. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2affa223fa9..48d41e57ef0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2016-08-02 Nick Clifton + + PR ld/17739 + * elf32-sh.c (sh_elf_gc_sweep_hook): Delete. + (elf_backend_sweep_hook): Delete. + 2016-08-03 Tristan Gingold * version.m4: Bump version to 2.27.0 diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 52a5fd1bd31..5609b55da61 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -5682,6 +5682,7 @@ sh_elf_gc_mark_hook (asection *sec, return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym); } +#if 0 /* Update the got entry reference counts for the section being removed. */ static bfd_boolean @@ -5895,6 +5896,7 @@ sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, return TRUE; } +#endif /* Copy the extra info we tack onto an elf_link_hash_entry. */ @@ -7455,7 +7457,7 @@ sh_elf_encode_eh_address (bfd *abfd, sh_elf_merge_private_data #define elf_backend_gc_mark_hook sh_elf_gc_mark_hook -#define elf_backend_gc_sweep_hook sh_elf_gc_sweep_hook +//#define elf_backend_gc_sweep_hook sh_elf_gc_sweep_hook #define elf_backend_check_relocs sh_elf_check_relocs #define elf_backend_copy_indirect_symbol \ sh_elf_copy_indirect_symbol diff --git a/ld/ChangeLog b/ld/ChangeLog index 062e134145c..d95592a5256 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,21 @@ +2016-08-02 Nick Clifton + + PR ld/17739 + * emulparams/shelf.sh (CHECK_RELOCS_AFTER_OPEN_INPUT): Define with + valye 'yes'. + * emulparams/shelf32.sh: Likewise. + * emulparams/shelf32.sh: Likewise. + * emulparams/shelf_nto.sh: Likewise. + * emulparams/shelf_nto.sh: Likewise. + * emulparams/shelf_vxworks.sh: Likewise. + * emulparams/shelf_vxworks.sh: Likewise. + * emulparams/shlelf32_linux.sh: Likewise. + * emulparams/shlelf32_linux.sh: Likewise. + * emulparams/shlelf_linux.sh: Likewise. + * emulparams/shlelf_linux.sh: Likewise. + * emulparams/shlelf_nto.sh: Likewise. + * emulparams/shlelf_nto.sh: Likewise. + 2016-08-03 Tristan Gingold * configure: Regenerate. diff --git a/ld/emulparams/shelf.sh b/ld/emulparams/shelf.sh index 83680a667fb..d3f4752e883 100644 --- a/ld/emulparams/shelf.sh +++ b/ld/emulparams/shelf.sh @@ -11,6 +11,9 @@ MACHINE= TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes EMBEDDED=yes +# PR 17739. Delay checking relocs until after all files have +# been opened and linker garbage collection has taken place. +CHECK_RELOCS_AFTER_OPEN_INPUT=yes # These are for compatibility with the COFF toolchain. ENTRY=start diff --git a/ld/emulparams/shelf32.sh b/ld/emulparams/shelf32.sh index 966bd3093cd..bf362c5a2eb 100644 --- a/ld/emulparams/shelf32.sh +++ b/ld/emulparams/shelf32.sh @@ -11,6 +11,9 @@ ALIGNMENT=8 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes EMBEDDED=yes +# PR 17739. Delay checking relocs until after all files have +# been opened and linker garbage collection has taken place. +CHECK_RELOCS_AFTER_OPEN_INPUT=yes DATA_START_SYMBOLS='PROVIDE (___data = .);' diff --git a/ld/emulparams/shelf_nto.sh b/ld/emulparams/shelf_nto.sh index c4d71aa9993..46efd878960 100644 --- a/ld/emulparams/shelf_nto.sh +++ b/ld/emulparams/shelf_nto.sh @@ -9,3 +9,6 @@ TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes TEXT_START_SYMBOLS='_btext = .;' ENTRY=_start +# PR 17739. Delay checking relocs until after all files have +# been opened and linker garbage collection has taken place. +CHECK_RELOCS_AFTER_OPEN_INPUT=yes diff --git a/ld/emulparams/shelf_vxworks.sh b/ld/emulparams/shelf_vxworks.sh index 77619cb2ac6..759ffac2886 100644 --- a/ld/emulparams/shelf_vxworks.sh +++ b/ld/emulparams/shelf_vxworks.sh @@ -14,6 +14,10 @@ TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes ENTRY=__start SYMPREFIX=_ +# PR 17739. Delay checking relocs until after all files have +# been opened and linker garbage collection has taken place. +CHECK_RELOCS_AFTER_OPEN_INPUT=yes + GOT=".got ${RELOCATING-0} : { PROVIDE(__GLOBAL_OFFSET_TABLE_ = .); *(.got.plt) *(.got) }" diff --git a/ld/emulparams/shlelf32_linux.sh b/ld/emulparams/shlelf32_linux.sh index 81aea39c81f..0327e57ad64 100644 --- a/ld/emulparams/shlelf32_linux.sh +++ b/ld/emulparams/shlelf32_linux.sh @@ -13,7 +13,9 @@ ALIGNMENT=8 TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes - +# PR 17739. Delay checking relocs until after all files have +# been opened and linker garbage collection has taken place. +CHECK_RELOCS_AFTER_OPEN_INPUT=yes DATA_START_SYMBOLS='PROVIDE (___data = .);' diff --git a/ld/emulparams/shlelf_linux.sh b/ld/emulparams/shlelf_linux.sh index c14aae228d1..4e2a5813f20 100644 --- a/ld/emulparams/shlelf_linux.sh +++ b/ld/emulparams/shlelf_linux.sh @@ -12,6 +12,9 @@ MACHINE= TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes GENERATE_PIE_SCRIPT=yes +# PR 17739. Delay checking relocs until after all files have +# been opened and linker garbage collection has taken place. +CHECK_RELOCS_AFTER_OPEN_INPUT=yes DATA_START_SYMBOLS='PROVIDE (__data_start = .);'; diff --git a/ld/emulparams/shlelf_nto.sh b/ld/emulparams/shlelf_nto.sh index 16f65087eb0..f8ffc13b36b 100644 --- a/ld/emulparams/shlelf_nto.sh +++ b/ld/emulparams/shlelf_nto.sh @@ -9,3 +9,6 @@ TEMPLATE_NAME=elf32 GENERATE_SHLIB_SCRIPT=yes TEXT_START_SYMBOLS='_btext = .;' ENTRY=_start +# PR 17739. Delay checking relocs until after all files have +# been opened and linker garbage collection has taken place. +CHECK_RELOCS_AFTER_OPEN_INPUT=yes