https://github.com/vhscampos created 
https://github.com/llvm/llvm-project/pull/151103

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.

>From badaaa958a664ee01eeead1b9dc1e6d6c99d7c82 Mon Sep 17 00:00:00 2001
From: Victor Campos <victor.cam...@arm.com>
Date: Tue, 29 Jul 2025 09:15:06 +0100
Subject: [PATCH] [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.
---
 clang/lib/Driver/ToolChain.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 1d7dad0d7d12b..496c0dc1780e4 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -191,9 +191,10 @@ static void getAArch64MultilibFlags(const Driver &D,
   for (const auto &ArchInfo : AArch64::ArchInfos)
     if (FeatureSet.contains(ArchInfo->ArchFeature))
       ArchName = ArchInfo->Name;
-  assert(!ArchName.empty() && "at least one architecture should be found");
-  MArch.insert(MArch.begin(), ("-march=" + ArchName).str());
-  Result.push_back(llvm::join(MArch, "+"));
+  if (!ArchName.empty()) {
+    MArch.insert(MArch.begin(), ("-march=" + ArchName).str());
+    Result.push_back(llvm::join(MArch, "+"));
+  }
 
   const Arg *BranchProtectionArg =
       Args.getLastArgNoClaim(options::OPT_mbranch_protection_EQ);

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to