[lld] r307089 - Improve error message.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 4 08:53:57 PDT 2017


Author: rafael
Date: Tue Jul  4 08:53:57 2017
New Revision: 307089

URL: http://llvm.org/viewvc/llvm-project?rev=307089&view=rev
Log:
Improve error message.

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

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/test/ELF/copy-in-shared.s

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=307089&r1=307088&r2=307089&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Tue Jul  4 08:53:57 2017
@@ -557,9 +557,9 @@ static RelExpr adjustExpr(SymbolBody &Bo
   // the refered symbol can be preemepted to refer to the executable.
   if (Config->Shared || (Config->Pic && !isRelExpr(Expr))) {
     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)) +
-          getLocation<ELFT>(S, Body, RelOff));
+          " in readonly segment" + getLocation<ELFT>(S, Body, RelOff));
     return Expr;
   }
 

Modified: lld/trunk/test/ELF/copy-in-shared.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/copy-in-shared.s?rev=307089&r1=307088&r2=307089&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-in-shared.s (original)
+++ lld/trunk/test/ELF/copy-in-shared.s Tue Jul  4 08:53:57 2017
@@ -4,7 +4,7 @@
 // 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
 
-// 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: >>> referenced by {{.*}}.o:(.text+0x0)
 




More information about the llvm-commits mailing list