mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 01:07:04 +08:00
COFF: Fix import thunks and name mangling for x86.
With this patch, LLD is now able to correctly link a "hello world" program written in assembly for 32-bit x86. llvm-svn: 241771
This commit is contained in:
@@ -245,7 +245,9 @@ ImportThunkChunk::ImportThunkChunk(Defined *S) : ImpSymbol(S) {
|
||||
void ImportThunkChunk::writeTo(uint8_t *Buf) {
|
||||
memcpy(Buf + FileOff, ImportThunkData, sizeof(ImportThunkData));
|
||||
// The first two bytes is a JMP instruction. Fill its operand.
|
||||
uint32_t Operand = ImpSymbol->getRVA() - RVA - getSize();
|
||||
uint32_t Operand = Config->is64()
|
||||
? ImpSymbol->getRVA() - RVA - getSize()
|
||||
: ImpSymbol->getRVA() + Config->ImageBase;
|
||||
write32le(Buf + FileOff + 2, Operand);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user