[clang] [Driver][MinGW] Allow using clang driver to link ARM64X PEs. (PR #148064)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 10 14:57:35 PDT 2025
https://github.com/WhatAmISupposedToPutHere created https://github.com/llvm/llvm-project/pull/148064
Similar to how clang-cl driver does it, make it possible to build arm64x binaries with a mingw-style invocation.
>From ced43ee83d1c830293146363e60a57c3dfb8a93a Mon Sep 17 00:00:00 2001
From: Sasha Finkelstein <fnkl.kernel at gmail.com>
Date: Thu, 10 Jul 2025 23:28:56 +0200
Subject: [PATCH] [Driver][MinGW] Allow using clang driver to link ARM64X PEs.
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.kernel at gmail.com>
---
clang/lib/Driver/ToolChains/MinGW.cpp | 4 +++-
clang/test/Driver/mingw.cpp | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)
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"
More information about the cfe-commits
mailing list