bfd/
[deliverable/binutils-gdb.git] / bfd / elf32-arm.h
index 0fcfe7956446f8d58d3950cbbf34761f4e967bb3..e32e871bff47bf0a606d8af44c4f48e8774b0a7a 100644 (file)
@@ -25,9 +25,9 @@
 typedef unsigned long int insn32;
 typedef unsigned short int insn16;
 
-/* In leiu of proper flags, assume all EABIv3 objects are interworkable.  */
+/* In lieu of proper flags, assume all EABIv4 objects are interworkable.  */
 #define INTERWORK_FLAG(abfd)  \
-  (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER3 \
+  (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER4 \
   || (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK))
 
 /* The linker script knows the section names for placement.
@@ -827,6 +827,10 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd,
 
          /* These are the only relocation types we care about.  */
          if (   r_type != R_ARM_PC24
+#ifndef OLD_ARM_ABI
+             && r_type != R_ARM_CALL
+             && r_type != R_ARM_JUMP24
+#endif
              && r_type != R_ARM_THM_PC22)
            continue;
 
@@ -864,6 +868,10 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd,
          switch (r_type)
            {
            case R_ARM_PC24:
+#ifndef OLD_ARM_ABI
+           case R_ARM_CALL:
+           case R_ARM_JUMP24:
+#endif
              /* This one is a call from arm code.  We need to look up
                 the target of the call.  If it is a thumb target, we
                 insert glue.  */
@@ -1295,6 +1303,8 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
     case R_ARM_ABS32:
     case R_ARM_REL32:
 #ifndef OLD_ARM_ABI
+    case R_ARM_CALL:
+    case R_ARM_JUMP24:
     case R_ARM_XPC25:
     case R_ARM_PREL31:
 #endif
@@ -1344,6 +1354,10 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
              || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
              || h->root.type != bfd_link_hash_undefweak)
          && r_type != R_ARM_PC24
+#ifndef OLD_ARM_ABI
+         && r_type != R_ARM_CALL
+         && r_type != R_ARM_JUMP24
+#endif
          && r_type != R_ARM_PLT32)
        {
          Elf_Internal_Rela outrel;
@@ -1416,6 +1430,8 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
        {
 #ifndef OLD_ARM_ABI
        case R_ARM_XPC25:         /* Arm BLX instruction.  */
+       case R_ARM_CALL:
+       case R_ARM_JUMP24:
 #endif
        case R_ARM_PC24:          /* Arm B/BL instruction */
        case R_ARM_PLT32:
@@ -2028,6 +2044,10 @@ arm_add_to_rel (bfd *              abfd,
          break;
 
        case R_ARM_PC24:
+#ifndef OLD_ARM_ABI
+       case R_ARM_CALL:
+       case R_ARM_JUMP24:
+#endif
          addend <<= howto->size;
          addend += increment;
 
@@ -2188,6 +2208,10 @@ elf32_arm_relocate_section (bfd *                  output_bfd,
              switch (r_type)
                {
                case R_ARM_PC24:
+#ifndef OLD_ARM_ABI
+               case R_ARM_CALL:
+               case R_ARM_JUMP24:
+#endif
                case R_ARM_ABS32:
                case R_ARM_THM_PC22:
                case R_ARM_PLT32:
@@ -2265,8 +2289,9 @@ elf32_arm_relocate_section (bfd *                  output_bfd,
              if ((! h ||
                   h->root.type != bfd_link_hash_undefined)
                  && (!((*info->callbacks->reloc_overflow)
-                       (info, name, howto->name, (bfd_vma) 0,
-                        input_bfd, input_section, rel->r_offset))))
+                       (info, (h ? &h->root : NULL), name, howto->name,
+                        (bfd_vma) 0, input_bfd, input_section,
+                        rel->r_offset))))
                  return FALSE;
              break;
 
@@ -2328,6 +2353,7 @@ elf32_arm_object_p (bfd *abfd)
 }
 
 /* Function to keep ARM specific flags in the ELF header.  */
+
 static bfd_boolean
 elf32_arm_set_private_flags (bfd *abfd, flagword flags)
 {
@@ -2503,7 +2529,7 @@ elf32_arm_merge_private_bfd_data (bfd * ibfd, bfd * obfd)
   if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
     {
       _bfd_error_handler
-       (_("ERROR: %B is compiled for EABI version %d, whereas %B is compiled for version %d"),
+       (_("ERROR: Source object %B has EABI version %d, but target %B has EABI version %d"),
         ibfd, obfd,
         (in_flags & EF_ARM_EABIMASK) >> 24,
         (out_flags & EF_ARM_EABIMASK) >> 24);
@@ -2704,6 +2730,10 @@ elf32_arm_print_private_bfd_data (bfd *abfd, void * ptr)
 
     case EF_ARM_EABI_VER3:
       fprintf (file, _(" [Version3 EABI]"));
+      break;
+
+    case EF_ARM_EABI_VER4:
+      fprintf (file, _(" [Version4 EABI]"));
 
       if (flags & EF_ARM_BE8)
        fprintf (file, _(" [BE8]"));
@@ -2855,6 +2885,8 @@ elf32_arm_gc_sweep_hook (bfd *                     abfd ATTRIBUTE_UNUSED,
        case R_ARM_PC24:
        case R_ARM_PLT32:
 #ifndef OLD_ARM_ABI
+       case R_ARM_CALL:
+       case R_ARM_JUMP24:
        case R_ARM_PREL31:
 #endif
          r_symndx = ELF32_R_SYM (rel->r_info);
@@ -2998,6 +3030,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
          case R_ARM_PC24:
          case R_ARM_PLT32:
 #ifndef OLD_ARM_ABI
+         case R_ARM_CALL:
+         case R_ARM_JUMP24:
          case R_ARM_PREL31:
 #endif
            if (h != NULL)
@@ -3016,6 +3050,10 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
                   sure yet, because something later might force the
                   symbol local.  */
                if (r_type == R_ARM_PC24
+#ifndef OLD_ARM_ABI
+                   || r_type == R_ARM_CALL
+                   || r_type == R_ARM_JUMP24
+#endif
                    || r_type == R_ARM_PLT32)
                  h->needs_plt = 1;
 
@@ -3041,6 +3079,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
                && ((r_type != R_ARM_PC24
                     && r_type != R_ARM_PLT32
 #ifndef OLD_ARM_ABI
+                    && r_type != R_ARM_CALL
+                    && r_type != R_ARM_JUMP24
                     && r_type != R_ARM_PREL31
 #endif
                     && r_type != R_ARM_REL32)
@@ -3163,6 +3203,14 @@ is_arm_mapping_symbol_name (const char * name)
     && (name[2] == 0);
 }
 
+/* Treat mapping symbols as special target symbols.  */
+
+static bfd_boolean
+elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
+{
+  return is_arm_mapping_symbol_name (sym->name);
+}
+
 /* This is a copy of elf_find_function() from elf.c except that
    ARM mapping symbols are ignored when looking for function names
    and STT_ARM_TFUNC is considered to a function type.  */
@@ -3201,7 +3249,7 @@ arm_elf_find_function (bfd *         abfd ATTRIBUTE_UNUSED,
            continue;
          /* Fall through.  */
        case STT_NOTYPE:
-         if (q->symbol.section == section
+         if (bfd_get_section (&q->symbol) == section
              && q->symbol.value >= low_func
              && q->symbol.value <= offset)
            {
@@ -3322,9 +3370,9 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
     }
   else
     /* It's possible that we incorrectly decided a .plt reloc was
-       needed for an R_ARM_PC24 reloc to a non-function sym in
-       check_relocs.  We can't decide accurately between function and
-       non-function syms in check-relocs;  Objects loaded later in
+       needed for an R_ARM_PC24 or similar reloc to a non-function sym
+       in check_relocs.  We can't decide accurately between function
+       and non-function syms in check-relocs; Objects loaded later in
        the link may change h->type.  So fix it now.  */
     h->plt.offset = (bfd_vma) -1;
 
@@ -3840,7 +3888,8 @@ elf32_arm_finish_dynamic_symbol (bfd * output_bfd, struct bfd_link_info * info,
                        splt->contents + h->plt.offset + 4 * i);
          
          /* Fill in the entry in the .rel.plt section.  */
-         rel.r_offset = (splt->output_offset
+         rel.r_offset = (splt->output_section->vma
+                         + splt->output_offset
                          + h->plt.offset + 4 * (i - 1));
          rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
        }
@@ -4033,7 +4082,16 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
            case DT_SYMTAB:
              name = ".dynsym";
              goto get_vma_if_bpabi;
-             
+           case DT_VERSYM:
+             name = ".gnu.version";
+             goto get_vma_if_bpabi;
+           case DT_VERDEF:
+             name = ".gnu.version_d";
+             goto get_vma_if_bpabi;
+           case DT_VERNEED:
+             name = ".gnu.version_r";
+             goto get_vma_if_bpabi;
+
            case DT_PLTGOT:
              name = ".got";
              goto get_vma;
@@ -4462,6 +4520,7 @@ elf32_arm_write_section (bfd *output_bfd ATTRIBUTE_UNUSED, asection *sec,
 #define bfd_elf32_bfd_reloc_type_lookup                elf32_arm_reloc_type_lookup
 #define bfd_elf32_find_nearest_line            elf32_arm_find_nearest_line
 #define bfd_elf32_new_section_hook             elf32_arm_new_section_hook
+#define bfd_elf32_bfd_is_target_special_symbol elf32_arm_is_target_special_symbol
 
 #define elf_backend_get_symbol_type             elf32_arm_get_symbol_type
 #define elf_backend_gc_mark_hook                elf32_arm_gc_mark_hook
This page took 0.026552 seconds and 4 git commands to generate.