[ELF] Remove -Wl,-z,notext hint
authorFangrui Song <i@maskray.me>
Sun, 31 Oct 2021 19:10:42 +0000 (12:10 -0700)
committerFangrui Song <i@maskray.me>
Sun, 31 Oct 2021 19:10:43 +0000 (12:10 -0700)
The hint does not pull its weight:

* adding -Wl,-z,notext often won't work (relocation types other than `symbolRel`, e.g. `R_AARCH64_LDST32_ABS_LO12_NC`)
* for pure (no assembly) C/C++ projects, the "-fPIC" hint is sufficient

31 files changed:
lld/ELF/Relocations.cpp
lld/test/ELF/aarch64-abs32-dyn.s
lld/test/ELF/aarch64-fpic-abs16.s
lld/test/ELF/aarch64-fpic-add_abs_lo12_nc.s
lld/test/ELF/aarch64-fpic-adr_prel_lo21.s
lld/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
lld/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s
lld/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s
lld/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s
lld/test/ELF/aarch64-fpic-prel16.s
lld/test/ELF/aarch64-fpic-prel32.s
lld/test/ELF/aarch64-fpic-prel64.s
lld/test/ELF/arm-target1.s
lld/test/ELF/copy-in-shared.s
lld/test/ELF/dynamic-reloc-in-ro.s [deleted file]
lld/test/ELF/eh-frame-dyn-rel.s
lld/test/ELF/linkerscript/symbol-location.s
lld/test/ELF/mips-eh_frame-pic.s
lld/test/ELF/ppc64-abs32-dyn.s
lld/test/ELF/relocation-size-err.s
lld/test/ELF/riscv-gp.s
lld/test/ELF/riscv-reloc-64-pic.s
lld/test/ELF/vs-diagnostics-dynamic-relocation.s
lld/test/ELF/x86-64-dyn-rel-error.s
lld/test/ELF/x86-64-dyn-rel-error2.s
lld/test/ELF/x86-64-dyn-rel-error3.s
lld/test/ELF/x86-64-dyn-rel-error5.s
lld/test/ELF/x86-64-reloc-32.s
lld/test/ELF/x86-64-reloc-pc32.s
lld/test/ELF/znotext-weak-undef.s
lld/test/ELF/ztext.s

index 838626f..40159dc 100644 (file)
@@ -1095,19 +1095,10 @@ static void processRelocAux(InputSectionBase &sec, RelExpr expr, RelType type,
   }
 
   if (config->isPic) {
-    if (!canWrite && !isRelExpr(expr))
-      errorOrWarn(
-          "can't create dynamic relocation " + toString(type) + " against " +
-          (sym.getName().empty() ? "local symbol"
-                                 : "symbol: " + toString(sym)) +
-          " in readonly segment; recompile object files with -fPIC "
-          "or pass '-Wl,-z,notext' to allow text relocations in the output" +
-          getLocation(sec, sym, offset));
-    else
-      errorOrWarn(
-          "relocation " + toString(type) + " cannot be used against " +
-          (sym.getName().empty() ? "local symbol" : "symbol " + toString(sym)) +
-          "; recompile with -fPIC" + getLocation(sec, sym, offset));
+    errorOrWarn("relocation " + toString(type) + " cannot be used against " +
+                (sym.getName().empty() ? "local symbol"
+                                       : "symbol '" + toString(sym) + "'") +
+                "; recompile with -fPIC" + getLocation(sec, sym, offset));
     return;
   }
 
index 085fe15..97dd0d1 100644 (file)
@@ -4,7 +4,7 @@
 
 ## Test we don't create R_AARCH64_RELATIVE.
 
-# CHECK: error: relocation R_AARCH64_ABS32 cannot be used against symbol hidden; recompile with -fPIC
+# CHECK: error: relocation R_AARCH64_ABS32 cannot be used against symbol 'hidden'; recompile with -fPIC
 
 .globl hidden
 .hidden hidden
index c180939..edc53b3 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK:      relocation R_AARCH64_ABS16 cannot be used against symbol foo; recompile with -fPIC
+// CHECK:      relocation R_AARCH64_ABS16 cannot be used against symbol 'foo'; recompile with -fPIC
 // CHECK-NEXT: >>> defined in {{.*}}.o
 // CHECK-NEXT: >>> referenced by {{.*}}.o:(.data+0x0)
 
index fc58e06..68b4564 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: dat in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK: error: relocation R_AARCH64_ADD_ABS_LO12_NC cannot be used against symbol 'dat'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.o
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
index 4b6f43f..5d5a5f3 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: relocation R_AARCH64_ADR_PREL_LO21 cannot be used against symbol dat; recompile with -fPIC
+// CHECK: error: relocation R_AARCH64_ADR_PREL_LO21 cannot be used against symbol 'dat'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.o
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
index 8be6e5a..b2d70f1 100644 (file)
@@ -1,10 +1,10 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol dat; recompile with -fPIC
+// CHECK: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against symbol 'dat'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.o
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
-// CHECK: relocation R_AARCH64_ADR_PREL_PG_HI21_NC cannot be used against symbol dat; recompile with -fPIC
+// CHECK: error: relocation R_AARCH64_ADR_PREL_PG_HI21_NC cannot be used against symbol 'dat'; recompile with -fPIC
 
   adrp x0, dat
   adrp x0, :pg_hi21_nc:dat
index b68b9f2..66723b5 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_LDST32_ABS_LO12_NC against symbol: dat in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK: error: relocation R_AARCH64_LDST32_ABS_LO12_NC cannot be used against symbol 'dat'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.o
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
index 1d5b943..27b6ebf 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_LDST64_ABS_LO12_NC against symbol: dat in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK: error: relocation R_AARCH64_LDST64_ABS_LO12_NC cannot be used against symbol 'dat'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.o
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
index a3f8243..5536935 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_LDST8_ABS_LO12_NC against symbol: dat in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK: error: relocation R_AARCH64_LDST8_ABS_LO12_NC cannot be used against symbol 'dat'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.o
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
index 1de7f6f..4781e39 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: R_AARCH64_PREL16 cannot be used against symbol foo; recompile with -fPIC
+// CHECK: R_AARCH64_PREL16 cannot be used against symbol 'foo'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}
 // CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
index 0988b26..8444a54 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: relocation R_AARCH64_PREL32 cannot be used against symbol foo; recompile with -fPIC
+// CHECK: error: relocation R_AARCH64_PREL32 cannot be used against symbol 'foo'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}
 // CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
index 653f542..70482f6 100644 (file)
@@ -1,7 +1,7 @@
 // REQUIRES: aarch64
 // RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
 // RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: relocation R_AARCH64_PREL64 cannot be used against symbol foo; recompile with -fPIC
+// CHECK: error: relocation R_AARCH64_PREL64 cannot be used against symbol 'foo'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}
 // CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
index a95adc1..a8eed08 100644 (file)
@@ -32,6 +32,6 @@
 // RELATIVE: <$d.0>:
 // RELATIVE:     10150:       04 00 00 00     .word   0x00000004
 
-// ABS: can't create dynamic relocation R_ARM_TARGET1 against symbol: patatino in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// ABS: relocation R_ARM_TARGET1 cannot be used against symbol 'patatino'; recompile with -fPIC
 // ABS: >>> defined in {{.*}}.o
 // ABS: >>> referenced by {{.*}}.o:(.text+0x0)
index a550893..2e383e3 100644 (file)
@@ -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 /dev/null -shared 2>&1 | FileCheck %s
 
-// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK: error: relocation R_X86_64_64 cannot be used against symbol 'foo'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.so
 // CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
 
diff --git a/lld/test/ELF/dynamic-reloc-in-ro.s b/lld/test/ELF/dynamic-reloc-in-ro.s
deleted file mode 100644 (file)
index 920f1d5..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: not ld.lld %t.o -o /dev/null -shared 2>&1 | FileCheck %s
-
-// CHECK:      can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
-// CHECK-NEXT: >>> defined in {{.*}}.o
-// CHECK-NEXT: >>> referenced by {{.*}}.o:(.text+0x0)
-
-foo:
-.quad foo
index f54e62b..04828e7 100644 (file)
@@ -2,7 +2,7 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: not ld.lld %t.o %t.o -o /dev/null -shared 2>&1 | FileCheck %s
 
-// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK: error: relocation R_X86_64_64 cannot be used against symbol 'foo'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.o
 // CHECK: >>> referenced by {{.*}}.o:(.eh_frame+0x12)
 
index 91070d8..4620982 100644 (file)
@@ -5,7 +5,7 @@
 
 ## Here we check that symbol 'foo' location is reported properly.
 
-# CHECK: error: relocation R_X86_64_PC32 cannot be used against symbol foo
+# CHECK: error: relocation R_X86_64_PC32 cannot be used against symbol 'foo'
 # CHECK: >>> defined in {{.*}}.script:1
 # CHECK: >>> referenced by {{.*}}.o:(.text+0x1)
 
index 4ec84a8..2d41411 100644 (file)
@@ -10,7 +10,7 @@
 # RUN: not ld.lld -shared %t-nopic.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=NOPIC-ERR
 ## Note: ld.bfd can link this file because it rewrites the .eh_frame section to use
 ## relative addressing.
-# NOPIC-ERR: ld.lld: error: can't create dynamic relocation R_MIPS_64 against local symbol in readonly segment
+# NOPIC-ERR: ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol
 
 ## For -fPIC, .eh_frame should contain DW_EH_PE_pcrel | DW_EH_PE_sdata4 values:
 # RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux --position-independent %s -o %t-pic.o
@@ -25,7 +25,7 @@
 # RUN: not ld.lld -shared %t-nopic32.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=NOPIC32-ERR
 ## Note: ld.bfd can link this file because it rewrites the .eh_frame section to use
 ## relative addressing.
-# NOPIC32-ERR: ld.lld: error: can't create dynamic relocation R_MIPS_32 against local symbol in readonly segment
+# NOPIC32-ERR: ld.lld: error: relocation R_MIPS_32 cannot be used against local symbol
 
 ## For -fPIC, .eh_frame should contain DW_EH_PE_pcrel | DW_EH_PE_sdata4 values:
 # RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux --position-independent %s -o %t-pic32.o
index 8bfa0dd..015a6b0 100644 (file)
@@ -4,7 +4,7 @@
 
 ## Test we don't create R_AARCH64_RELATIVE.
 
-# CHECK: error: relocation R_PPC64_ADDR32 cannot be used against symbol hidden; recompile with -fPIC
+# CHECK: error: relocation R_PPC64_ADDR32 cannot be used against symbol 'hidden'; recompile with -fPIC
 
 .globl hidden
 .hidden hidden
index 8783fe9..31cb5b0 100644 (file)
@@ -2,7 +2,7 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: not ld.lld %t.o -o /dev/null -shared 2>&1 | FileCheck %s
 
-// CHECK:  error: can't create dynamic relocation R_X86_64_SIZE64 against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK:  error: relocation R_X86_64_SIZE64 cannot be used against symbol 'foo'; recompile with -fPIC
 
         .global foo
 foo:
index e21cc0c..3ca29b0 100644 (file)
@@ -22,7 +22,7 @@
 # DIS:      1000: auipc gp, 3
 # DIS-NEXT:       addi gp, gp, -2048
 
-# ERR: error: relocation R_RISCV_PCREL_HI20 cannot be used against symbol __global_pointer$; recompile with -fPIC
+# ERR: error: relocation R_RISCV_PCREL_HI20 cannot be used against symbol '__global_pointer$'; recompile with -fPIC
 
 lla gp, __global_pointer$
 
index 224aea9..2c2dc7b 100644 (file)
@@ -2,7 +2,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv64 %s -o %t.o
 # RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
 
-# CHECK: error: relocation R_RISCV_32 cannot be used against symbol a
+# CHECK: error: relocation R_RISCV_32 cannot be used against symbol 'a'
 
 .globl a
 
index dec9c7b..806ed81 100644 (file)
@@ -2,12 +2,12 @@
 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 // RUN: not ld.lld -shared --vs-diagnostics %t.o -o /dev/null 2>&1 | FileCheck %s
 
-// CHECK: dyn.s(15): error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+// CHECK: dyn.s(15): error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
 // CHECK-NEXT: >>> defined in {{.*}}.o
 // CHECK-NEXT: >>> referenced by dyn.s:15
 // CHECK-NEXT: >>>{{.*}}.o:(.text+0x{{.+}})
 
-// CHECK: /tmp{{/|\\}}dyn.s(20): error: can't create dynamic relocation {{.*}}
+// CHECK: /tmp{{/|\\}}dyn.s(20): error: relocation R_X86_64_64 cannot be used against local symbol; recompile with -fPIC
 // CHECK-NEXT: >>> defined in {{.*}}.o
 // CHECK-NEXT: >>> referenced by dyn.s:20 (/tmp{{/|\\}}dyn.s:20)
 // CHECK-NEXT: >>>{{.*}}.o:(.text+0x{{.+}})
index 0b28db6..6093e4d 100644 (file)
@@ -9,7 +9,7 @@ _start:
         .data
         .long zed
 
-// CHECK: relocation R_X86_64_32 cannot be used against symbol zed; recompile with -fPIC
+// CHECK: error: relocation R_X86_64_32 cannot be used against symbol 'zed'; recompile with -fPIC
 
 // RUN: ld.lld --noinhibit-exec %t.o %t2.so -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
 // RUN: not ld.lld --export-dynamic --unresolved-symbols=ignore-all %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=WARN %s
index b325939..853e61f 100644 (file)
@@ -4,7 +4,7 @@
 // RUN: ld.lld %t2.o -shared -o %t2.so
 // RUN: not ld.lld -shared %t.o %t2.so -o /dev/null 2>&1 | FileCheck %s
 
-// CHECK: relocation R_X86_64_PC32 cannot be used against symbol zed; recompile with -fPIC
+// CHECK: error: relocation R_X86_64_PC32 cannot be used against symbol 'zed'; recompile with -fPIC
 // CHECK: >>> defined in {{.*}}.so
 // CHECK: >>> referenced by {{.*}}.o:(.data+0x0)
 
index 86cef14..434ed01 100644 (file)
@@ -2,10 +2,10 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: not ld.lld %t.o -shared -o /dev/null 2>&1 | FileCheck %s
 
-# CHECK: relocation R_X86_64_8 cannot be used against symbol foo; recompile with -fPIC
-# CHECK: relocation R_X86_64_16 cannot be used against symbol foo; recompile with -fPIC
-# CHECK: relocation R_X86_64_PC8 cannot be used against symbol foo; recompile with -fPIC
-# CHECK: relocation R_X86_64_PC16 cannot be used against symbol foo; recompile with -fPIC
+# CHECK: error: relocation R_X86_64_8 cannot be used against symbol 'foo'; recompile with -fPIC
+# CHECK: error: relocation R_X86_64_16 cannot be used against symbol 'foo'; recompile with -fPIC
+# CHECK: error: relocation R_X86_64_PC8 cannot be used against symbol 'foo'; recompile with -fPIC
+# CHECK: error: relocation R_X86_64_PC16 cannot be used against symbol 'foo'; recompile with -fPIC
 
 .global foo
 
index 483aa98..4951045 100644 (file)
@@ -18,7 +18,7 @@ hidden:
 # CHECK: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
 
 # PIE: error: cannot preempt symbol: hidden
-# SHARED: error: relocation R_X86_64_32 cannot be used against symbol hidden; recompile with -fPIC
+# SHARED: error: relocation R_X86_64_32 cannot be used against symbol 'hidden'; recompile with -fPIC
 
 .data
 .byte local     # R_X86_64_8
index e287191..70a4630 100644 (file)
@@ -5,7 +5,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t/shared.s -o %t/shared.o
 # RUN: not ld.lld -shared %t/shared.o -o /dev/null 2>&1 | FileCheck %s
 
-# CHECK: relocation R_X86_64_32 cannot be used against symbol _shared; recompile with -fPIC
+# CHECK: error: relocation R_X86_64_32 cannot be used against symbol '_shared'; recompile with -fPIC
 # CHECK: >>> defined in {{.*}}
 # CHECK: >>> referenced by {{.*}}:(.data+0x0)
 
index ba66a51..78bfd8e 100644 (file)
@@ -5,7 +5,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t/shared.s -o %t/shared.o
 # RUN: not ld.lld -shared %t/shared.o -o /dev/null 2>&1 | FileCheck %s
 
-# CHECK: relocation R_X86_64_PC32 cannot be used against symbol _shared; recompile with -fPIC
+# CHECK: error: relocation R_X86_64_PC32 cannot be used against symbol '_shared'; recompile with -fPIC
 # CHECK: >>> defined in {{.*}}
 # CHECK: >>> referenced by {{.*}}:(.data+0x1)
 
index ad9fb9e..614cbdd 100644 (file)
@@ -1,7 +1,7 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
 # RUN: not ld.lld -z notext -shared %t.o -o /dev/null 2>&1 | FileCheck %s
-# CHECK: relocation R_X86_64_32 cannot be used against symbol foo; recompile with -fPIC
+# CHECK: error: relocation R_X86_64_32 cannot be used against symbol 'foo'; recompile with -fPIC
 
 # RUN: ld.lld -z notext %t.o -o %t
 # RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=EXE
index e06d06b..11e89e0 100644 (file)
@@ -12,7 +12,7 @@
 
 # RUN: not ld.lld %t.o %t2.so -o /dev/null -shared 2>&1 | FileCheck --check-prefix=ERR %s
 # RUN: not ld.lld -z text %t.o %t2.so -o /dev/null -shared 2>&1 | FileCheck --check-prefix=ERR %s
-# ERR: error: can't create dynamic relocation
+# ERR: error: relocation R_X86_64_64 cannot be used against symbol 'bar'; recompile with -fPIC
 
 # If the preference is to have text relocations, don't create plt of copy relocations.