[lld] [lld] Don't allow -dynamicbase:no on ARM64EC. (PR #68357)

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 11 09:07:51 PDT 2023


https://github.com/cjacek updated https://github.com/llvm/llvm-project/pull/68357

>From 5995727f7927eda4fc7c10a1517baf4ad6e66495 Mon Sep 17 00:00:00 2001
From: Jacek Caban <jacek at codeweavers.com>
Date: Mon, 26 Jun 2023 16:46:50 +0200
Subject: [PATCH] [lld] Don't allow -dynamicbase:no on ARM64EC.

---
 lld/COFF/Driver.cpp               | 2 +-
 lld/test/COFF/arm64-dynamicbase.s | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index c7f4e1f767a5431..278f5e71b14f543 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -2181,7 +2181,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
       args.hasFlag(OPT_highentropyva, OPT_highentropyva_no, true);
 
   if (!config->dynamicBase &&
-      (config->machine == ARMNT || config->machine == ARM64))
+      (config->machine == ARMNT || isAnyArm64(config->machine)))
     error("/dynamicbase:no is not compatible with " +
           machineToStr(config->machine));
 
diff --git a/lld/test/COFF/arm64-dynamicbase.s b/lld/test/COFF/arm64-dynamicbase.s
index d4cb12c1c8ffb9e..6ccce26a2f168a3 100644
--- a/lld/test/COFF/arm64-dynamicbase.s
+++ b/lld/test/COFF/arm64-dynamicbase.s
@@ -1,8 +1,16 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-windows %s -o %t.obj
 // RUN: not lld-link -entry:_start -subsystem:console %t.obj -out:%t.exe -dynamicbase:no 2>&1 | FileCheck %s
+
+// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %s -o %t.obj
+// RUN: not lld-link -entry:_start -subsystem:console %t.obj -out:%t.exe -dynamicbase:no -machine:arm64ec 2>&1 \
+// RUN:              | FileCheck %s -check-prefix=ARM64EC
+// RUN: not lld-link -entry:_start -subsystem:console %t.obj -out:%t.exe -dynamicbase:no -machine:arm64x -dll -noentry 2>&1 \
+// RUN:              | FileCheck %s -check-prefix=ARM64X
  .globl _start
 _start:
  ret
 
 # CHECK: dynamicbase:no is not compatible with arm64
+# ARM64EC: dynamicbase:no is not compatible with arm64ec
+# ARM64X: dynamicbase:no is not compatible with arm64x



More information about the llvm-commits mailing list