diff options
Diffstat (limited to 'tools/llvm-lto2/llvm-lto2.cpp')
-rw-r--r-- | tools/llvm-lto2/llvm-lto2.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/llvm-lto2/llvm-lto2.cpp b/tools/llvm-lto2/llvm-lto2.cpp index 0bd9289dc938..5e3b3dcb6c31 100644 --- a/tools/llvm-lto2/llvm-lto2.cpp +++ b/tools/llvm-lto2/llvm-lto2.cpp @@ -291,6 +291,14 @@ static int run(int argc, char **argv) { std::vector<SymbolResolution> Res; for (const InputFile::Symbol &Sym : Input->symbols()) { auto I = CommandLineResolutions.find({F, Sym.getName()}); + // If it isn't found, look for "$", which would have been added + // (followed by a hash) when the symbol was promoted during module + // splitting if it was defined in one part and used in the other. + // Try looking up the symbol name before the "$". + if (I == CommandLineResolutions.end()) { + auto SplitName = Sym.getName().rsplit("$"); + I = CommandLineResolutions.find({F, SplitName.first}); + } if (I == CommandLineResolutions.end()) { llvm::errs() << argv[0] << ": missing symbol resolution for " << F << ',' << Sym.getName() << '\n'; @@ -325,9 +333,9 @@ static int run(int argc, char **argv) { std::string Path = OutputFilename + "." + utostr(Task); std::error_code EC; - auto S = llvm::make_unique<raw_fd_ostream>(Path, EC, sys::fs::F_None); + auto S = std::make_unique<raw_fd_ostream>(Path, EC, sys::fs::OF_None); check(EC, Path); - return llvm::make_unique<lto::NativeObjectStream>(std::move(S)); + return std::make_unique<lto::NativeObjectStream>(std::move(S)); }; auto AddBuffer = [&](size_t Task, std::unique_ptr<MemoryBuffer> MB) { |