[COFF] Add support for IMAGE_REL_ARM_SECREL
authorMartin Storsjo <martin@martin.st>
Tue, 27 Sep 2016 19:27:17 +0000 (19:27 +0000)
committerMartin Storsjo <martin@martin.st>
Tue, 27 Sep 2016 19:27:17 +0000 (19:27 +0000)
Handle this in the exact same way as IMAGE_REL_AMD64_SECREL
and IMAGE_REL_I386_SECREL.

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

llvm-svn: 282531

lld/COFF/Chunks.cpp
lld/test/COFF/reloc-arm.test

index b8d706e14456b30f986a34d61e16cdae77843c63..90f1485c2d637d2852e71c5333ec6e32b5d390cf 100644 (file)
@@ -134,6 +134,7 @@ void SectionChunk::applyRelARM(uint8_t *Off, uint16_t Type, Defined *Sym,
   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");
   }
index 7ac453496884f21f0b01b6faad31d685074de122..1f3de619c44b124691d5a2cc977fc01927c16a18 100644 (file)
@@ -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