aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/gold
diff options
context:
space:
mode:
authorIvan Tadeu Ferreira Antunes Filho <antunesi@google.com>2023-04-04 09:57:53 -0700
committerTeresa Johnson <tejohnson@google.com>2023-04-04 11:24:51 -0700
commit73fd9d310fff4d7d2b95e0509aafdf28bd3c713c (patch)
tree4e2ca6a50f12c40734fbaeb033514d4c2f2bd664 /llvm/tools/gold
parenta401e10f12ba555eefc3da607fa5168603caa9c6 (diff)
downloadllvm-73fd9d310fff4d7d2b95e0509aafdf28bd3c713c.zip
llvm-73fd9d310fff4d7d2b95e0509aafdf28bd3c713c.tar.gz
llvm-73fd9d310fff4d7d2b95e0509aafdf28bd3c713c.tar.bz2
[lld] Support separate native object file path in --thinlto-prefix-replace
Currently, the --thinlto-prefix-replace="oldpath;newpath" option is used during distributed ThinLTO thin links to specify the mapping of the input bitcode object files' directory tree (oldpath) to the directory tree (newpath) used for both: 1) the output files of the thin link itself (the .thinlto.bc index files and the optional .imports files) 2) the specified object file paths written to the response file given in the --thinlto-index-only=${response} option, which is used by the final native link and must match the paths of the native object files that will be produced by ThinLTO backend compiles. This patch expands the --thinlto-prefix-replace option to allow a separate directory tree mapping to be specified for the object file paths written to the response file (number 2 above). This is important to support builds and build systems where the same output directory may not be written by multiple build actions (e.g. the thin link and the ThinLTO backend compiles). The new format is: --thinlto-prefix-replace="origpath;outpath[;objpath]" This replaces the origpath directory tree of the thin link input files with outpath when writing the thin link index and imports outputs (number 1 above). If objpath is specified it replaces origpath of the input files with objpath when writing the response file (number 2 above), otherwise it falls back to the old behavior of using outpath for this as well. Reviewed By: tejohnson, MaskRay Differential Revision: https://reviews.llvm.org/D144596
Diffstat (limited to 'llvm/tools/gold')
-rw-r--r--llvm/tools/gold/gold-plugin.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 1d697df..a47dba3 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -891,9 +891,12 @@ static std::unique_ptr<LTO> createLTO(IndexWriteCallback OnIndexWrite,
if (options::thinlto_index_only) {
std::string OldPrefix, NewPrefix;
getThinLTOOldAndNewPrefix(OldPrefix, NewPrefix);
- Backend = createWriteIndexesThinBackend(OldPrefix, NewPrefix,
- options::thinlto_emit_imports_files,
- LinkedObjectsFile, OnIndexWrite);
+ Backend = createWriteIndexesThinBackend(
+ OldPrefix, NewPrefix,
+ // TODO: Add support for optional native object path in
+ // thinlto_prefix_replace option to match lld.
+ /*NativeObjectPrefix=*/"", options::thinlto_emit_imports_files,
+ LinkedObjectsFile, OnIndexWrite);
} else {
Backend = createInProcessThinBackend(
llvm::heavyweight_hardware_concurrency(options::Parallelism));