Make x86-lynx GDBserver pass XML register map to GDB.
[deliverable/binutils-gdb.git] / bfd / elf32-arm.c
index 081265c5298630d97fe3a129c3b7b83d1662772f..e2f8a9607ae65420f56c943a91b99977b18544f0 100644 (file)
@@ -63,6 +63,9 @@
 #define ARM_ELF_ABI_VERSION            0
 #define ARM_ELF_OS_ABI_VERSION         ELFOSABI_ARM
 
+/* The Adjusted Place, as defined by AAELF.  */
+#define Pa(X) ((X) & 0xfffffffc)
+
 static bfd_boolean elf32_arm_write_section (bfd *output_bfd,
                                            struct bfd_link_info *link_info,
                                            asection *sec,
@@ -4984,6 +4987,9 @@ elf32_arm_size_stubs (bfd *output_bfd,
          asection *section;
          Elf_Internal_Sym *local_syms = NULL;
 
+          if (!is_arm_elf (input_bfd))
+            continue;
+
          num_a8_relocs = 0;
 
          /* We'll need the symbol table in a second.  */
@@ -8619,9 +8625,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
           }
 
        relocation = value + signed_addend;
-       relocation -= (input_section->output_section->vma
-                      + input_section->output_offset
-                      + rel->r_offset);
+       relocation -= Pa (input_section->output_section->vma
+                         + input_section->output_offset
+                         + rel->r_offset);
 
         value = abs (relocation);
 
@@ -8651,12 +8657,12 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
        insn = bfd_get_16 (input_bfd, hit_data);
 
         if (globals->use_rel)
-         addend = (insn & 0x00ff) << 2;
+         addend = ((((insn & 0x00ff) << 2) + 4) & 0x3ff) -4;
 
        relocation = value + addend;
-       relocation -= (input_section->output_section->vma
-                      + input_section->output_offset
-                      + rel->r_offset);
+       relocation -= Pa (input_section->output_section->vma
+                         + input_section->output_offset
+                         + rel->r_offset);
 
         value = abs (relocation);
 
@@ -8691,9 +8697,9 @@ elf32_arm_final_link_relocate (reloc_howto_type *           howto,
           }
 
        relocation = value + signed_addend;
-       relocation -= (input_section->output_section->vma
-                      + input_section->output_offset
-                      + rel->r_offset);
+       relocation -= Pa (input_section->output_section->vma
+                         + input_section->output_offset
+                         + rel->r_offset);
 
         value = abs (relocation);
 
This page took 0.043898 seconds and 4 git commands to generate.