[PATCH] D36065: [llvm-dlltool] Write correct weak externals
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 01:37:14 PDT 2017
mstorsjo added inline comments.
================
Comment at: lib/Object/COFFImportFile.cpp:548
//__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;
----------------
ruiu wrote:
> Use std::string instead of StringRef to avoid use of `str()`.
I thought about that, but then the `append()` below would mutably alter it - `str()` intentionally gives a new mutable temporary for each of the `append()`s here.
https://reviews.llvm.org/D36065
More information about the llvm-commits
mailing list