[lld] r299390 - Change the error message format for an incompatible relocation.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 3 14:36:32 PDT 2017


Author: ruiu
Date: Mon Apr  3 16:36:31 2017
New Revision: 299390

URL: http://llvm.org/viewvc/llvm-project?rev=299390&view=rev
Log:
Change the error message format for an incompatible relocation.

Previous error message style:

  error: /home/alice/src/bar.c:12: relocation R_X86_64_PLT32 cannot refer to absolute symbol 'answer' defined in /home/alice/src/foo.o

New error message style:

  error: relocation R_X86_64_PLT32 cannot refer to absolute symbol: foo
  >>> defined in /home/alice/src/foo.o
  >>> referenced by bar.c:12 (/home/alice/src/bar.c:12)
  >>>               /home/alice/src/bar.o:(.text+0x1)

Modified:
    lld/trunk/ELF/Relocations.cpp
    lld/trunk/test/ELF/aarch64-fpic-abs16.s
    lld/trunk/test/ELF/aarch64-fpic-add_abs_lo12_nc.s
    lld/trunk/test/ELF/aarch64-fpic-adr_prel_lo21.s
    lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
    lld/trunk/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s
    lld/trunk/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s
    lld/trunk/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s
    lld/trunk/test/ELF/aarch64-fpic-prel16.s
    lld/trunk/test/ELF/aarch64-fpic-prel32.s
    lld/trunk/test/ELF/aarch64-fpic-prel64.s
    lld/trunk/test/ELF/arm-target1.s
    lld/trunk/test/ELF/copy-errors.s
    lld/trunk/test/ELF/copy-in-shared.s
    lld/trunk/test/ELF/copy-rel-pie-error.s
    lld/trunk/test/ELF/dynamic-reloc-in-ro.s
    lld/trunk/test/ELF/eh-frame-dyn-rel.s
    lld/trunk/test/ELF/relocation-relative-absolute.s
    lld/trunk/test/ELF/x86-64-dyn-rel-error.s
    lld/trunk/test/ELF/x86-64-dyn-rel-error2.s
    lld/trunk/test/ELF/x86-64-reloc-32-fpic.s
    lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Mon Apr  3 16:36:31 2017
@@ -63,6 +63,22 @@ using namespace llvm::support::endian;
 using namespace lld;
 using namespace lld::elf;
 
+// Construct a message in the following format.
+//
+// >>> defined in /home/alice/src/foo.o
+// >>> referenced by bar.c:12 (/home/alice/src/bar.c:12)
+// >>>               /home/alice/src/bar.o:(.text+0x1)
+template <class ELFT>
+static std::string getLocation(InputSectionBase &S, const SymbolBody &Sym,
+                               uint64_t Off) {
+  std::string Msg =
+      "\n>>> defined in " + toString(Sym.File) + "\n>>> referenced by ";
+  std::string Src = S.getSrcMsg<ELFT>(Off);
+  if (!Src.empty())
+    Msg += Src + "\n>>>               ";
+  return Msg + S.getObjMsg<ELFT>(Off);
+}
+
 static bool refersToGotEntry(RelExpr Expr) {
   return isRelExprOneOf<R_GOT, R_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOT_OFF,
                         R_MIPS_GOT_OFF32, R_MIPS_TLSGD, R_MIPS_TLSLD,
@@ -331,9 +347,8 @@ static bool isStaticLinkTimeConstant(Rel
   if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak())
     return true;
 
-  error(S.getLocation<ELFT>(RelOff) + ": relocation " + toString(Type) +
-        " cannot refer to absolute symbol '" + toString(Body) +
-        "' defined in " + toString(Body.File));
+  error("relocation " + toString(Type) + " cannot refer to absolute symbol: " +
+        toString(Body) + getLocation<ELFT>(S, Body, RelOff));
   return true;
 }
 
@@ -489,17 +504,16 @@ static RelExpr adjustExpr(SymbolBody &Bo
   // only memory. We can hack around it if we are producing an executable and
   // the refered symbol can be preemepted to refer to the executable.
   if (Config->Shared || (Config->Pic && !isRelExpr(Expr))) {
-    error(S.getLocation<ELFT>(RelOff) + ": 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"
-                                  : "symbol '" + toString(Body) + "'") +
-          " defined in " + toString(Body.File));
+                                  : "symbol: " + toString(Body)) +
+          getLocation<ELFT>(S, Body, RelOff));
     return Expr;
   }
 
   if (Body.getVisibility() != STV_DEFAULT) {
-    error(S.getLocation<ELFT>(RelOff) + ": cannot preempt symbol '" +
-          toString(Body) + "' defined in " + toString(Body.File));
+    error("cannot preempt symbol: " + toString(Body) +
+          getLocation<ELFT>(S, Body, RelOff));
     return Expr;
   }
 
@@ -508,9 +522,10 @@ static RelExpr adjustExpr(SymbolBody &Bo
     auto *B = cast<SharedSymbol>(&Body);
     if (!B->NeedsCopy) {
       if (Config->ZNocopyreloc)
-        error(S.getLocation<ELFT>(RelOff) + ": unresolvable relocation " +
-              toString(Type) + " against symbol '" + toString(*B) +
-              "'; recompile with -fPIC or remove '-z nocopyreloc'");
+        error("unresolvable relocation " + toString(Type) +
+              " against symbol '" + toString(*B) +
+              "'; recompile with -fPIC or remove '-z nocopyreloc'" +
+              getLocation<ELFT>(S, Body, RelOff));
 
       addCopyRelSymbol<ELFT>(B);
     }
@@ -543,7 +558,7 @@ static RelExpr adjustExpr(SymbolBody &Bo
   }
 
   error("symbol '" + toString(Body) + "' defined in " + toString(Body.File) +
-        " is missing type");
+        " has no type");
   return Expr;
 }
 
@@ -820,8 +835,10 @@ static void scanRelocs(InputSectionBase
       // We don't know anything about the finaly symbol. Just ask the dynamic
       // linker to handle the relocation for us.
       if (!Target->isPicRel(Type))
-        error(Sec.getLocation<ELFT>(Offset) + ": relocation " + toString(Type) +
-              " cannot be used against shared object; recompile with -fPIC.");
+        error("relocation " + toString(Type) +
+              " cannot be used against shared object; recompile with -fPIC" +
+              getLocation<ELFT>(Sec, Body, Offset));
+
       In<ELFT>::RelaDyn->addReloc(
           {Target->getDynRel(Type), &Sec, Offset, false, &Body, Addend});
 

Modified: lld/trunk/test/ELF/aarch64-fpic-abs16.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-abs16.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-abs16.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-abs16.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}:(.data+0x0): relocation R_AARCH64_ABS16 cannot be used against shared object; recompile with -fPIC.
+// CHECK:      relocation R_AARCH64_ABS16 cannot be used against shared object; recompile with -fPIC
+// CHECK-NEXT: >>> defined in {{.*}}.o
+// CHECK-NEXT: >>> referenced by {{.*}}.o:(.data+0x0)
 
 .data
   .hword foo

Modified: lld/trunk/test/ELF/aarch64-fpic-add_abs_lo12_nc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-add_abs_lo12_nc.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-add_abs_lo12_nc.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-add_abs_lo12_nc.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol 'dat' defined in {{.*}}.o
+// CHECK: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: dat
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
   add x0, x0, :lo12:dat
 .data

Modified: lld/trunk/test/ELF/aarch64-fpic-adr_prel_lo21.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-adr_prel_lo21.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-adr_prel_lo21.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-adr_prel_lo21.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_AARCH64_ADR_PREL_LO21 against symbol 'dat' defined in {{.*}}.o
+// CHECK: can't create dynamic relocation R_AARCH64_ADR_PREL_LO21 against symbol: dat
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
   adr x0, dat
 .data

Modified: lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol 'dat' defined in {{.*}}.o
+// CHECK: can't create dynamic relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol: dat
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
   adrp x0, dat
 .data

Modified: lld/trunk/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_AARCH64_LDST32_ABS_LO12_NC against symbol 'dat' defined in {{.*}}.o
+// CHECK: can't create dynamic relocation R_AARCH64_LDST32_ABS_LO12_NC against symbol: dat
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
   ldr s4, [x0, :lo12:dat]
 .data

Modified: lld/trunk/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_AARCH64_LDST64_ABS_LO12_NC against symbol 'dat' defined in {{.*}}.o
+// CHECK: can't create dynamic relocation R_AARCH64_LDST64_ABS_LO12_NC against symbol: dat
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
   ldr x0, [x0, :lo12:dat]
 .data

Modified: lld/trunk/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_AARCH64_LDST8_ABS_LO12_NC against symbol 'dat' defined in {{.*}}.o
+// CHECK: can't create dynamic relocation R_AARCH64_LDST8_ABS_LO12_NC against symbol: dat
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
   ldrsb x0, [x1, :lo12:dat]
 .data

Modified: lld/trunk/test/ELF/aarch64-fpic-prel16.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-prel16.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-prel16.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-prel16.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}:(.data+0x0): relocation R_AARCH64_PREL16 cannot be used against shared object; recompile with -fPIC.
+// CHECK: R_AARCH64_PREL16 cannot be used against shared object; recompile with -fPIC
+// CHECK: >>> defined in {{.*}}
+// CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
 .data
   .hword foo - .

Modified: lld/trunk/test/ELF/aarch64-fpic-prel32.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-prel32.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-prel32.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-prel32.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}:(.data+0x0): relocation R_AARCH64_PREL32 cannot be used against shared object; recompile with -fPIC.
+// CHECK: relocation R_AARCH64_PREL32 cannot be used against shared object; recompile with -fPIC
+// CHECK: >>> defined in {{.*}}
+// CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
 .data
   .word foo - .

Modified: lld/trunk/test/ELF/aarch64-fpic-prel64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/aarch64-fpic-prel64.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/aarch64-fpic-prel64.s (original)
+++ lld/trunk/test/ELF/aarch64-fpic-prel64.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,9 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-// CHECK: {{.*}}:(.data+0x0): relocation R_AARCH64_PREL64 cannot be used against shared object; recompile with -fPIC.
+// CHECK: relocation R_AARCH64_PREL64 cannot be used against shared object; recompile with -fPIC
+// CHECK: >>> defined in {{.*}}
+// CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
 .data
   .xword foo - .

Modified: lld/trunk/test/ELF/arm-target1.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-target1.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/arm-target1.s (original)
+++ lld/trunk/test/ELF/arm-target1.s Mon Apr  3 16:36:31 2017
@@ -31,4 +31,6 @@
 // RELATIVE: SYMBOL TABLE:
 // RELATIVE: 00001004         .text           00000000 patatino
 
-// ABS: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_ARM_TARGET1 against symbol 'patatino' defined in {{.*}}.o
+// ABS: can't create dynamic relocation R_ARM_TARGET1 against symbol: patatino
+// ABS: >>> defined in {{.*}}.o
+// ABS: >>> referenced by {{.*}}.o:(.text+0x0)

Modified: lld/trunk/test/ELF/copy-errors.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/copy-errors.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-errors.s (original)
+++ lld/trunk/test/ELF/copy-errors.s Mon Apr  3 16:36:31 2017
@@ -4,12 +4,12 @@
 // RUN: ld.lld %t2.o -o %t2.so -shared
 // RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
 
+// CHECK: cannot preempt symbol: bar
+// CHECK: >>> defined in {{.*}}.so
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x1)
+// CHECK: symbol 'zed' defined in {{.*}}.so has no type
+
 .global _start
 _start:
-
-
 call bar
-// CHECK: {{.*}}.o:(.text+0x1): cannot preempt symbol 'bar' defined in {{.*}}.so
-
 call zed
-// CHECK: symbol 'zed' defined in {{.*}}.so is missing type

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=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-in-shared.s (original)
+++ lld/trunk/test/ELF/copy-in-shared.s Mon Apr  3 16:36:31 2017
@@ -4,7 +4,8 @@
 // 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: >>> defined in {{.*}}.so
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
 .quad foo
-
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_X86_64_64 against symbol 'foo' defined in {{.*}}.so

Modified: lld/trunk/test/ELF/copy-rel-pie-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/copy-rel-pie-error.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-rel-pie-error.s (original)
+++ lld/trunk/test/ELF/copy-rel-pie-error.s Mon Apr  3 16:36:31 2017
@@ -3,8 +3,13 @@
 // RUN: ld.lld %t2.o -o %t2.so -shared
 // RUN: not ld.lld %t.o %t2.so -o %t.exe -pie 2>&1 | FileCheck %s
 
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_X86_64_64 against symbol 'bar' defined in {{.*}}.so
-// CHECK: {{.*}}.o:(.text+0x8): can't create dynamic relocation R_X86_64_64 against symbol 'foo' defined in {{.*}}.so
+// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: bar
+// CHECK: >>> defined in {{.*}}.so
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
+
+// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo
+// CHECK: >>> defined in {{.*}}.so
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x8)
 
 .global _start
 _start:

Modified: lld/trunk/test/ELF/dynamic-reloc-in-ro.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-reloc-in-ro.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/dynamic-reloc-in-ro.s (original)
+++ lld/trunk/test/ELF/dynamic-reloc-in-ro.s Mon Apr  3 16:36:31 2017
@@ -2,7 +2,9 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s
 
+// CHECK: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
+
 foo:
 .quad foo
-
-// CHECK: {{.*}}.o:(.text+0x0): can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment defined in {{.*}}.o

Modified: lld/trunk/test/ELF/eh-frame-dyn-rel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/eh-frame-dyn-rel.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/eh-frame-dyn-rel.s (original)
+++ lld/trunk/test/ELF/eh-frame-dyn-rel.s Mon Apr  3 16:36:31 2017
@@ -2,9 +2,11 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: not ld.lld %t.o %t.o -o %t -shared 2>&1 | FileCheck %s
 
-        .section        bar,"axG", at progbits,foo,comdat
-        .cfi_startproc
-        .cfi_personality 0x8c, foo
-        .cfi_endproc
+// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo
+// CHECK: >>> defined in {{.*}}.o
+// CHECK: >>> referenced by {{.*}}.o:(.eh_frame+0x12)
 
-// CHECK: {{.*}}.o:(.eh_frame+0x12): can't create dynamic relocation R_X86_64_64 against symbol 'foo' defined in {{.*}}.o
+.section bar,"axG", at progbits,foo,comdat
+.cfi_startproc
+.cfi_personality 0x8c, foo
+.cfi_endproc

Modified: lld/trunk/test/ELF/relocation-relative-absolute.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-relative-absolute.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-relative-absolute.s (original)
+++ lld/trunk/test/ELF/relocation-relative-absolute.s Mon Apr  3 16:36:31 2017
@@ -7,6 +7,8 @@
 .globl _start
 _start:
 
-# CHECK: {{.*}}input1.o:(.text+0x1): relocation R_X86_64_PLT32 cannot refer to absolute symbol 'answer' defined in {{.*}}input2.o
+# CHECK:      error: relocation R_X86_64_PLT32 cannot refer to absolute symbol: answer
+# CHECK-NEXT: >>> defined in {{.*}}input2.o
+# CHECK-NEXT: >>> referenced by {{.*}}o:(.text+0x1)
 
 call answer at PLT

Modified: lld/trunk/test/ELF/x86-64-dyn-rel-error.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-dyn-rel-error.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-dyn-rel-error.s (original)
+++ lld/trunk/test/ELF/x86-64-dyn-rel-error.s Mon Apr  3 16:36:31 2017
@@ -9,4 +9,4 @@ _start:
         .data
         .long bar
 
-// CHECK: {{.*}}:(.data+0x0): relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC.
+// CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC

Modified: lld/trunk/test/ELF/x86-64-dyn-rel-error2.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-dyn-rel-error2.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-dyn-rel-error2.s (original)
+++ lld/trunk/test/ELF/x86-64-dyn-rel-error2.s Mon Apr  3 16:36:31 2017
@@ -4,9 +4,11 @@
 // RUN: ld.lld %t2.o -shared -o %t2.so
 // RUN: not ld.lld %t.o %t2.so -o %t 2>&1 | FileCheck %s
 
+// CHECK: relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC
+// CHECK: >>> defined in {{.*}}.so
+// CHECK: >>> referenced by {{.*}}.o:(.data+0x0)
+
         .global _start
 _start:
         .data
         .long bar - .
-
-// CHECK: {{.*}}:(.data+0x0): relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC.

Modified: lld/trunk/test/ELF/x86-64-reloc-32-fpic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-32-fpic.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-32-fpic.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-32-fpic.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,10 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-# CHECK: {{.*}}:(.data+0x0): relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC.
+
+# CHECK: relocation R_X86_64_32 cannot be used against shared object; recompile with -fPIC
+# CHECK: >>> defined in {{.*}}
+# CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
 .data
 .long _shared

Modified: lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s?rev=299390&r1=299389&r2=299390&view=diff
==============================================================================
--- lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s (original)
+++ lld/trunk/test/ELF/x86-64-reloc-pc32-fpic.s Mon Apr  3 16:36:31 2017
@@ -1,7 +1,10 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
 # RUN: not ld.lld -shared %t.o -o %t.so 2>&1 | FileCheck %s
-# CHECK: {{.*}}:(.data+0x1): relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC.
+
+# CHECK: relocation R_X86_64_PC32 cannot be used against shared object; recompile with -fPIC
+# CHECK: >>> defined in {{.*}}
+# CHECK: >>> referenced by {{.*}}:(.data+0x1)
 
 .data
 call _shared




More information about the llvm-commits mailing list