[PATCH] D41051: [LLD] [COFF] Disallow -dynamicbase:no for arm and arm64
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 9 13:51:03 PST 2017
mstorsjo created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.
This matches what MSVC link.exe does.
https://reviews.llvm.org/D41051
Files:
COFF/Driver.cpp
test/COFF/arm64-dynamicbase.s
test/COFF/armnt-dynamicbase.test
Index: test/COFF/armnt-dynamicbase.test
===================================================================
--- /dev/null
+++ test/COFF/armnt-dynamicbase.test
@@ -0,0 +1,3 @@
+# RUN: yaml2obj < %p/Inputs/armnt-executable.obj.yaml > %t.obj
+# RUN: not lld-link /out:%t.exe /entry:mainCRTStartup /subsystem:console %t.obj /dynamicbase:no 2>&1 | FileCheck %s
+# CHECK: dynamicbase:no is not compatible with arm
Index: test/COFF/arm64-dynamicbase.s
===================================================================
--- /dev/null
+++ test/COFF/arm64-dynamicbase.s
@@ -0,0 +1,8 @@
+// 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
+ .globl _start
+_start:
+ ret
+
+# CHECK: dynamicbase:no is not compatible with arm64
Index: COFF/Driver.cpp
===================================================================
--- COFF/Driver.cpp
+++ COFF/Driver.cpp
@@ -1076,6 +1076,11 @@
Config->is64() &&
Args.hasFlag(OPT_highentropyva, OPT_highentropyva_no, true);
+ if (!Config->DynamicBase &&
+ (Config->Machine == ARMNT || Config->Machine == ARM64))
+ error("/dynamicbase:no is not compatible with " +
+ machineToStr(Config->Machine));
+
// Handle /entry and /dll
if (auto *Arg = Args.getLastArg(OPT_entry)) {
Config->Entry = addUndefined(mangle(Arg->getValue()));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41051.126281.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171209/530a8051/attachment.bin>
More information about the llvm-commits
mailing list