daily update
[deliverable/binutils-gdb.git] / bfd / elf32-arm.c
index fefc7db0c1e7e6c90c3788a9550df4e9b2e33c74..fd7d26a71ba514dff743b6c90d8053f488fbfea9 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,
@@ -2209,21 +2212,21 @@ static const bfd_vma elf32_arm_nacl_plt0_entry [] =
   0xe08cc00f,          /* add  ip, ip, pc                      */
   0xe52dc008,          /* str  ip, [sp, #-8]!                  */
   /* Second bundle: */
-  0xe7dfcf1f,  /* bfc  ip, #30, #2                     */
-  0xe59cc000,  /* ldr  ip, [ip]                        */
+  0xe3ccc103,          /* bic  ip, ip, #0xc0000000             */
+  0xe59cc000,          /* ldr  ip, [ip]                        */
   0xe3ccc13f,          /* bic  ip, ip, #0xc000000f             */
-  0xe12fff1c,  /* bx   ip                              */
+  0xe12fff1c,          /* bx   ip                              */
   /* Third bundle: */
-  0xe320f000,  /* nop                                  */
-  0xe320f000,  /* nop                                  */
-  0xe320f000,  /* nop                                  */
+  0xe320f000,          /* nop                                  */
+  0xe320f000,          /* nop                                  */
+  0xe320f000,          /* nop                                  */
   /* .Lplt_tail: */
   0xe50dc004,          /* str  ip, [sp, #-4]                   */
   /* Fourth bundle: */
-  0xe7dfcf1f,          /* bfc  ip, #30, #2                     */
-  0xe59cc000,  /* ldr  ip, [ip]                        */
+  0xe3ccc103,          /* bic  ip, ip, #0xc0000000             */
+  0xe59cc000,          /* ldr  ip, [ip]                        */
   0xe3ccc13f,          /* bic  ip, ip, #0xc000000f             */
-  0xe12fff1c,  /* bx   ip                              */
+  0xe12fff1c,          /* bx   ip                              */
 };
 #define ARM_NACL_PLT_TAIL_OFFSET       (11 * 4)
 
@@ -8619,9 +8622,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 +8654,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 +8694,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.029071 seconds and 4 git commands to generate.