Skip to content

[ClangLinkerWrapper] Fix intermediate file naming for multi-arch compilation #99325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
//
//===---------------------------------------------------------------------===//

#include "clang/Basic/TargetID.h"
#include "clang/Basic/Version.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/BinaryFormat/Magic.h"
Expand Down Expand Up @@ -668,7 +669,8 @@ std::unique_ptr<lto::LTO> createLTO(
ModuleHook Hook = [](size_t, const Module &) { return true; }) {
const llvm::Triple Triple(Args.getLastArgValue(OPT_triple_EQ));
// We need to remove AMD's target-id from the processor if present.
StringRef Arch = Args.getLastArgValue(OPT_arch_EQ).split(":").first;
StringRef TargetID = Args.getLastArgValue(OPT_arch_EQ);
StringRef Arch = clang::getProcessorFromTargetID(Triple, TargetID);
lto::Config Conf;
lto::ThinBackend Backend;
// TODO: Handle index-only thin-LTO
Expand Down Expand Up @@ -712,7 +714,7 @@ std::unique_ptr<lto::LTO> createLTO(

if (SaveTemps) {
std::string TempName = (sys::path::filename(ExecutableName) + "." +
Triple.getTriple() + "." + Arch)
Triple.getTriple() + "." + TargetID)
.str();
Conf.PostInternalizeModuleHook = [=](size_t Task, const Module &M) {
std::string File =
Expand Down
Loading