mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-23 14:03:14 +00:00
[llvm-dlltool] Write correct weak externals
Previously, the created object files for the import library were broken. Write the symbol table before the string table. Simplify the code by using a separate variable Prefix instead of duplicating a few lines. Also update the coff-weak-exports to actually check that the generated weak symbols can be found as intended. Differential Revision: https://reviews.llvm.org/D36065 llvm-svn: 309555
This commit is contained in:
parent
3d431b22ac
commit
e64ad679ac
@ -545,15 +545,12 @@ NewArchiveMember ObjectFactory::createWeakExternal(StringRef Sym,
|
||||
SymbolTable[2].Name.Offset.Offset = sizeof(uint32_t);
|
||||
|
||||
//__imp_ String Table
|
||||
if (Imp) {
|
||||
SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 7;
|
||||
writeStringTable(Buffer, {std::string("__imp_").append(Sym),
|
||||
std::string("__imp_").append(Weak)});
|
||||
} else {
|
||||
SymbolTable[3].Name.Offset.Offset = sizeof(uint32_t) + Sym.size() + 1;
|
||||
writeStringTable(Buffer, {Sym, Weak});
|
||||
}
|
||||
StringRef Prefix = Imp ? "__imp_" : "";
|
||||
SymbolTable[3].Name.Offset.Offset =
|
||||
sizeof(uint32_t) + Sym.size() + Prefix.size() + 1;
|
||||
append(Buffer, SymbolTable);
|
||||
writeStringTable(Buffer, {(Prefix + Sym).str(),
|
||||
(Prefix + Weak).str()});
|
||||
|
||||
// Copied here so we can still use writeStringTable
|
||||
char *Buf = Alloc.Allocate<char>(Buffer.size());
|
||||
|
@ -1,19 +1,11 @@
|
||||
; RUN: llvm-dlltool -m i386:x86-64 --input-def %s --output-lib %t.a
|
||||
; RUN: llvm-readobj -coff-exports %t.a | FileCheck %s
|
||||
; RUN: llvm-nm %t.a | FileCheck %s
|
||||
|
||||
LIBRARY test.dll
|
||||
EXPORTS
|
||||
TestFunction==AltTestFunction
|
||||
|
||||
; CHECK: File: test.dll
|
||||
; CHECK: Format: COFF-x86-64
|
||||
; CHECK: Arch: x86_64
|
||||
; CHECK: AddressSize: 64bit
|
||||
; CHECK: File: test.dll
|
||||
; CHECK: Format: COFF-x86-64
|
||||
; CHECK: Arch: x86_64
|
||||
; CHECK: AddressSize: 64bit
|
||||
; CHECK: File: test.dll
|
||||
; CHECK: Format: COFF-x86-64
|
||||
; CHECK: Arch: x86_64
|
||||
; CHECK: AddressSize: 64bit
|
||||
; CHECK: U AltTestFunction
|
||||
; CHECK-NEXT: w TestFunction
|
||||
; CHECK: U __imp_AltTestFunction
|
||||
; CHECK-NEXT: w __imp_TestFunction
|
||||
|
Loading…
x
Reference in New Issue
Block a user