Skip to content

Commit

Permalink
ELF: clarify error when we don't know the output format
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emaste committed Sep 8, 2016
1 parent 0fbd534 commit e349b6d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lld/ELF/Driver.cpp
Expand Up @@ -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");
}
}

Expand Down
2 changes: 1 addition & 1 deletion lld/test/ELF/no-obj.s
Expand Up @@ -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:

0 comments on commit e349b6d

Please sign in to comment.