<div dir="ltr"><div class="gmail_extra">This checks for too specific type of error. I don't want to have this in the ELF linker.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 24, 2015 at 6:52 AM, Martell Malone via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: martell<br>
Date: Tue Nov 24 08:52:16 2015<br>
New Revision: 253985<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253985&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253985&view=rev</a><br>
Log:<br>
ELF: print out a verbose error when a windows emulation is used<br>
<br>
Modified:<br>
    lld/trunk/ELF/Driver.cpp<br>
<br>
Modified: lld/trunk/ELF/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=253985&r1=253984&r2=253985&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=253985&r1=253984&r2=253985&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/ELF/Driver.cpp (original)<br>
+++ lld/trunk/ELF/Driver.cpp Tue Nov 24 08:52:16 2015<br>
@@ -52,6 +52,12 @@ static std::pair<ELFKind, uint16_t> pars<br>
     return {ELF64LEKind, EM_X86_64};<br>
   if (S == "aarch64linux")<br>
     return {ELF64LEKind, EM_AARCH64};<br>
+  if (S == "i386pe")<br>
+    return {ELFNoneKind, EM_386};<br>
+  if (S == "i386pep")<br>
+    return {ELFNoneKind, EM_X86_64};<br>
+  if (S == "thumb2pe")<br>
+    return {ELFNoneKind, EM_ARM};<br>
   error("Unknown emulation: " + S);<br>
 }<br>
<br>
@@ -104,9 +110,21 @@ static bool hasZOption(opt::InputArgList<br>
 }<br>
<br>
 void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {<br>
-  initSymbols();<br>
<br>
   opt::InputArgList Args = parseArgs(&Alloc, ArgsArr);<br>
+<br>
+  if (auto *Arg = Args.getLastArg(OPT_m)) {<br>
+    StringRef S = Arg->getValue();<br>
+    std::pair<ELFKind, uint16_t> P = parseEmulation(S);<br>
+    Config->EKind = P.first;<br>
+    Config->EMachine = P.second;<br>
+    Config->Emulation = S;<br>
+  }<br>
+<br>
+  if((Config->EKind == ELFNoneKind) && (Config->EMachine !=  EM_NONE))<br>
+    error("windows coff targets aren't supported on the gnu frontend.");<br>
+<br>
+  initSymbols();<br>
   createFiles(Args);<br>
<br>
   // Traditional linkers can generate re-linkable object files instead<br>
@@ -143,14 +161,6 @@ void LinkerDriver::createFiles(opt::Inpu<br>
   if (!RPaths.empty())<br>
     Config->RPath = llvm::join(RPaths.begin(), RPaths.end(), ":");<br>
<br>
-  if (auto *Arg = Args.getLastArg(OPT_m)) {<br>
-    StringRef S = Arg->getValue();<br>
-    std::pair<ELFKind, uint16_t> P = parseEmulation(S);<br>
-    Config->EKind = P.first;<br>
-    Config->EMachine = P.second;<br>
-    Config->Emulation = S;<br>
-  }<br>
-<br>
   Config->AllowMultipleDefinition = Args.hasArg(OPT_allow_multiple_definition);<br>
   Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic);<br>
   Config->DiscardAll = Args.hasArg(OPT_discard_all);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>