aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-12-13 15:34:28 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-12-13 15:34:28 +0000
commit25bbc984802ebed8906adb1abbb9cb72aadf6a6e (patch)
tree99ff518358212f042047ad565669848bddc9b2e3 /bfd/elf.c
parenta717134b331a2e8ccd5e43f15683a202c4d7ea64 (diff)
downloadfsf-binutils-gdb-25bbc984802ebed8906adb1abbb9cb72aadf6a6e.zip
fsf-binutils-gdb-25bbc984802ebed8906adb1abbb9cb72aadf6a6e.tar.gz
fsf-binutils-gdb-25bbc984802ebed8906adb1abbb9cb72aadf6a6e.tar.bz2
2005-12-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2008 * elf.c (_bfd_elf_setup_sections): Return FALSE if elf_linked_to_section will be set to NULL. * format.c (bfd_check_format_matches): Don't check the default target twice.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 58a9059..019f72a 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -654,8 +654,23 @@ _bfd_elf_setup_sections (bfd *abfd)
}
else
{
+ asection *link;
+
this_hdr = elf_elfsections (abfd)[elfsec];
- elf_linked_to_section (s) = this_hdr->bfd_section;
+
+ /* PR 1991, 2008:
+ Some strip/objcopy may leave an incorrect value in
+ sh_link. We don't want to proceed. */
+ link = this_hdr->bfd_section;
+ if (link == NULL)
+ {
+ (*_bfd_error_handler)
+ (_("%B: sh_link [%d] in section `%A' is incorrect"),
+ s->owner, s, elfsec);
+ result = FALSE;
+ }
+
+ elf_linked_to_section (s) = link;
}
}
}