[lld] [MinGW] Support targeting ARM64EC (#78911)

'arm64ecpe' was chosen arbitrarily as gcc MinGW doesn't provide EC
support.
This commit is contained in:
Billy Laws 2024-01-30 14:53:12 +00:00 committed by GitHub
parent b52fe2df91
commit a9ffdc171a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View File

@ -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) {

View File

@ -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);
}

View File

@ -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