aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2009-06-27 16:07:10 +0000
committerH.J. Lu <hjl.tools@gmail.com>2009-06-27 16:07:10 +0000
commit83b89087cf717b455598eee2fb5ddb4d5465a6a0 (patch)
treea16218a3717d541bf82cc148b53eac113dbfe170 /bfd/elf.c
parent224180050f33e60feca36986cf2c843154b88138 (diff)
downloadgdb-83b89087cf717b455598eee2fb5ddb4d5465a6a0.zip
gdb-83b89087cf717b455598eee2fb5ddb4d5465a6a0.tar.gz
gdb-83b89087cf717b455598eee2fb5ddb4d5465a6a0.tar.bz2
bfd/
2009-06-27 H.J. Lu <hongjiu.lu@intel.com> PR ld/10337 * elf.c (bfd_section_from_shdr): Don't change sh_link for SHT_REL/SHT_RELA sections on executable nor shared library. Treat SHT_REL/SHT_RELA sections with sh_link set to SHN_UNDEF as a normal section. ld/testsuite/ 2009-06-27 H.J. Lu <hongjiu.lu@intel.com> PR ld/10337 * ld-ifunc/binutils.exp: New.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index e377d68..7f74236 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1728,8 +1728,11 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
reject them, but, unfortunately, some people need to use
them. We scan through the section headers; if we find only
one suitable symbol table, we clobber the sh_link to point
- to it. I hope this doesn't break anything. */
- if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_SYMTAB
+ to it. I hope this doesn't break anything.
+
+ Don't do it on executable nor shared library. */
+ if ((abfd->flags & (DYNAMIC | EXEC_P)) == 0
+ && elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_SYMTAB
&& elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_DYNSYM)
{
unsigned int scan;
@@ -1764,8 +1767,10 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
represent such a section, so at least for now, we don't
try. We just present it as a normal section. We also
can't use it as a reloc section if it points to the null
- section, an invalid section, or another reloc section. */
+ section, an invalid section, another reloc section, or its
+ sh_link points to the null section. */
if (hdr->sh_link != elf_onesymtab (abfd)
+ || hdr->sh_link == SHN_UNDEF
|| hdr->sh_info == SHN_UNDEF
|| hdr->sh_info >= num_sec
|| elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL