bfd/
authorPaul Brook <paul@codesourcery.com>
Mon, 13 Sep 2004 14:14:32 +0000 (14:14 +0000)
committerPaul Brook <paul@codesourcery.com>
Mon, 13 Sep 2004 14:14:32 +0000 (14:14 +0000)
* 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}.

17 files changed:
bfd/ChangeLog
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/elf32-arm.h
bfd/elfarm-nabi.c
bfd/libbfd.h
bfd/reloc.c
gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/pic.d
gas/testsuite/gas/arm/pic.s
include/ChangeLog
include/elf/arm.h
ld/ChangeLog
ld/emulparams/armsymbian.sh
ld/emultempl/armelf.em

index 8ef66c6..eb179d9 100644 (file)
@@ -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.
index 062e55e..da4c974 100644 (file)
@@ -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 *);
index 3998a7f..8e732b7 100644 (file)
@@ -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,
index 656a822..ac3ec95 100644 (file)
@@ -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;
index 6644578..aef15d4 100644 (file)
@@ -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}
   };
index 6456532..4e9a4c2 100644 (file)
@@ -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",
index 9c1ed33..1c95d7e 100644 (file)
@@ -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.
index 22efeee..87df7f8 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-13  Paul Brook  <paul@codesourcery.com>
+
+       * config/tc-arm.c: Rename RELABS to TARGET1.
+
 2004-09-13  Alan Modra  <amodra@bigpond.net.au>
 
        * messages.c (as_internal_value_out_of_range): Cast values passed
index da447c8..faa628b 100644 (file)
@@ -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
index c1f0e07..c2e4663 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-13  Paul Brook  <paul@codesourcery.com>
+
+       * gas/arm/pic.d: Rename RELABS to TARGET1.
+       * gas/arm/pic.s: Ditto.
+
 2004-09-03  Tomer Levi  <Tomer.Levi@nsc.com>
 
        * gas/crx: New directory.
index bd69d1b..ff536ad 100644 (file)
@@ -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
index 8d0842c..7a26750 100644 (file)
@@ -9,5 +9,5 @@
        .word   sym(GOTOFF)
 1:
        .word   _GLOBAL_OFFSET_TABLE_ - 1b
-       .word foo2(RELABS)
+       .word foo2(TARGET1)
        .word foo3(SBREL)
index fe64d5b..d60b634 100644 (file)
@@ -1,3 +1,7 @@
+2004-09-13  Paul Brook  <paul@codesourcery.com>
+
+       * elf/arm.h: Rename RELABS to TARGET1.
+
 2004-09-04  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * ansidecl.h (ATTRIBUTE_SENTINEL): Define.
index a391a0e..34bde17 100644 (file)
@@ -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)
index 5124bb6..c36ee74 100644 (file)
@@ -1,3 +1,8 @@
+2004-09-13  Paul Brook  <paul@codesourcery.com>
+
+       * emulparams/armsymbian.sh: Set TARGET1_IS_REL.
+       * emultempl/armelf.em: Use TARGET1_IS_REL.  Add --target1-{rel,abs}.
+
 2004-09-07  H.J. Lu  <hongjiu.lu@intel.com>
 
        * configure: Regenerated with autconfig 2.13.
index 630024e..ce3a963 100644 (file)
@@ -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
index 5505f12..6a690f8 100644 (file)
@@ -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=<sym>      Set the entry point to be Thumb symbol <sym>\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