Skip to content

Commit 4eda125

Browse files
committed
[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".
1 parent 8d8bb35 commit 4eda125

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ static void getAArch64MultilibFlags(const Driver &D,
191191
for (const auto &Ext : AArch64::Extensions)
192192
if (FeatureSet.contains(Ext.NegFeature))
193193
MArch.push_back(("no" + Ext.Name).str());
194-
MArch.insert(MArch.begin(), ("-march=" + Triple.getArchName()).str());
194+
StringRef ArchName;
195+
for (const auto &ArchInfo : AArch64::ArchInfos)
196+
if (FeatureSet.contains(ArchInfo->ArchFeature))
197+
ArchName = ArchInfo->Name;
198+
MArch.insert(MArch.begin(), ("-march=" + ArchName).str());
195199
Result.push_back(llvm::join(MArch, "+"));
196200
}
197201

0 commit comments

Comments
 (0)