[flang-commits] [clang] [flang] [llvm] [flang][AIX] Diagnose unsupported OBJECT_MODE setting and -maix32 option (PR #209919)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Fri Jul 17 22:05:08 PDT 2026


================
@@ -728,9 +744,19 @@ static llvm::Triple computeTargetTriple(const Driver &D, StringRef TargetTriple,
         Target.setEnvironment(llvm::Triple::GNUX32);
     } else if (A->getOption().matches(options::OPT_m32) ||
                A->getOption().matches(options::OPT_maix32)) {
-      if (D.IsFlangMode() && !Target.isOSAIX()) {
-        D.Diag(diag::err_drv_unsupported_opt_for_target)
-            << A->getAsString(Args) << Target.str();
+      if (D.IsFlangMode()) {
+        // Flang does not support 32-bit compilation.
+        // On an AIX host, -m32/-maix32 is always an error.
+        // On a non-AIX host, it is an error only when targeting AIX.
+        llvm::Triple HostTriple(D.getTargetTriple());
+        if (HostTriple.isOSAIX() || Target.isOSAIX()) {
+          D.Diag(diag::err_drv_compile_mode_unsupported);
+        } else {
+          AT = Target.get32BitArchVariant().getArch();
+          if (AT == llvm::Triple::ppcle)
+            D.Diag(diag::err_drv_unsupported_opt_for_target)
+                << A->getAsString(Args) << Target.str();
+        }
----------------
kkwli wrote:

Yes. The logic is here is a little bit confusing. What I want to achieve is that if target AIX, issue `err_drv_compile_mode_unsupported_aix` else `drv_unsupported_opt_for_target`. I simplify the logic now.

https://github.com/llvm/llvm-project/pull/209919


More information about the flang-commits mailing list