[lld] r282531 - [COFF] Add support for IMAGE_REL_ARM_SECREL

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 12:27:17 PDT 2016


Author: mstorsjo
Date: Tue Sep 27 14:27:17 2016
New Revision: 282531

URL: http://llvm.org/viewvc/llvm-project?rev=282531&view=rev
Log:
[COFF] Add support for IMAGE_REL_ARM_SECREL

Handle this in the exact same way as IMAGE_REL_AMD64_SECREL
and IMAGE_REL_I386_SECREL.

Differential revision: https://reviews.llvm.org/D24608


Modified:
    lld/trunk/COFF/Chunks.cpp
    lld/trunk/test/COFF/reloc-arm.test

Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=282531&r1=282530&r2=282531&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Tue Sep 27 14:27:17 2016
@@ -134,6 +134,7 @@ void SectionChunk::applyRelARM(uint8_t *
   case IMAGE_REL_ARM_BRANCH20T: applyBranch20T(Off, S - P - 4); break;
   case IMAGE_REL_ARM_BRANCH24T: applyBranch24T(Off, S - P - 4); break;
   case IMAGE_REL_ARM_BLX23T:    applyBranch24T(Off, S - P - 4); break;
+  case IMAGE_REL_ARM_SECREL:    add32(Off, Sym->getSecrel()); break;
   default:
     fatal("unsupported relocation type");
   }

Modified: lld/trunk/test/COFF/reloc-arm.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/reloc-arm.test?rev=282531&r1=282530&r2=282531&view=diff
==============================================================================
--- lld/trunk/test/COFF/reloc-arm.test (original)
+++ lld/trunk/test/COFF/reloc-arm.test Tue Sep 27 14:27:17 2016
@@ -10,6 +10,7 @@
 # CHECK: 402040 3e04de2f 00000000 00000000 00000000
 # CHECK: 402050 fe07d62f 00000000 00000000 00000000
 # CHECK: 402060 fef0cef7 00000000 00000000 00000000
+# CHECK: 402070 00005000 00000000 00000000 00000000
 
 --- !COFF
 header:
@@ -23,7 +24,7 @@ sections:
   - Name:            .text
     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_PURGEABLE, IMAGE_SCN_MEM_16BIT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
     Alignment:       4096
-    SectionData:     00000000000000000000000000000000000000000000000000000000000000004ff6ff79cff6ff79000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000f8000000000000000000000000
+    SectionData:     00000000000000000000000000000000000000000000000000000000000000004ff6ff79cff6ff79000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000f800000000000000000000000000000000000000000000000000000000
     Relocations:
       - VirtualAddress:  0
         SymbolName:      foo
@@ -46,6 +47,9 @@ sections:
       - VirtualAddress:  96
         SymbolName:      bar
         Type:            20  # IMAGE_REL_ARM_BRANCH24T
+      - VirtualAddress:  112
+        SymbolName:      bar
+        Type:            15  # IMAGE_REL_ARM_SECREL
 symbols:
   - Name:            .aaa
     Value:           0




More information about the llvm-commits mailing list