Skip to content

Commit

Permalink
[COFF] Add support for IMAGE_REL_ARM_SECREL
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mstorsjo committed Sep 27, 2016
1 parent 81eb5f6 commit 63762b5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lld/COFF/Chunks.cpp
Expand Up @@ -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");
}
Expand Down
6 changes: 5 additions & 1 deletion lld/test/COFF/reloc-arm.test
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 63762b5

Please sign in to comment.