Author: WhatAmISupposedToPutHere
Date: 2025-07-15T12:01:36+03:00
New Revision: 8aeab8faeebfa737a388041e5b37717ab15d387e

URL: 
https://github.com/llvm/llvm-project/commit/8aeab8faeebfa737a388041e5b37717ab15d387e
DIFF: 
https://github.com/llvm/llvm-project/commit/8aeab8faeebfa737a388041e5b37717ab15d387e.diff

LOG: [Driver][MinGW] Allow using clang driver to link ARM64X PEs. (#148064)

Similar to how clang-cl driver does it, make it possible to build arm64x
binaries with a mingw-style invocation.

Signed-off-by: Sasha Finkelstein <fnkl.ker...@gmail.com>

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/MinGW.cpp
    clang/test/Driver/mingw.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 7d093d20b3dd9..b2e36ae6f97c3 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -132,7 +132,9 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
     CmdArgs.push_back("thumb2pe");
     break;
   case llvm::Triple::aarch64:
-    if (TC.getEffectiveTriple().isWindowsArm64EC())
+    if (Args.hasArg(options::OPT_marm64x))
+      CmdArgs.push_back("arm64xpe");
+    else if (TC.getEffectiveTriple().isWindowsArm64EC())
       CmdArgs.push_back("arm64ecpe");
     else
       CmdArgs.push_back("arm64pe");

diff  --git a/clang/test/Driver/mingw.cpp b/clang/test/Driver/mingw.cpp
index 66da0c97f4166..f43fa177e2905 100644
--- a/clang/test/Driver/mingw.cpp
+++ b/clang/test/Driver/mingw.cpp
@@ -85,6 +85,10 @@
 // RUN:   | FileCheck %s --check-prefix CHECK_MINGW_EC_LINK
 // CHECK_MINGW_EC_LINK: "-m" "arm64ecpe"
 
+// RUN: %clang --target=aarch64-windows-gnu -marm64x -### -o /dev/null %s 2>&1 
\
+// RUN:   | FileCheck %s --check-prefix CHECK_MINGW_A64X_LINK
+// CHECK_MINGW_A64X_LINK: "-m" "arm64xpe"
+
 // RUN: %clang --target=mipsel-windows-gnu -### -o /dev/null %s 2>&1 \
 // RUN:   | FileCheck %s --check-prefix CHECK_MINGW_MIPSPE
 // CHECK_MINGW_MIPSPE: "-m" "mipspe"


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

Reply via email to