Skip to content

Commit

Permalink
[MinGW] Handle --large-address-aware
Browse files Browse the repository at this point in the history
In GNU ld, this option is only available on i386, not on x86_64
(where it's enabled by default with no option to disable it either).

Differential Revision: https://reviews.llvm.org/D40015

llvm-svn: 318280
  • Loading branch information
mstorsjo committed Nov 15, 2017
1 parent 6e60297 commit 3c8d4b5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lld/MinGW/Driver.cpp
Expand Up @@ -154,6 +154,8 @@ bool mingw::link(ArrayRef<const char *> ArgsArr, raw_ostream &Diag) {
Add("-export-all-symbols");
if (!Args.hasArg(OPT_strip_all))
Add("-debug:dwarf");
if (Args.hasArg(OPT_large_address_aware))
Add("-largeaddressaware");

if (auto *A = Args.getLastArg(OPT_m)) {
StringRef S = A->getValue();
Expand Down
2 changes: 2 additions & 0 deletions lld/MinGW/Options.td
Expand Up @@ -15,6 +15,8 @@ def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;
def no_whole_archive: F<"no-whole-archive">,
HelpText<"No longer include all object files for following archives">;
def large_address_aware: Flag<["--"], "large-address-aware">,
HelpText<"Enable large addresses">;
def o: JoinedOrSeparate<["-"], "o">, MetaVarName<"<path>">,
HelpText<"Path to file to write output">;
def out_implib: Separate<["--"], "out-implib">, HelpText<"Import library name">;
Expand Down
3 changes: 3 additions & 0 deletions lld/test/MinGW/driver.test
Expand Up @@ -89,3 +89,6 @@ DEBUG: -debug:dwarf
RUN: ld.lld -### -m i386pep foo.o -s | FileCheck -check-prefix STRIP %s
RUN: ld.lld -### -m i386pep foo.o --strip-all | FileCheck -check-prefix STRIP %s
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

0 comments on commit 3c8d4b5

Please sign in to comment.