From e349b6da2c19e847c4e7256b01edc50853337085 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 8 Sep 2016 21:06:29 +0000 Subject: [PATCH] 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 llvm-svn: 280989 --- lld/ELF/Driver.cpp | 2 +- lld/test/ELF/no-obj.s | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index a486873..7b64664 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -313,7 +313,7 @@ void LinkerDriver::main(ArrayRef ArgsArr) { link(Args); return; default: - error("-m or at least a .o file required"); + error("target emulation unknown: -m or at least one .o file required"); } } diff --git a/lld/test/ELF/no-obj.s b/lld/test/ELF/no-obj.s index 68e9979..eea10a4 100644 --- a/lld/test/ELF/no-obj.s +++ b/lld/test/ELF/no-obj.s @@ -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: -- 2.7.4