<div dir="ltr"><pre class="">+static std::unique_ptr<InputFile> createTargetFile(MemoryBufferRef MB) {
+  std::unique_ptr<InputFile> File = createFile(MB);
+  ELFFileBase *ELFFile = dyn_cast<ELFFileBase>(File.get());
+  if (!ELFFile)
+    return File;
+
+  const ELFKind ElfKind = ELFFile->getELFKind();
+  const uint16_t EMachine = ELFFile->getEMachine();
+
+  // Grab target from the first input file if wasn't set by -m option.
+  if (Config->ElfKind == ELFNoneKind) {
+    Config->ElfKind = ElfKind;
+    Config->EMachine = EMachine;
+    return File;
+  }
+  if (ElfKind != Config->ElfKind || EMachine != Config->EMachine)
+    return nullptr;</pre><pre class="">Why don't you call error() here?</pre><pre class=""><pre class="">+  bool HasEmulation = false;
+  if (auto *Arg = Args.getLastArg(OPT_emulation)) {
+    applyEmulation(Arg->getValue());</pre><pre class="">I prefer setELFType or something over applyEmulation.</pre><pre class=""><pre class="">+def emulation : Separate<["-"], "m">,
+  HelpText<"Set target emulation">;</pre><pre class="">Stick with "def m" instead of "def emulation" how silly the option is named.</pre></pre></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 1, 2015 at 10:20 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch makes isCompatibleWith redundant and should remove it (See<br>
attached patch).<br>
<br>
I think this OK once rebased on top of trunk.<br>
Rui, is this OK with you too?<br>
<br>
<br>
On 1 October 2015 at 05:09, Denis Protivensky<br>
<div class="HOEnZb"><div class="h5"><<a href="mailto:dprotivensky@accesssoftek.com">dprotivensky@accesssoftek.com</a>> wrote:<br>
> denis-protivensky updated this revision to Diff 36201.<br>
> denis-protivensky marked 2 inline comments as done.<br>
> denis-protivensky added a comment.<br>
><br>
> Updated:<br>
><br>
> - Remove FirstOjbName Config variable, use Symtab.getFirstELF()->getName() instead<br>
> - clang-format sources<br>
><br>
><br>
> <a href="http://reviews.llvm.org/D13055" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13055</a><br>
><br>
> Files:<br>
>   ELF/Config.h<br>
>   ELF/Driver.cpp<br>
>   ELF/InputFiles.cpp<br>
>   ELF/InputFiles.h<br>
>   ELF/Options.td<br>
>   ELF/SymbolTable.cpp<br>
>   test/elf2/basic.s<br>
>   test/elf2/emulation.s<br>
>   test/elf2/incompatible.s<br>
><br>
</div></div></blockquote></div><br></div>