Improve error message.

Before we would sometimes not mention that the relocation was in a ro
area before.

llvm-svn: 307089
This commit is contained in:
Rafael Espindola 2017-07-04 15:53:57 +00:00
parent c60abe37f2
commit 909899cc47
2 changed files with 3 additions and 3 deletions

View File

@ -557,9 +557,9 @@ static RelExpr adjustExpr(SymbolBody &Body, RelExpr Expr, uint32_t Type,
// the refered symbol can be preemepted to refer to the executable. // the refered symbol can be preemepted to refer to the executable.
if (Config->Shared || (Config->Pic && !isRelExpr(Expr))) { if (Config->Shared || (Config->Pic && !isRelExpr(Expr))) {
error("can't create dynamic relocation " + toString(Type) + " against " + error("can't create dynamic relocation " + toString(Type) + " against " +
(Body.getName().empty() ? "local symbol in readonly segment" (Body.getName().empty() ? "local symbol"
: "symbol: " + toString(Body)) + : "symbol: " + toString(Body)) +
getLocation<ELFT>(S, Body, RelOff)); " in readonly segment" + getLocation<ELFT>(S, Body, RelOff));
return Expr; return Expr;
} }

View File

@ -4,7 +4,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o
// RUN: not ld.lld %t2.o %t1.so -o %t2.so -shared 2>&1 | FileCheck %s // RUN: not ld.lld %t2.o %t1.so -o %t2.so -shared 2>&1 | FileCheck %s
// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo // CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo in readonly segment
// CHECK: >>> defined in {{.*}}.so // CHECK: >>> defined in {{.*}}.so
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0) // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)