* elflink.c (_bfd_elf_link_create_dynamic_sections): Move from
[deliverable/binutils-gdb.git] / bfd / elf32-arm.h
index effe7e6af05172c47657f6d842cae90b6ce65deb..ba286b1237dee4a1dcbaf563a76d725d0cc58698 100644 (file)
@@ -679,8 +679,8 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, no_pipeline_knowledge)
 
       /* Load the relocs.  */
       internal_relocs
-       = _bfd_elf32_link_read_relocs (abfd, sec, (PTR) NULL,
-                                      (Elf_Internal_Rela *) NULL, FALSE);
+       = _bfd_elf_link_read_relocs (abfd, sec, (PTR) NULL,
+                                    (Elf_Internal_Rela *) NULL, FALSE);
 
       if (internal_relocs == NULL)
        goto error_return;
@@ -929,13 +929,16 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section,
 
   BFD_ASSERT (my_offset <= globals->thumb_glue_size);
 
-  /* Now go back and fix up the original BL insn to point
-     to here.  */
-  ret_offset = (s->output_offset
-               + my_offset
-               - (input_section->output_offset
-                  + offset + addend)
-               - 8);
+  /* Now go back and fix up the original BL insn to point to here.  */
+  ret_offset =
+    /* Address of where the stub is located.  */
+    (s->output_section->vma + s->output_offset + my_offset)
+     /* Address of where the BL is located.  */
+    - (input_section->output_section->vma + input_section->output_offset + offset)
+    /* Addend in the relocation.  */
+    - addend
+    /* Biassing for PC-relative addressing.  */
+    - 8;
 
   tmp = bfd_get_32 (input_bfd, hit_data
                    - input_section->vma);
@@ -2116,11 +2119,19 @@ static bfd_boolean
 elf32_arm_object_p (abfd)
      bfd *abfd;
 {
-  /* XXX - we ought to examine a .note section here.  */
+  unsigned int mach;
+  
+  mach = bfd_arm_get_mach_from_notes (abfd, ARM_NOTE_SECTION);
+
+  if (mach != bfd_mach_arm_unknown)
+    bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
 
-  if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
+  else if (elf_elfheader (abfd)->e_flags & EF_ARM_MAVERICK_FLOAT)
     bfd_default_set_arch_mach (abfd, bfd_arch_arm, bfd_mach_arm_ep9312);
 
+  else
+    bfd_default_set_arch_mach (abfd, bfd_arch_arm, mach);
+
   return TRUE;
 }
 
@@ -2260,6 +2271,11 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd)
       return TRUE;
     }
 
+  /* Determine what should happen if the input ARM architecture
+     does not match the output ARM architecture.  */
+  if (! bfd_arm_merge_machines (ibfd, obfd))
+    return FALSE;
+
   /* Identical flags must be compatible.  */
   if (in_flags == out_flags)
     return TRUE;
@@ -3657,6 +3673,30 @@ elf32_arm_reloc_type_class (rela)
     }
 }
 
+static bfd_boolean elf32_arm_section_flags           PARAMS ((flagword *, Elf_Internal_Shdr *));
+static void        elf32_arm_final_write_processing  PARAMS ((bfd *, bfd_boolean));
+
+/* Set the right machine number for an Arm ELF file.  */
+
+static bfd_boolean
+elf32_arm_section_flags (flags, hdr)
+     flagword *flags;
+     Elf_Internal_Shdr *hdr;
+{
+  if (hdr->sh_type == SHT_NOTE)
+    *flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_CONTENTS;
+
+  return TRUE;
+}
+
+void
+elf32_arm_final_write_processing (abfd, linker)
+     bfd *abfd;
+     bfd_boolean linker ATTRIBUTE_UNUSED;
+{
+  bfd_arm_update_notes (abfd, ARM_NOTE_SECTION);
+}
+
 #define ELF_ARCH                       bfd_arch_arm
 #define ELF_MACHINE_CODE               EM_ARM
 #define ELF_MAXPAGESIZE                        0x8000
@@ -3682,6 +3722,8 @@ elf32_arm_reloc_type_class (rela)
 #define elf_backend_post_process_headers       elf32_arm_post_process_headers
 #define elf_backend_reloc_type_class           elf32_arm_reloc_type_class
 #define elf_backend_object_p                   elf32_arm_object_p
+#define elf_backend_section_flags              elf32_arm_section_flags
+#define elf_backend_final_write_processing      elf32_arm_final_write_processing
 
 #define elf_backend_can_gc_sections 1
 #define elf_backend_plt_readonly    1
This page took 0.025216 seconds and 4 git commands to generate.