[lld] [lld] [MinGW] Support targeting ARM64EC (PR #78911)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 21 12:25:29 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lld-coff
Author: Billy Laws (bylaws)
<details>
<summary>Changes</summary>
'arm64ecpe' was chosen arbitrarily as gcc MinGW doesn't provide EC support.
CC: @<!-- -->cjacek
---
Full diff: https://github.com/llvm/llvm-project/pull/78911.diff
3 Files Affected:
- (modified) lld/Common/DriverDispatcher.cpp (+2-1)
- (modified) lld/MinGW/Driver.cpp (+3)
- (modified) lld/test/MinGW/driver.test (+6)
``````````diff
diff --git a/lld/Common/DriverDispatcher.cpp b/lld/Common/DriverDispatcher.cpp
index 435acfd277654b1..f5c8bcdef4e0f09 100644
--- a/lld/Common/DriverDispatcher.cpp
+++ b/lld/Common/DriverDispatcher.cpp
@@ -44,7 +44,8 @@ static cl::TokenizerCallback getDefaultQuotingStyle() {
}
static bool isPETargetName(StringRef s) {
- return s == "i386pe" || s == "i386pep" || s == "thumb2pe" || s == "arm64pe";
+ return s == "i386pe" || s == "i386pep" || s == "thumb2pe" || s == "arm64pe" ||
+ s == "arm64ecpe";
}
static std::optional<bool> isPETarget(llvm::ArrayRef<const char *> args) {
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 4752d92e3b1d71d..290eecaacda7d49 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -346,6 +346,7 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
if (args.getLastArgValue(OPT_m) != "thumb2pe" &&
args.getLastArgValue(OPT_m) != "arm64pe" &&
+ args.getLastArgValue(OPT_m) != "arm64ecpe" &&
args.hasFlag(OPT_disable_dynamicbase, OPT_dynamicbase, false))
add("-dynamicbase:no");
if (args.hasFlag(OPT_disable_high_entropy_va, OPT_high_entropy_va, false))
@@ -409,6 +410,8 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
add("-machine:arm");
else if (s == "arm64pe")
add("-machine:arm64");
+ else if (s == "arm64ecpe")
+ add("-machine:arm64ec");
else
error("unknown parameter: -m" + s);
}
diff --git a/lld/test/MinGW/driver.test b/lld/test/MinGW/driver.test
index 559a32bfa242f8c..46b3b6d7a862a65 100644
--- a/lld/test/MinGW/driver.test
+++ b/lld/test/MinGW/driver.test
@@ -25,6 +25,12 @@ ARM64-SAME: -machine:arm64
ARM64-SAME: -alternatename:__image_base__=__ImageBase
ARM64-SAME: foo.o
+RUN: ld.lld -### foo.o -m arm64ecpe 2>&1 | FileCheck -check-prefix=ARM64EC %s
+ARM64EC: -out:a.exe
+ARM64EC-SAME: -machine:arm64ec
+ARM64EC-SAME: -alternatename:__image_base__=__ImageBase
+ARM64EC-SAME: foo.o
+
RUN: ld.lld -### foo.o -m i386pep -shared 2>&1 | FileCheck -check-prefix=SHARED %s
RUN: ld.lld -### foo.o -m i386pep --shared 2>&1 | FileCheck -check-prefix=SHARED %s
RUN: ld.lld -### foo.o -m i386pep --dll 2>&1 | FileCheck -check-prefix=SHARED %s
``````````
</details>
https://github.com/llvm/llvm-project/pull/78911
More information about the llvm-commits
mailing list