From cbc704f39759a08018b92ff51dc00144ed718eb7 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 14 Mar 2011 15:53:58 +0000 Subject: [PATCH] bfd/ * elf32-arm.c (elf32_arm_check_relocs): Always assign a dynobj. (elf32_arm_finish_dynamic_sections): Move sgot != NULL assertion into the PLT block. ld/ * emultempl/armelf.em (arm_elf_before_allocation): Check dynobj instead of dynamic_sections_created. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-arm.c | 18 +++++++++--------- ld/ChangeLog | 5 +++++ ld/emultempl/armelf.em | 2 +- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 198ed38bfda..481145322ff 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2011-03-14 Richard Sandiford + + * elf32-arm.c (elf32_arm_check_relocs): Always assign a dynobj. + (elf32_arm_finish_dynamic_sections): Move sgot != NULL assertion + into the PLT block. + 2011-03-14 Richard Sandiford * elf32-arm.c (elf32_arm_check_relocs): Use call_reloc_p, diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 76c01276b4f..2636052a059 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -11398,7 +11398,11 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, return FALSE; } - dynobj = elf_hash_table (info)->dynobj; + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + + dynobj = htab->root.dynobj; + symtab_hdr = & elf_symtab_hdr (abfd); sym_hashes = elf_sym_hashes (abfd); nsyms = NUM_SHDR_ENTRIES (symtab_hdr); @@ -11544,13 +11548,9 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_ARM_GOTOFF32: case R_ARM_GOTPC: - if (htab->root.sgot == NULL) - { - if (htab->root.dynobj == NULL) - htab->root.dynobj = abfd; - if (!create_got_section (htab->root.dynobj, info)) - return FALSE; - } + if (htab->root.sgot == NULL + && !create_got_section (htab->root.dynobj, info)) + return FALSE; break; case R_ARM_PC24: @@ -13132,7 +13132,6 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info dynobj = elf_hash_table (info)->dynobj; sgot = htab->root.sgotplt; - BFD_ASSERT (htab->symbian_p || sgot != NULL); sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); if (elf_hash_table (info)->dynamic_sections_created) @@ -13142,6 +13141,7 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info splt = htab->root.splt; BFD_ASSERT (splt != NULL && sdyn != NULL); + BFD_ASSERT (htab->symbian_p || sgot != NULL); dyncon = (Elf32_External_Dyn *) sdyn->contents; dynconend = (Elf32_External_Dyn *) (sdyn->contents + sdyn->size); diff --git a/ld/ChangeLog b/ld/ChangeLog index cdc9198d8e6..7dd9abf292e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2011-03-14 Richard Sandiford + + * emultempl/armelf.em (arm_elf_before_allocation): Check dynobj + instead of dynamic_sections_created. + 2011-03-10 Dave Korn * plugin.c (get_symbols): Use wrapped lookup for undefined symbols. diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 6c4c78d5047..bfc57cac7b4 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -67,7 +67,7 @@ arm_elf_before_allocation (void) /* We should be able to set the size of the interworking stub section. We can't do it until later if we have dynamic sections, though. */ - if (! elf_hash_table (&link_info)->dynamic_sections_created) + if (elf_hash_table (&link_info)->dynobj == NULL) { /* Here we rummage through the found bfds to collect glue information. */ LANG_FOR_EACH_INPUT_STATEMENT (is) -- 2.30.2