[clang] [clang][AArch64] multilib: fix deduction of "-march=" option (PR #81474)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 12 05:02:04 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-driver
Author: Dominik Wójt (domin144)
<details>
<summary>Changes</summary>
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".
---
Full diff: https://github.com/llvm/llvm-project/pull/81474.diff
1 Files Affected:
- (modified) clang/lib/Driver/ToolChain.cpp (+5-1)
``````````diff
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, "+"));
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/81474
More information about the cfe-commits
mailing list