[clang] [clang][AArch64] multilib: fix deduction of "-march=" option (PR #81474)
Dominik Wójt via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 12 05:01:34 PST 2024
https://github.com/domin144 created https://github.com/llvm/llvm-project/pull/81474
The deduced "-march=" option always started with aarch64, which is not a valid value. There was also no way to distinguish between armv8-r and armv8-a. After this commit, the deduced "-march=" option will start with greatest available "armv*-a" value or "armv8-r".
>From 8f8d2b304aa90c0aea00d67e86d285ecd870e443 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20W=C3=B3jt?= <dominik.wojt at arm.com>
Date: Mon, 12 Feb 2024 13:38:14 +0100
Subject: [PATCH] [clang][AArch64] multilib: fix deduction of "-march=" option
The deduced "-march=" option always started with aarch64, which is not a
valid value. There was also no way to distinguish between armv8-r and
armv8-a. After this commit, the deduced "-march=" option will start with
greatest available "armv*-a" value or "armv8-r".
---
clang/lib/Driver/ToolChain.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 388030592b4836..bfc80ac79df1e3 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -191,7 +191,11 @@ static void getAArch64MultilibFlags(const Driver &D,
for (const auto &Ext : AArch64::Extensions)
if (FeatureSet.contains(Ext.NegFeature))
MArch.push_back(("no" + Ext.Name).str());
- MArch.insert(MArch.begin(), ("-march=" + Triple.getArchName()).str());
+ StringRef ArchName;
+ for (const auto &ArchInfo : AArch64::ArchInfos)
+ if (FeatureSet.contains(ArchInfo->ArchFeature))
+ ArchName = ArchInfo->Name;
+ MArch.insert(MArch.begin(), ("-march=" + ArchName).str());
Result.push_back(llvm::join(MArch, "+"));
}
More information about the cfe-commits
mailing list