From 9c50426849f0e9bb15ab0b46dc18a70c1db38a90 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Mon, 13 Sep 2004 14:14:32 +0000 Subject: [PATCH] bfd/ * 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. gas/ * config/tc-arm.c: Rename RELABS to TARGET1. gas/testsuite/ * gas/arm/pic.d: Rename RELABS to TARGET1. * gas/arm/pic.s: Ditto. include/ * elf/arm.h: Rename RELABS to TARGET1. ld/ * emulparams/armsymbian.sh: Set TARGET1_IS_REL. * emultempl/armelf.em: Use TARGET1_IS_REL. Add --target1-{rel,abs}. --- bfd/ChangeLog | 14 ++++++++++++++ bfd/bfd-in.h | 2 +- bfd/bfd-in2.h | 4 ++-- bfd/elf32-arm.h | 38 +++++++++++++++++++++++++++++++------ bfd/elfarm-nabi.c | 6 +++--- bfd/libbfd.h | 2 +- bfd/reloc.c | 2 +- gas/ChangeLog | 4 ++++ gas/config/tc-arm.c | 6 +++--- gas/testsuite/ChangeLog | 5 +++++ gas/testsuite/gas/arm/pic.d | 2 +- gas/testsuite/gas/arm/pic.s | 2 +- include/ChangeLog | 4 ++++ include/elf/arm.h | 2 +- ld/ChangeLog | 5 +++++ ld/emulparams/armsymbian.sh | 1 + ld/emultempl/armelf.em | 18 +++++++++++++++++- 17 files changed, 96 insertions(+), 21 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8ef66c6e24d..eb179d9d1b5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,17 @@ +2004-09-13 Paul Brook + + * 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 * hpux-core.c (thread_section_p): New function. diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 062e55e49f6..da4c9746c2e 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 3998a7fc5d7..8e732b77432 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 656a8221147..ac3ec95be3f 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 66445784e9d..aef15d47c59 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 64565326a62..4e9a4c27291 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 9c1ed33f1ab..1c95d7ec44b 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. diff --git a/gas/ChangeLog b/gas/ChangeLog index 22efeee8fc6..87df7f87866 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,7 @@ +2004-09-13 Paul Brook + + * config/tc-arm.c: Rename RELABS to TARGET1. + 2004-09-13 Alan Modra * messages.c (as_internal_value_out_of_range): Cast values passed diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index da447c85dca..faa628bd285 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -12487,7 +12487,7 @@ md_apply_fix3 (fixP, valP, seg) case BFD_RELOC_RVA: case BFD_RELOC_32: - case BFD_RELOC_ARM_RELABS32: + case BFD_RELOC_ARM_TARGET1: case BFD_RELOC_ARM_ROSEGREL32: case BFD_RELOC_ARM_SBREL32: if (fixP->fx_done || fixP->fx_pcrel) @@ -12777,7 +12777,7 @@ tc_gen_reloc (section, fixp) case BFD_RELOC_ARM_GOT32: case BFD_RELOC_ARM_GOTOFF: case BFD_RELOC_ARM_PLT32: - case BFD_RELOC_ARM_RELABS32: + case BFD_RELOC_ARM_TARGET1: case BFD_RELOC_ARM_ROSEGREL32: case BFD_RELOC_ARM_SBREL32: code = fixp->fx_r_type; @@ -14149,7 +14149,7 @@ arm_parse_reloc () /* ScottB: Jan 30, 1998 - Added support for parsing "var(PLT)" branch instructions generated by GCC for PLT relocs. */ MAP ("(plt)", BFD_RELOC_ARM_PLT32), - MAP ("(relabs)", BFD_RELOC_ARM_RELABS32), + MAP ("(target1)", BFD_RELOC_ARM_TARGET1), MAP ("(sbrel)", BFD_RELOC_ARM_SBREL32), { NULL, 0, BFD_RELOC_UNUSED } #undef MAP diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index c1f0e07c2c5..c2e4663cfb1 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-09-13 Paul Brook + + * gas/arm/pic.d: Rename RELABS to TARGET1. + * gas/arm/pic.s: Ditto. + 2004-09-03 Tomer Levi * gas/crx: New directory. diff --git a/gas/testsuite/gas/arm/pic.d b/gas/testsuite/gas/arm/pic.d index bd69d1bbd49..ff536ad0612 100644 --- a/gas/testsuite/gas/arm/pic.d +++ b/gas/testsuite/gas/arm/pic.d @@ -15,5 +15,5 @@ Disassembly of section .text: c: R_ARM_GOT32 sym 10: R_ARM_GOTOFF sym 14: R_ARM_GOTPC _GLOBAL_OFFSET_TABLE_ - 18: R_ARM_RELABS32 foo2 + 18: R_ARM_TARGET1 foo2 1c: R_ARM_SBREL32 foo3 diff --git a/gas/testsuite/gas/arm/pic.s b/gas/testsuite/gas/arm/pic.s index 8d0842cfce0..7a26750c5bf 100644 --- a/gas/testsuite/gas/arm/pic.s +++ b/gas/testsuite/gas/arm/pic.s @@ -9,5 +9,5 @@ .word sym(GOTOFF) 1: .word _GLOBAL_OFFSET_TABLE_ - 1b - .word foo2(RELABS) + .word foo2(TARGET1) .word foo3(SBREL) diff --git a/include/ChangeLog b/include/ChangeLog index fe64d5b8d78..d60b634c053 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,7 @@ +2004-09-13 Paul Brook + + * elf/arm.h: Rename RELABS to TARGET1. + 2004-09-04 Kaveh R. Ghazi * ansidecl.h (ATTRIBUTE_SENTINEL): Define. diff --git a/include/elf/arm.h b/include/elf/arm.h index a391a0e681d..34bde17e921 100644 --- a/include/elf/arm.h +++ b/include/elf/arm.h @@ -127,7 +127,7 @@ START_RELOC_NUMBERS (elf_arm_reloc_type) RELOC_NUMBER (R_ARM_LDR_SBREL_11_0, 35) RELOC_NUMBER (R_ARM_ALU_SBREL_19_12, 36) RELOC_NUMBER (R_ARM_ALU_SBREL_27_20, 37) - RELOC_NUMBER (R_ARM_RELABS32, 38) + RELOC_NUMBER (R_ARM_TARGET1, 38) RELOC_NUMBER (R_ARM_ROSEGREL32, 39) RELOC_NUMBER (R_ARM_V4BX, 40) RELOC_NUMBER (R_ARM_STKCHK, 41) diff --git a/ld/ChangeLog b/ld/ChangeLog index 5124bb61153..c36ee745c3f 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2004-09-13 Paul Brook + + * emulparams/armsymbian.sh: Set TARGET1_IS_REL. + * emultempl/armelf.em: Use TARGET1_IS_REL. Add --target1-{rel,abs}. + 2004-09-07 H.J. Lu * configure: Regenerated with autconfig 2.13. diff --git a/ld/emulparams/armsymbian.sh b/ld/emulparams/armsymbian.sh index 630024e3e42..ce3a963ba0b 100644 --- a/ld/emulparams/armsymbian.sh +++ b/ld/emulparams/armsymbian.sh @@ -4,6 +4,7 @@ GENERATE_COMBRELOC_SCRIPT=1 OUTPUT_FORMAT="elf32-littlearm-symbian" BIG_OUTPUT_FORMAT="elf32-bigarm-symbian" LITTLE_OUTPUT_FORMAT="$OUTPUT_FORMAT" +TARGET1_IS_REL=1 # This value should match ELF_MAXPAGESIZE in BFD. Otherwise, elf.c # will not place read-write sections in a separate ELF segment from diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 5505f1230d0..6a690f8bc11 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -28,6 +28,7 @@ static int no_pipeline_knowledge = 0; static char *thumb_entry_symbol = NULL; static bfd *bfd_for_interwork; static int byteswap_code = 0; +static int target1_is_rel = 0${TARGET1_IS_REL}; static void gld${EMULATION_NAME}_before_parse (void) @@ -120,7 +121,8 @@ arm_elf_before_allocation (void) { if (!bfd_elf32_arm_process_before_allocation (is->the_bfd, & link_info, no_pipeline_knowledge, - byteswap_code)) + byteswap_code, + target1_is_rel)) { /* xgettext:c-format */ einfo (_("Errors encountered processing file %s"), is->filename); @@ -188,6 +190,8 @@ EOF PARSE_AND_LIST_PROLOGUE=' #define OPTION_THUMB_ENTRY 301 #define OPTION_BE8 302 +#define OPTION_TARGET1_REL 303 +#define OPTION_TARGET1_ABS 304 ' PARSE_AND_LIST_SHORTOPTS=p @@ -196,12 +200,16 @@ PARSE_AND_LIST_LONGOPTS=' { "no-pipeline-knowledge", no_argument, NULL, '\'p\''}, { "thumb-entry", required_argument, NULL, OPTION_THUMB_ENTRY}, { "be8", no_argument, NULL, OPTION_BE8}, + { "target1-rel", no_argument, NULL, OPTION_TARGET1_REL}, + { "target1-abs", no_argument, NULL, OPTION_TARGET1_ABS}, ' PARSE_AND_LIST_OPTIONS=' fprintf (file, _(" -p --no-pipeline-knowledge Stop the linker knowing about the pipeline length\n")); fprintf (file, _(" --thumb-entry= Set the entry point to be Thumb symbol \n")); fprintf (file, _(" --be8 Oputput BE8 format image\n")); + fprintf (file, _(" --target1-rel Interpret R_ARM_TARGET1 as R_ARM_REL32\n")); + fprintf (file, _(" --target1-abs Interpret R_ARM_TARGET1 as R_ARM_ABS32\n")); ' PARSE_AND_LIST_ARGS_CASES=' @@ -216,6 +224,14 @@ PARSE_AND_LIST_ARGS_CASES=' case OPTION_BE8: byteswap_code = 1; break; + + case OPTION_TARGET1_REL: + target1_is_rel = 1; + break; + + case OPTION_TARGET1_ABS: + target1_is_rel = 0; + break; ' # We have our own after_open and before_allocation functions, but they call -- 2.30.2