[lld] r280989 - ELF: clarify error when we don't know the output format

Ed Maste via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 14:06:29 PDT 2016


Author: emaste
Date: Thu Sep  8 16:06:29 2016
New Revision: 280989

URL: http://llvm.org/viewvc/llvm-project?rev=280989&view=rev
Log:
ELF: clarify error when we don't know the output format

lld differs from GNU ld in that it does not have a built-in default
target emulation. Emulation is always specified via the -m option, or
obtained from the object file(s) being linked. In most cases at least
one ELF object is included in the link, so the emulation is known.

When using lld's (not yet committed) -b binary support with -r, to
convert a binary file into an ELF object we do not have a known
emulation. The error message previously emitted in this case
"-m or at least a .o file required" is accurate but does not offer
much insight. Add text to the error message to give a hint why -m or an
object file is required.

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

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/test/ELF/no-obj.s

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=280989&r1=280988&r2=280989&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Sep  8 16:06:29 2016
@@ -313,7 +313,7 @@ void LinkerDriver::main(ArrayRef<const c
     link<ELF64BE>(Args);
     return;
   default:
-    error("-m or at least a .o file required");
+    error("target emulation unknown: -m or at least one .o file required");
   }
 }
 

Modified: lld/trunk/test/ELF/no-obj.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/no-obj.s?rev=280989&r1=280988&r2=280989&view=diff
==============================================================================
--- lld/trunk/test/ELF/no-obj.s (original)
+++ lld/trunk/test/ELF/no-obj.s Thu Sep  8 16:06:29 2016
@@ -2,7 +2,7 @@
 // RUN: llvm-ar rcs %t.a %t.o
 // RUN: not ld.lld -o %t2 -u _start %t.a 2>&1 | FileCheck %s
 
-// CHECK: -m or at least a .o file required
+// CHECK: target emulation unknown: -m or at least one .o file required
 
 .global _start
 _start:




More information about the llvm-commits mailing list