[lld] r318282 - [MinGW] Implement support for the --image-base option

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 00:18:16 PST 2017


Author: mstorsjo
Date: Wed Nov 15 00:18:15 2017
New Revision: 318282

URL: http://llvm.org/viewvc/llvm-project?rev=318282&view=rev
Log:
[MinGW] Implement support for the --image-base option

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

Modified:
    lld/trunk/MinGW/Driver.cpp
    lld/trunk/MinGW/Options.td
    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=318282&r1=318281&r2=318282&view=diff
==============================================================================
--- lld/trunk/MinGW/Driver.cpp (original)
+++ lld/trunk/MinGW/Driver.cpp Wed Nov 15 00:18:15 2017
@@ -138,6 +138,8 @@ bool mingw::link(ArrayRef<const char *>
     Add("-stack:" + StringRef(A->getValue()));
   if (auto *A = Args.getLastArg(OPT_output_def))
     Add("-output-def:" + StringRef(A->getValue()));
+  if (auto *A = Args.getLastArg(OPT_image_base))
+    Add("-base:" + StringRef(A->getValue()));
 
   if (auto *A = Args.getLastArg(OPT_o))
     Add("-out:" + StringRef(A->getValue()));

Modified: lld/trunk/MinGW/Options.td
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/MinGW/Options.td?rev=318282&r1=318281&r2=318282&view=diff
==============================================================================
--- lld/trunk/MinGW/Options.td (original)
+++ lld/trunk/MinGW/Options.td Wed Nov 15 00:18:15 2017
@@ -11,6 +11,7 @@ def entry: S<"entry">, MetaVarName<"<ent
   HelpText<"Name of entry point symbol">;
 def export_all_symbols: F<"export-all-symbols">,
     HelpText<"Export all symbols even if a def file or dllexport attributes are used">;
+def image_base: S<"image-base">, HelpText<"Base address of the program">;
 def l: JoinedOrSeparate<["-"], "l">, MetaVarName<"<libName>">,
   HelpText<"Root name of library to use">;
 def m: JoinedOrSeparate<["-"], "m">, HelpText<"Set target emulation">;

Modified: lld/trunk/test/MinGW/driver.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/MinGW/driver.test?rev=318282&r1=318281&r2=318282&view=diff
==============================================================================
--- lld/trunk/test/MinGW/driver.test (original)
+++ lld/trunk/test/MinGW/driver.test Wed Nov 15 00:18:15 2017
@@ -101,3 +101,7 @@ DEFAULT-DISABLE-FLAGS: -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 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
+IMAGE-BASE: -base:0x1230000




More information about the llvm-commits mailing list