[llvm] r333677 - IRGen: Write .dwo files when -split-dwarf-file is used together with -fthinlto-index.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Thu May 31 11:25:59 PDT 2018
Author: pcc
Date: Thu May 31 11:25:59 2018
New Revision: 333677
URL: http://llvm.org/viewvc/llvm-project?rev=333677&view=rev
Log:
IRGen: Write .dwo files when -split-dwarf-file is used together with -fthinlto-index.
Differential Revision: https://reviews.llvm.org/D47597
Modified:
llvm/trunk/include/llvm/LTO/Config.h
llvm/trunk/lib/LTO/LTOBackend.cpp
Modified: llvm/trunk/include/llvm/LTO/Config.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/Config.h?rev=333677&r1=333676&r2=333677&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/Config.h (original)
+++ llvm/trunk/include/llvm/LTO/Config.h Thu May 31 11:25:59 2018
@@ -76,6 +76,11 @@ struct Config {
/// The directory to store .dwo files.
std::string DwoDir;
+ /// The path to write a .dwo file to. This should generally only be used when
+ /// running an individual backend directly via thinBackend(), as otherwise
+ /// all .dwo files will be written to the same path.
+ std::string DwoPath;
+
/// Optimization remarks file path.
std::string RemarksFilename = "";
Modified: llvm/trunk/lib/LTO/LTOBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOBackend.cpp?rev=333677&r1=333676&r2=333677&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOBackend.cpp (original)
+++ llvm/trunk/lib/LTO/LTOBackend.cpp Thu May 31 11:25:59 2018
@@ -291,14 +291,19 @@ void codegen(Config &Conf, TargetMachine
return;
std::unique_ptr<ToolOutputFile> DwoOut;
+ SmallString<1024> DwoFile(Conf.DwoPath);
if (!Conf.DwoDir.empty()) {
std::error_code EC;
if (auto EC = llvm::sys::fs::create_directories(Conf.DwoDir))
report_fatal_error("Failed to create directory " + Conf.DwoDir + ": " +
EC.message());
- SmallString<1024> DwoFile(Conf.DwoDir);
+ DwoFile = Conf.DwoDir;
sys::path::append(DwoFile, std::to_string(Task) + ".dwo");
+ }
+
+ if (!DwoFile.empty()) {
+ std::error_code EC;
TM->Options.MCOptions.SplitDwarfFile = DwoFile.str().str();
DwoOut = llvm::make_unique<ToolOutputFile>(DwoFile, EC, sys::fs::F_None);
if (EC)
More information about the llvm-commits
mailing list