ELF: clarify error when we don't know the output format
authorEd Maste <emaste@freebsd.org>
Thu, 8 Sep 2016 21:06:29 +0000 (21:06 +0000)
committerEd Maste <emaste@freebsd.org>
Thu, 8 Sep 2016 21:06:29 +0000 (21:06 +0000)
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

llvm-svn: 280989

lld/ELF/Driver.cpp
lld/test/ELF/no-obj.s

index a486873..7b64664 100644 (file)
@@ -313,7 +313,7 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
     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");
   }
 }
 
index 68e9979..eea10a4 100644 (file)
@@ -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: