[PATCH] D12323: lld: make pe targets use the coff linker
Martell Malone via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 10:43:58 PDT 2015
martell created this revision.
martell added a reviewer: ruiu.
martell added subscribers: lld, llvm-commits.
martell added a project: lld.
http://reviews.llvm.org/D12323
Files:
lib/Driver/UniversalDriver.cpp
lib/Driver/UniversalDriverOptions.td
Index: lib/Driver/UniversalDriverOptions.td
===================================================================
--- lib/Driver/UniversalDriverOptions.td
+++ lib/Driver/UniversalDriverOptions.td
@@ -11,6 +11,10 @@
def target: Separate<["-"], "target">,
HelpText<"Select the target">;
+// Used to override gnu pe targets
+def m : Separate<["-"], "m">, MetaVarName<"<emulation>">,
+ HelpText<"Select target emulation">;
+
def version: Flag<["-"], "version">,
HelpText<"Display the version">;
Index: lib/Driver/UniversalDriver.cpp
===================================================================
--- lib/Driver/UniversalDriver.cpp
+++ lib/Driver/UniversalDriver.cpp
@@ -94,6 +94,19 @@
.Default(Flavor::invalid);
}
+static bool isPETarget(const llvm::opt::InputArgList &parsedArgs) {
+ llvm::opt::Arg *argMachine = parsedArgs.getLastArg(OPT_m);
+ if (!argMachine)
+ return false;
+ if (argMachine->containsValue("i386pe"))
+ return true;
+ if (argMachine->containsValue("i386pep"))
+ return true;
+ if (argMachine->containsValue("thumb2pe"))
+ return true;
+ return false;
+}
+
static ProgramNameParts parseProgramName(StringRef programName) {
SmallVector<StringRef, 3> components;
llvm::SplitString(programName, components, "-");
@@ -195,6 +208,12 @@
return true;
}
+ //Override gnu for pe targets to use coff
+ if(isPETarget(parsedArgs)) {
+ coff::link(args);
+ return true;
+ }
+
Flavor flavor = getFlavor(args, parsedArgs);
// Switch to appropriate driver.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12323.33089.patch
Type: text/x-patch
Size: 1543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150825/9361f83d/attachment.bin>
More information about the llvm-commits
mailing list