[PATCH] D40018: [LLD] [MinGW] Implement support for the --image-base option

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 15 00:20:58 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL318282: [MinGW] Implement support for the --image-base option (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D40018?vs=122817&id=122976#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D40018

Files:
  lld/trunk/MinGW/Driver.cpp
  lld/trunk/MinGW/Options.td
  lld/trunk/test/MinGW/driver.test


Index: lld/trunk/MinGW/Options.td
===================================================================
--- lld/trunk/MinGW/Options.td
+++ lld/trunk/MinGW/Options.td
@@ -11,6 +11,7 @@
   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">;
Index: lld/trunk/MinGW/Driver.cpp
===================================================================
--- lld/trunk/MinGW/Driver.cpp
+++ lld/trunk/MinGW/Driver.cpp
@@ -138,6 +138,8 @@
     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()));
Index: lld/trunk/test/MinGW/driver.test
===================================================================
--- lld/trunk/test/MinGW/driver.test
+++ lld/trunk/test/MinGW/driver.test
@@ -101,3 +101,7 @@
 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40018.122976.patch
Type: text/x-patch
Size: 1776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171115/6f9efc3f/attachment.bin>


More information about the llvm-commits mailing list