[lld] r232474 - [ARM] Read initial addend for REL32 and PREL31 relocs

Denis Protivensky dprotivensky at accesssoftek.com
Tue Mar 17 06:51:32 PDT 2015


Author: denis-protivensky
Date: Tue Mar 17 08:51:32 2015
New Revision: 232474

URL: http://llvm.org/viewvc/llvm-project?rev=232474&view=rev
Log:
[ARM] Read initial addend for REL32 and PREL31 relocs

Modified:
    lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp
    lld/trunk/test/elf/ARM/rel-arm-prel31.test
    lld/trunk/test/elf/ARM/rel-rel32.test

Modified: lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp?rev=232474&r1=232473&r2=232474&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp Tue Mar 17 08:51:32 2015
@@ -81,7 +81,10 @@ static Reference::Addend readAddend(cons
                                     Reference::KindValue kindValue) {
   switch (kindValue) {
   case R_ARM_ABS32:
+  case R_ARM_REL32:
     return (int32_t)read32le(location);
+  case R_ARM_PREL31:
+    return (int32_t)(read32le(location) & 0x7FFFFFFF);
   case R_ARM_THM_CALL:
   case R_ARM_THM_JUMP24:
     return readAddend_THM_CALL(location);

Modified: lld/trunk/test/elf/ARM/rel-arm-prel31.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ARM/rel-arm-prel31.test?rev=232474&r1=232473&r2=232474&view=diff
==============================================================================
--- lld/trunk/test/elf/ARM/rel-arm-prel31.test (original)
+++ lld/trunk/test/elf/ARM/rel-arm-prel31.test Tue Mar 17 08:51:32 2015
@@ -5,10 +5,9 @@
 # RUN: llvm-objdump -s -t %t | FileCheck %s
 
 # CHECK: Contents of section .ARM.extab:
-# CHECK:  4000a4 b1ffff7f
+# CHECK: 4000a4 b1fffe7f
 # CHECK: SYMBOL TABLE:
-# CHECK: 00000000         *UND*	00000000
-# CHECK: 00400054 g     F .text	00000050 __gxx_personality_v0
+# CHECK: 00400054 g     F .text	{{[0-9a-f]+}} __gxx_personality_v0
 
 ---
 FileHeader:
@@ -22,7 +21,7 @@ Sections:
     Type:            SHT_PROGBITS
     Flags:           [ SHF_ALLOC ]
     AddressAlign:    0x4
-    Content:         0000000084019701B0B0B008FFFF01080E2432003A040000
+    Content:         0000FF7F84019701B0B0B008FFFF01080E2432003A040000
   - Name:            .rel.ARM.extab
     Type:            SHT_REL
     Link:            .symtab

Modified: lld/trunk/test/elf/ARM/rel-rel32.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/ARM/rel-rel32.test?rev=232474&r1=232473&r2=232474&view=diff
==============================================================================
--- lld/trunk/test/elf/ARM/rel-rel32.test (original)
+++ lld/trunk/test/elf/ARM/rel-rel32.test Tue Mar 17 08:51:32 2015
@@ -5,10 +5,10 @@
 # RUN: llvm-objdump -s -t %t | FileCheck %s
 
 # CHECK: Contents of section .text:
-# CHECK-NEXT: 400074 80b400af 880f0000
+# CHECK-NEXT: 400074 {{[0-9a-f]+}} 880fff00
 # CHECK: SYMBOL TABLE:
-# CHECK: 00400074 g     F .text	00000004 main
-# CHECK: 00401000 g       .bss	00000004 _myref
+# CHECK: 00400074 g     F .text	{{[0-9a-f]+}} main
+# CHECK: 00401000 g       .bss	{{[0-9a-f]+}} _myref
 
 ---
 ---
@@ -23,7 +23,7 @@ Sections:
     Type:            SHT_PROGBITS
     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
     AddressAlign:    0x0000000000000004
-    Content:         80B400AF0000000000231846BD465DF8047B7047
+    Content:         80B400AF0000FF0000231846BD465DF8047B7047
   - Name:            .rel.text
     Type:            SHT_REL
     Link:            .symtab
@@ -42,48 +42,8 @@ Sections:
     Type:            SHT_NOBITS
     Flags:           [ SHF_WRITE, SHF_ALLOC ]
     AddressAlign:    0x0000000000000004
-    Content:         '00474343'
-  - Name:            .comment
-    Type:            SHT_PROGBITS
-    Flags:           [ SHF_MERGE, SHF_STRINGS ]
-    AddressAlign:    0x0000000000000001
-    Content:         004743433A202863726F7373746F6F6C2D4E47206C696E61726F2D312E31332E312D342E392D323031342E3039202D204C696E61726F2047434320342E392D323031342E30392920342E392E32203230313430393034202870726572656C656173652900
-  - Name:            .note.GNU-stack
-    Type:            SHT_PROGBITS
-    AddressAlign:    0x0000000000000001
     Content:         ''
-  - Name:            .ARM.attributes
-    Type:            SHT_ARM_ATTRIBUTES
-    AddressAlign:    0x0000000000000001
-    Content:         4134000000616561626900012A00000005372D4100060A0741080109020A041204140115011703180119011A021B031C011E062201
 Symbols:
-  Local:
-    - Name:            test.c
-      Type:            STT_FILE
-    - Name:            .text
-      Type:            STT_SECTION
-      Section:         .text
-    - Name:            .data
-      Type:            STT_SECTION
-      Section:         .data
-    - Name:            .bss
-      Type:            STT_SECTION
-      Section:         .bss
-    - Name:            '$d'
-      Section:         .text
-      Value:           0x0000000000000004
-    - Name:            '$t'
-      Section:         .text
-      Value:           0x0000000000000008
-    - Name:            .note.GNU-stack
-      Type:            STT_SECTION
-      Section:         .note.GNU-stack
-    - Name:            .comment
-      Type:            STT_SECTION
-      Section:         .comment
-    - Name:            .ARM.attributes
-      Type:            STT_SECTION
-      Section:         .ARM.attributes
   Global:
     - Name:            _myref
       Type:            STT_OBJECT





More information about the llvm-commits mailing list