Skip to content

Commit badaaa9

Browse files
committed
[Clang][Driver] Valid -march value is not mandatory in AArch64 multilib
If a user passed an invalid value to `-march`, an assertion failure happened in the AArch64 multilib logic. But an invalid `-march` value is an expected case that should be handled via error messages. This patch removes the requirement that the `-march` value must be valid.
1 parent 904de95 commit badaaa9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/Driver/ToolChain.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ static void getAArch64MultilibFlags(const Driver &D,
191191
for (const auto &ArchInfo : AArch64::ArchInfos)
192192
if (FeatureSet.contains(ArchInfo->ArchFeature))
193193
ArchName = ArchInfo->Name;
194-
assert(!ArchName.empty() && "at least one architecture should be found");
195-
MArch.insert(MArch.begin(), ("-march=" + ArchName).str());
196-
Result.push_back(llvm::join(MArch, "+"));
194+
if (!ArchName.empty()) {
195+
MArch.insert(MArch.begin(), ("-march=" + ArchName).str());
196+
Result.push_back(llvm::join(MArch, "+"));
197+
}
197198

198199
const Arg *BranchProtectionArg =
199200
Args.getLastArgNoClaim(options::OPT_mbranch_protection_EQ);

0 commit comments

Comments
 (0)