From bb224fc379f76b95370b39ab7f4341521815d63d Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Tue, 17 Oct 2006 14:49:51 +0000 Subject: [PATCH] * elf32-arm.c (elf32_arm_final_link_relocate): Add cases for R_ARM_ABS32_NOI and R_ARM_REL32_NOI. (elf32_arm_gc_sweep_hook): Likewise. (elf32_arm_check_relocs): Likewise. (allocate_dynrelocs): Likewise. --- bfd/ChangeLog | 8 ++++++++ bfd/elf32-arm.c | 49 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 03cff6c5f2e..f7bae6c61a8 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2006-10-17 Mark Shinwell + + * elf32-arm.c (elf32_arm_final_link_relocate): Add cases + for R_ARM_ABS32_NOI and R_ARM_REL32_NOI. + (elf32_arm_gc_sweep_hook): Likewise. + (elf32_arm_check_relocs): Likewise. + (allocate_dynrelocs): Likewise. + 2006-10-17 Alan Modra * elf-bfd.h (struct elf_link_hash_table): Reorder. Add diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index f4342b628a6..c2ef9b14635 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3626,7 +3626,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, case R_ARM_PC24: case R_ARM_ABS32: + case R_ARM_ABS32_NOI: case R_ARM_REL32: + case R_ARM_REL32_NOI: case R_ARM_CALL: case R_ARM_JUMP24: case R_ARM_XPC25: @@ -3642,7 +3644,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, will use the symbol's value, which may point to a PLT entry, but we don't need to handle that here. If we created a PLT entry, all branches in this object should go to it. */ - if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32) + if ((r_type != R_ARM_ABS32 && r_type != R_ARM_REL32 + && r_type != R_ARM_ABS32_NOI && r_type != R_ARM_REL32_NOI) && h != NULL && splt != NULL && h->plt.offset != (bfd_vma) -1) @@ -3666,7 +3669,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, run time. */ if ((info->shared || globals->root.is_relocatable_executable) && (input_section->flags & SEC_ALLOC) - && (r_type != R_ARM_REL32 + && ((r_type != R_ARM_REL32 && r_type != R_ARM_REL32_NOI) || !SYMBOL_CALLS_LOCAL (info, h)) && (h == NULL || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT @@ -3898,6 +3901,10 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, value |= 1; break; + case R_ARM_ABS32_NOI: + value += addend; + break; + case R_ARM_REL32: value += addend; if (sym_flags == STT_ARM_TFUNC) @@ -3906,6 +3913,12 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, + input_section->output_offset + rel->r_offset); break; + case R_ARM_REL32_NOI: + value += addend; + value -= (input_section->output_section->vma + + input_section->output_offset + rel->r_offset); + break; + case R_ARM_PREL31: value -= (input_section->output_section->vma + input_section->output_offset + rel->r_offset); @@ -6787,7 +6800,9 @@ elf32_arm_gc_sweep_hook (bfd * abfd, break; case R_ARM_ABS32: + case R_ARM_ABS32_NOI: case R_ARM_REL32: + case R_ARM_REL32_NOI: case R_ARM_PC24: case R_ARM_PLT32: case R_ARM_CALL: @@ -6820,14 +6835,17 @@ elf32_arm_gc_sweep_hook (bfd * abfd, } if (r_type == R_ARM_ABS32 - || r_type == R_ARM_REL32) + || r_type == R_ARM_REL32 + || r_type == R_ARM_ABS32_NOI + || r_type == R_ARM_REL32_NOI) { for (pp = &eh->relocs_copied; (p = *pp) != NULL; pp = &p->next) if (p->section == sec) { p->count -= 1; - if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32) + if (ELF32_R_TYPE (rel->r_info) == R_ARM_REL32 + || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32_NOI) p->pc_count -= 1; if (p->count == 0) *pp = p->next; @@ -7005,7 +7023,9 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Fall through */ case R_ARM_ABS32: + case R_ARM_ABS32_NOI: case R_ARM_REL32: + case R_ARM_REL32_NOI: case R_ARM_PC24: case R_ARM_PLT32: case R_ARM_CALL: @@ -7036,7 +7056,10 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, refers to is in a different object. We can't tell for sure yet, because something later might force the symbol local. */ - if (r_type != R_ARM_ABS32 && r_type != R_ARM_REL32) + if (r_type != R_ARM_ABS32 + && r_type != R_ARM_REL32 + && r_type != R_ARM_ABS32_NOI + && r_type != R_ARM_REL32_NOI) h->needs_plt = 1; /* If we create a PLT entry, this relocation will reference @@ -7061,7 +7084,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, relocs_copied field of the hash table entry. */ if ((info->shared || htab->root.is_relocatable_executable) && (sec->flags & SEC_ALLOC) != 0 - && (r_type == R_ARM_ABS32 + && ((r_type == R_ARM_ABS32 || r_type == R_ARM_ABS32_NOI) || (h != NULL && ! h->needs_plt && (! info->symbolic || ! h->def_regular)))) { @@ -7145,7 +7168,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, p->pc_count = 0; } - if (r_type == R_ARM_REL32) + if (r_type == R_ARM_REL32 || r_type == R_ARM_REL32_NOI) p->pc_count += 1; p->count += 1; } @@ -7680,12 +7703,12 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) if (info->shared || htab->root.is_relocatable_executable) { - /* The only reloc that uses pc_count is R_ARM_REL32, which will - appear on something like ".long foo - .". We want calls to - protected symbols to resolve directly to the function rather - than going via the plt. If people want function pointer - comparisons to work as expected then they should avoid - writing assembly like ".long foo - .". */ + /* The only reloc thats uses pc_count are R_ARM_REL32 and + R_ARM_REL32_NOI, which will appear on something like + ".long foo - .". We want calls to protected symbols to resolve + directly to the function rather than going via the plt. If people + want function pointer comparisons to work as expected then they + should avoid writing assembly like ".long foo - .". */ if (SYMBOL_CALLS_LOCAL (info, h)) { struct elf32_arm_relocs_copied **pp; -- 2.30.2