From 894891db7f1ff09f021a0d2c8bb471f3a73a776a Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 10 Jun 2011 14:04:25 +0000 Subject: * elflink.c (_bfd_elf_link_create_dynamic_sections): If the backend does not provide a function for creating dynamic sections then fail. (bfd_elf_final_link): Issue a warning message if a dynamic section has the SHT_NOTE type. (bfd_elf_final_link): Do not look for dynamic strings in a section that does not have the SHT_STRTAB type or the name .dynstr. * elf32-arm.c (elf32_arm_finish_dynamic_sections): Fail if the got section is not in the output binary. * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Likewise. * ld-elf/elf.exp: Add test for linking a shared library with a broken linker script that marks dynamic sections as being notes. * ld-elf/note-3.s: New test source file. * ld-elf/note-3.t: New test linker script. * ld-elf/note-3.l: Expected output from the linker. * lib/ld-lib.exp (run_ld_link_tests): Improve description. --- bfd/elf32-arm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bfd/elf32-arm.c') diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index d5a4a4e..8ace48a 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -13744,6 +13744,10 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info dynobj = elf_hash_table (info)->dynobj; sgot = htab->root.sgotplt; + /* A broken linker script might have discarded the dynamic sections. + Catch this here so that we do not seg-fault later on. */ + if (sgot != NULL && bfd_is_abs_section (sgot->output_section)) + return FALSE; sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); if (elf_hash_table (info)->dynamic_sections_created) -- cgit v1.1