[PATCH] D46608: Add support for ThinLTO plugin option thinlto-object-suffix-replace
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 10 16:00:20 PDT 2018
ruiu added a comment.
I tried a few different ideas but I couldn't come up with a better idea than this patch, so this seems like a best way of doing this so far. Could you please update the patch with my comments?
================
Comment at: lld/ELF/InputFiles.cpp:1028
// symbols later in the link stage).
+ StringRef Path = MB.getBufferIdentifier();
+ std::string UpdatedPath = Path.str();
----------------
ruiu wrote:
> I don't think we should add new tricky code to this common place. Instead, we should modify LTO.cpp or somewhere else. Let me try to do that locally.
StringRef -> std::string and then remove UpdatedPath. You can mutate Path if you change its type to std::string.
================
Comment at: lld/ELF/InputFiles.cpp:1031-1032
+ if (Config->ThinLTOIndexOnly) {
+ Path.consume_back(Config->ThinLTOObjectSuffixReplace.first.str());
+ UpdatedPath = Path.str() + Config->ThinLTOObjectSuffixReplace.second.str();
+ }
----------------
If Path doesn't end with `first`, then it doesn't remove anything from its end, and then `second` is added to Path. I doubt it is a correct behavior.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D46608
More information about the llvm-commits
mailing list