[lld] r320518 - [MinGW] Don't pass -dynamicbase:no by default for arm/arm64
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 11:39:18 PST 2017
Author: mstorsjo
Date: Tue Dec 12 11:39:18 2017
New Revision: 320518
URL: http://llvm.org/viewvc/llvm-project?rev=320518&view=rev
Log:
[MinGW] Don't pass -dynamicbase:no by default for arm/arm64
The linker refuses using -dynamicbase:no on these architectures.
Stop passing -dynamicbase (which just reinforces the lld-link
default) for simplicity.
Differential Revision: https://reviews.llvm.org/D41052
Modified:
lld/trunk/MinGW/Driver.cpp
lld/trunk/test/MinGW/driver.test
Modified: lld/trunk/MinGW/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Driver.cpp?rev=320518&r1=320517&r2=320518&view=diff
==============================================================================
--- lld/trunk/MinGW/Driver.cpp (original)
+++ lld/trunk/MinGW/Driver.cpp Tue Dec 12 11:39:18 2017
@@ -159,7 +159,9 @@ bool mingw::link(ArrayRef<const char *>
if (Args.hasArg(OPT_large_address_aware))
Add("-largeaddressaware");
- Add(Args.hasArg(OPT_dynamicbase) ? "-dynamicbase" : "-dynamicbase:no");
+ if (Args.getLastArgValue(OPT_m) != "thumb2pe" &&
+ Args.getLastArgValue(OPT_m) != "arm64pe" && !Args.hasArg(OPT_dynamicbase))
+ Add("-dynamicbase:no");
if (Args.hasFlag(OPT_gc_sections, OPT_no_gc_sections, false))
Add("-opt:ref");
Modified: lld/trunk/test/MinGW/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/MinGW/driver.test?rev=320518&r1=320517&r2=320518&view=diff
==============================================================================
--- lld/trunk/test/MinGW/driver.test (original)
+++ lld/trunk/test/MinGW/driver.test Tue Dec 12 11:39:18 2017
@@ -93,14 +93,14 @@ STRIP-NOT: -debug:dwarf
RUN: ld.lld -### -m i386pep foo.o --large-address-aware | FileCheck -check-prefix LARGE-ADDRESS-AWARE %s
LARGE-ADDRESS-AWARE: -largeaddressaware
+RUN: ld.lld -### -m i386pe foo.o | FileCheck -check-prefix DEFAULT-DISABLE-FLAGS %s
RUN: ld.lld -### -m i386pep foo.o | FileCheck -check-prefix DEFAULT-DISABLE-FLAGS %s
DEFAULT-DISABLE-FLAGS: -dynamicbase:no
-
-# The extra '-' in the following check pattern is intentional, to make sure
-# that a check for "-dynamicbase" doesn't match the default "-dynamicbase:no".
-RUN: ld.lld -### -m i386pep foo.o --dynamicbase | FileCheck -check-prefix DYNAMICBASE %s
-RUN: ld.lld -### -m i386pep foo.o -dynamicbase | FileCheck -check-prefix DYNAMICBASE %s
-DYNAMICBASE: -dynamicbase -
+RUN: ld.lld -### -m i386pe --dynamicbase foo.o | FileCheck -check-prefix NO-DEFAULT-DISABLE-FLAGS %s
+RUN: ld.lld -### -m i386pep -dynamicbase foo.o | FileCheck -check-prefix NO-DEFAULT-DISABLE-FLAGS %s
+RUN: ld.lld -### -m thumb2pe foo.o | FileCheck -check-prefix NO-DEFAULT-DISABLE-FLAGS %s
+RUN: ld.lld -### -m arm64pe foo.o | FileCheck -check-prefix NO-DEFAULT-DISABLE-FLAGS %s
+NO-DEFAULT-DISABLE-FLAGS-NOT: -dynamicbase:no
RUN: ld.lld -### -m i386pep foo.o --image-base 0x1230000 | FileCheck -check-prefix IMAGE-BASE %s
RUN: ld.lld -### -m i386pep foo.o -image-base 0x1230000 | FileCheck -check-prefix IMAGE-BASE %s
More information about the llvm-commits
mailing list