diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 14 | ||||
-rw-r--r-- | bfd/bfd-in.h | 2 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 4 | ||||
-rw-r--r-- | bfd/elf32-arm.h | 38 | ||||
-rw-r--r-- | bfd/elfarm-nabi.c | 6 | ||||
-rw-r--r-- | bfd/libbfd.h | 2 | ||||
-rw-r--r-- | bfd/reloc.c | 2 |
7 files changed, 54 insertions, 14 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8ef66c6..eb179d9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2004-09-13 Paul Brook <paul@codesourcery.com> + + * bfd-in.h (bfd_elf32_arm_process_before_allocation): Update + prototype. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * elf32-arm.h (elf32_arm_link_hash_table): Add target1_is_rel. + (elf32_arm_link_hash_table_create): Set target1_is_rel. + (bfd_elf32_arm_process_before_allocation): Ditto. + (elf32_arm_final_link_relocate): Handle R_ARM_TARGET1. + (elf32_arm_gc_sweep_hook, elf32_arm_check_relocs): Ditto. + * elfarm-nabi.c (elf32_arm_howto_table): Rename RELABS to TARGET1. + * reloc.c: Ditto. + 2004-09-10 Joel Brobecker <brobecker@gnat.com> * hpux-core.c (thread_section_p): New function. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 062e55e..da4c974 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -814,7 +814,7 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_process_before_allocation - (bfd *, struct bfd_link_info *, int, int); + (bfd *, struct bfd_link_info *, int, int, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 3998a7f..8e732b7 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -821,7 +821,7 @@ extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections (struct bfd_link_info *); extern bfd_boolean bfd_elf32_arm_process_before_allocation - (bfd *, struct bfd_link_info *, int, int); + (bfd *, struct bfd_link_info *, int, int, int); extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking (bfd *, struct bfd_link_info *); @@ -2641,7 +2641,7 @@ field in the instruction. */ /* Pc-relative or absolute relocation depending on target. Used for entries in .init_array sections. */ - BFD_RELOC_ARM_RELABS32, + BFD_RELOC_ARM_TARGET1, /* Read-only segment base relative address. */ BFD_RELOC_ARM_ROSEGREL32, diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 656a822..ac3ec95 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -182,6 +182,10 @@ struct elf32_arm_link_hash_table /* Nonzero to output a BE8 image. */ int byteswap_code; + /* Zero if R_ARM_TARGET1 means R_ARM_ABS32. + Nonzero if R_ARM_TARGET1 means R_ARM_ABS32. */ + int target1_is_rel; + /* The number of bytes in the initial entry in the PLT. */ bfd_size_type plt_header_size; @@ -373,6 +377,7 @@ elf32_arm_link_hash_table_create (bfd *abfd) ret->bfd_of_glue_owner = NULL; ret->no_pipeline_knowledge = 0; ret->byteswap_code = 0; + ret->target1_is_rel = 0; #ifdef FOUR_WORD_PLT ret->plt_header_size = 16; ret->plt_entry_size = 16; @@ -752,7 +757,8 @@ bfd_boolean bfd_elf32_arm_process_before_allocation (bfd *abfd, struct bfd_link_info *link_info, int no_pipeline_knowledge, - int byteswap_code) + int byteswap_code, + int target1_is_rel) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *internal_relocs = NULL; @@ -775,6 +781,7 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd, BFD_ASSERT (globals->bfd_of_glue_owner != NULL); globals->no_pipeline_knowledge = no_pipeline_knowledge; + globals->target1_is_rel = target1_is_rel; if (byteswap_code && !bfd_big_endian (abfd)) { _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."), @@ -1174,6 +1181,22 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, bfd_signed_vma signed_addend; struct elf32_arm_link_hash_table * globals; + globals = elf32_arm_hash_table (info); + +#ifndef OLD_ARM_ABI + /* Some relocation type map to different relocations depending on the + target. We pick the right one here. */ + if (r_type == R_ARM_TARGET1) + { + if (globals->target1_is_rel) + r_type = R_ARM_REL32; + else + r_type = R_ARM_ABS32; + + howto = &elf32_arm_howto_table[r_type]; + } +#endif /* OLD_ARM_ABI */ + /* If the start address has been set, then set the EF_ARM_HASENTRY flag. Setting this more than once is redundant, but the cost is not too high, and it keeps the code simple. @@ -1186,8 +1209,6 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, if (bfd_get_start_address (output_bfd) != 0) elf_elfheader (output_bfd)->e_flags |= EF_ARM_HASENTRY; - globals = elf32_arm_hash_table (info); - dynobj = elf_hash_table (info)->dynobj; if (dynobj) { @@ -2738,6 +2759,7 @@ elf32_arm_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED, case R_ARM_ABS32: case R_ARM_REL32: + case R_ARM_TARGET1: case R_ARM_PC24: case R_ARM_PLT32: r_symndx = ELF32_R_SYM (rel->r_info); @@ -2753,7 +2775,8 @@ elf32_arm_gc_sweep_hook (bfd * abfd ATTRIBUTE_UNUSED, h->plt.refcount -= 1; if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32 - || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32) + || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32 + || ELF32_R_TYPE (rel->r_info) == R_ARM_TARGET1) { eh = (struct elf32_arm_link_hash_entry *) h; @@ -2864,6 +2887,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_ARM_ABS32: case R_ARM_REL32: + case R_ARM_TARGET1: case R_ARM_PC24: case R_ARM_PLT32: if (h != NULL) @@ -2906,7 +2930,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, && (sec->flags & SEC_ALLOC) != 0 && ((ELF32_R_TYPE (rel->r_info) != R_ARM_PC24 && ELF32_R_TYPE (rel->r_info) != R_ARM_PLT32 - && ELF32_R_TYPE (rel->r_info) != R_ARM_REL32) + && ELF32_R_TYPE (rel->r_info) != R_ARM_REL32 + && ELF32_R_TYPE (rel->r_info) != R_ARM_TARGET1) || (h != NULL && (! info->symbolic || (h->elf_link_hash_flags @@ -2991,7 +3016,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, } if (ELF32_R_TYPE (rel->r_info) == R_ARM_ABS32 - || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32) + || ELF32_R_TYPE (rel->r_info) == R_ARM_REL32 + || ELF32_R_TYPE (rel->r_info) == R_ARM_TARGET1) p->count += 1; } break; diff --git a/bfd/elfarm-nabi.c b/bfd/elfarm-nabi.c index 6644578..aef15d4 100644 --- a/bfd/elfarm-nabi.c +++ b/bfd/elfarm-nabi.c @@ -595,7 +595,7 @@ static reloc_howto_type elf32_arm_howto_table[] = 0x0ff00000, /* dst_mask */ FALSE), /* pcrel_offset */ - HOWTO (R_ARM_RELABS32, /* type */ + HOWTO (R_ARM_TARGET1, /* type */ 0, /* rightshift */ 2, /* size (0 = byte, 1 = short, 2 = long) */ 32, /* bitsize */ @@ -603,7 +603,7 @@ static reloc_howto_type elf32_arm_howto_table[] = 0, /* bitpos */ complain_overflow_dont,/* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ - "R_ARM_RELABS32", /* name */ + "R_ARM_TARGET1", /* name */ FALSE, /* partial_inplace */ 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ @@ -769,7 +769,7 @@ static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] = {BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC}, {BFD_RELOC_ARM_GOT32, R_ARM_GOT32}, {BFD_RELOC_ARM_PLT32, R_ARM_PLT32}, - {BFD_RELOC_ARM_RELABS32, R_ARM_RELABS32}, + {BFD_RELOC_ARM_TARGET1, R_ARM_TARGET1}, {BFD_RELOC_ARM_ROSEGREL32, R_ARM_ROSEGREL32}, {BFD_RELOC_ARM_SBREL32, R_ARM_SBREL32} }; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 6456532..4e9a4c2 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1134,7 +1134,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ARM_RELATIVE", "BFD_RELOC_ARM_GOTOFF", "BFD_RELOC_ARM_GOTPC", - "BFD_RELOC_ARM_RELABS32", + "BFD_RELOC_ARM_TARGET1", "BFD_RELOC_ARM_ROSEGREL32", "BFD_RELOC_ARM_SBREL32", "BFD_RELOC_SH_PCDISP8BY2", diff --git a/bfd/reloc.c b/bfd/reloc.c index 9c1ed33..1c95d7e 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2609,7 +2609,7 @@ ENUMDOC These relocs are only used within the ARM assembler. They are not (at present) written to any object files. ENUM - BFD_RELOC_ARM_RELABS32 + BFD_RELOC_ARM_TARGET1 ENUMDOC Pc-relative or absolute relocation depending on target. Used for entries in .init_array sections. |