aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFImportFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/COFFImportFile.cpp')
-rw-r--r--llvm/lib/Object/COFFImportFile.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Object/COFFImportFile.cpp b/llvm/lib/Object/COFFImportFile.cpp
index 77cb625..670c4bb 100644
--- a/llvm/lib/Object/COFFImportFile.cpp
+++ b/llvm/lib/Object/COFFImportFile.cpp
@@ -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());