diff options
| author | Martin Storsjo <martin@martin.st> | 2017-07-25 06:10:44 +0000 |
|---|---|---|
| committer | Martin Storsjo <martin@martin.st> | 2017-07-25 06:10:44 +0000 |
| commit | 405b5bcc3649b627763cd5c0752d0a36740cf272 (patch) | |
| tree | b5cccb564b16b1ee8e5d09408cca14cb7751b72c /lld/COFF/DLL.cpp | |
| parent | 25712667cb70d87a5d40b2cefce76fc54ae52dbf (diff) | |
| download | bcm5719-llvm-405b5bcc3649b627763cd5c0752d0a36740cf272.tar.gz bcm5719-llvm-405b5bcc3649b627763cd5c0752d0a36740cf272.zip | |
[COFF] Correctly set the thumb bit in DLL export addresses
The same adjustment is already done for the entry point in
Writer.cpp and for relocations that point to executable code
in Chunks.cpp.
Differential Revision: https://reviews.llvm.org/D35767
llvm-svn: 308953
Diffstat (limited to 'lld/COFF/DLL.cpp')
| -rw-r--r-- | lld/COFF/DLL.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp index 1fdb40a913c..55fd2b50d06 100644 --- a/lld/COFF/DLL.cpp +++ b/lld/COFF/DLL.cpp @@ -319,12 +319,16 @@ public: size_t getSize() const override { return Size * 4; } void writeTo(uint8_t *Buf) const override { + uint32_t Bit = 0; + // Pointer to thumb code must have the LSB set, so adjust it. + if (Config->Machine == ARMNT) + Bit = 1; for (Export &E : Config->Exports) { uint8_t *P = Buf + OutputSectionOff + E.Ordinal * 4; if (E.ForwardChunk) { - write32le(P, E.ForwardChunk->getRVA()); + write32le(P, E.ForwardChunk->getRVA() | Bit); } else { - write32le(P, cast<Defined>(E.Sym)->getRVA()); + write32le(P, cast<Defined>(E.Sym)->getRVA() | Bit); } } } |

