================
@@ -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;
----------------
domin144 wrote:

There should be at least one arch feature in the list: there is an if-else 
chain with every branch setting one in getAArch64TargetFeatures. I agree it's 
better to add an assert just in case something changed.

For the case of multiple arch features: I think getAArch64TargetFeatures does 
not do that, but if it did, it should still be ok. "armv*-a" are ordered in 
AArch64::ArchInfos in a way that every arch feature represents a superset of 
previous one. This loop will select the greatest one, which is nice. I think it 
would be an error to have both "-a" and "-r" features, but checking this would 
need more code and I think this is not the right place for such check.

https://github.com/llvm/llvm-project/pull/81474
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to