Fix Common symbol override test fails

Fixes fails on SH and NDS32 introduced by dyn_reloc tidy.

	* elf32-lm32.c (lm32_elf_check_relocs): Skip non-ALLOC sections.
	* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
	* elf32-nds32.c (nds32_elf_check_relocs): Likewise.
	* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
	* elf32-sh.c (sh_elf_check_relocs): Likewise.
This commit is contained in:
Alan Modra 2017-12-06 17:31:15 +10:30
parent a3cc9aad2e
commit 6528139686
6 changed files with 53 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2017-12-06 Alan Modra <amodra@gmail.com>
* elf32-lm32.c (lm32_elf_check_relocs): Skip non-ALLOC sections.
* elf32-m32r.c (m32r_elf_check_relocs): Likewise.
* elf32-nds32.c (nds32_elf_check_relocs): Likewise.
* elf32-or1k.c (or1k_elf_check_relocs): Likewise.
* elf32-sh.c (sh_elf_check_relocs): Likewise.
2017-12-06 Alan Modra <amodra@gmail.com>
* elf32-hppa.c (struct elf32_hppa_dyn_reloc_entry): Delete. Use

View File

@ -1165,6 +1165,15 @@ lm32_elf_check_relocs (bfd *abfd,
if (bfd_link_relocatable (info))
return TRUE;
/* Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate. */
if ((sec->flags & SEC_ALLOC) == 0)
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
sym_hashes_end = sym_hashes + symtab_hdr->sh_size/sizeof (Elf32_External_Sym);

View File

@ -3547,6 +3547,15 @@ m32r_elf_check_relocs (bfd *abfd,
if (bfd_link_relocatable (info))
return TRUE;
/* Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate. */
if ((sec->flags & SEC_ALLOC) == 0)
return TRUE;
sreloc = NULL;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);

View File

@ -6100,6 +6100,15 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (bfd_link_relocatable (info))
return TRUE;
/* Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate. */
if ((sec->flags & SEC_ALLOC) == 0)
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
sym_hashes_end =

View File

@ -1301,6 +1301,15 @@ or1k_elf_check_relocs (bfd *abfd,
if (bfd_link_relocatable (info))
return TRUE;
/* Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate. */
if ((sec->flags & SEC_ALLOC) == 0)
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);

View File

@ -5782,6 +5782,15 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
if (bfd_link_relocatable (info))
return TRUE;
/* Don't do anything special with non-loaded, non-alloced sections.
In particular, any relocs in such sections should not affect GOT
and PLT reference counting (ie. we don't allow them to create GOT
or PLT entries), there's no possibility or desire to optimize TLS
relocs, and there's not much point in propagating relocs to shared
libs that the dynamic linker won't relocate. */
if ((sec->flags & SEC_ALLOC) == 0)
return TRUE;
BFD_ASSERT (is_sh_elf (abfd));
symtab_hdr = &elf_symtab_hdr (abfd);