[lld] 55e69ec - [ELF] Remove -Wl,-z,notext hint
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 31 12:10:47 PDT 2021
Author: Fangrui Song
Date: 2021-10-31T12:10:43-07:00
New Revision: 55e69ece721dbfb2a34b89cacd565fb2aa7b05a7
URL: https://github.com/llvm/llvm-project/commit/55e69ece721dbfb2a34b89cacd565fb2aa7b05a7
DIFF: https://github.com/llvm/llvm-project/commit/55e69ece721dbfb2a34b89cacd565fb2aa7b05a7.diff
LOG: [ELF] Remove -Wl,-z,notext hint
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
Added:
Modified:
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/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
Removed:
lld/test/ELF/dynamic-reloc-in-ro.s
################################################################################
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index 838626f3da3fa..40159dc75da7b 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -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;
}
diff --git a/lld/test/ELF/aarch64-abs32-dyn.s b/lld/test/ELF/aarch64-abs32-dyn.s
index 085fe15cba105..97dd0d18d7637 100644
--- a/lld/test/ELF/aarch64-abs32-dyn.s
+++ b/lld/test/ELF/aarch64-abs32-dyn.s
@@ -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
diff --git a/lld/test/ELF/aarch64-fpic-abs16.s b/lld/test/ELF/aarch64-fpic-abs16.s
index c180939b7cacb..edc53b3290777 100644
--- a/lld/test/ELF/aarch64-fpic-abs16.s
+++ b/lld/test/ELF/aarch64-fpic-abs16.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-add_abs_lo12_nc.s b/lld/test/ELF/aarch64-fpic-add_abs_lo12_nc.s
index fc58e06b3db38..68b45646dda3c 100644
--- a/lld/test/ELF/aarch64-fpic-add_abs_lo12_nc.s
+++ b/lld/test/ELF/aarch64-fpic-add_abs_lo12_nc.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-adr_prel_lo21.s b/lld/test/ELF/aarch64-fpic-adr_prel_lo21.s
index 4b6f43f1f2268..5d5a5f3d63a79 100644
--- a/lld/test/ELF/aarch64-fpic-adr_prel_lo21.s
+++ b/lld/test/ELF/aarch64-fpic-adr_prel_lo21.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s b/lld/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
index 8be6e5abe9f2e..b2d70f11a8a88 100644
--- a/lld/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
+++ b/lld/test/ELF/aarch64-fpic-adr_prel_pg_hi21.s
@@ -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
diff --git a/lld/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s b/lld/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s
index b68b9f23e4ca4..66723b5e5c1b4 100644
--- a/lld/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s
+++ b/lld/test/ELF/aarch64-fpic-ldst32_abs_lo12_nc.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s b/lld/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s
index 1d5b9439f0f41..27b6ebf2fa041 100644
--- a/lld/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s
+++ b/lld/test/ELF/aarch64-fpic-ldst64_abs_lo12_nc.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s b/lld/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s
index a3f8243a080c3..553693576a3d8 100644
--- a/lld/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s
+++ b/lld/test/ELF/aarch64-fpic-ldst8_abs_lo12_nc.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-prel16.s b/lld/test/ELF/aarch64-fpic-prel16.s
index 1de7f6f633708..4781e39a3049a 100644
--- a/lld/test/ELF/aarch64-fpic-prel16.s
+++ b/lld/test/ELF/aarch64-fpic-prel16.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-prel32.s b/lld/test/ELF/aarch64-fpic-prel32.s
index 0988b26a2b91e..8444a54d66c76 100644
--- a/lld/test/ELF/aarch64-fpic-prel32.s
+++ b/lld/test/ELF/aarch64-fpic-prel32.s
@@ -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)
diff --git a/lld/test/ELF/aarch64-fpic-prel64.s b/lld/test/ELF/aarch64-fpic-prel64.s
index 653f54220334e..70482f692f8a4 100644
--- a/lld/test/ELF/aarch64-fpic-prel64.s
+++ b/lld/test/ELF/aarch64-fpic-prel64.s
@@ -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)
diff --git a/lld/test/ELF/arm-target1.s b/lld/test/ELF/arm-target1.s
index a95adc11d956c..a8eed080155e6 100644
--- a/lld/test/ELF/arm-target1.s
+++ b/lld/test/ELF/arm-target1.s
@@ -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)
diff --git a/lld/test/ELF/copy-in-shared.s b/lld/test/ELF/copy-in-shared.s
index a5508932d035d..2e383e394eecc 100644
--- a/lld/test/ELF/copy-in-shared.s
+++ b/lld/test/ELF/copy-in-shared.s
@@ -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
index 920f1d5fe3490..0000000000000
--- a/lld/test/ELF/dynamic-reloc-in-ro.s
+++ /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
diff --git a/lld/test/ELF/eh-frame-dyn-rel.s b/lld/test/ELF/eh-frame-dyn-rel.s
index f54e62b5eedc5..04828e7b28b40 100644
--- a/lld/test/ELF/eh-frame-dyn-rel.s
+++ b/lld/test/ELF/eh-frame-dyn-rel.s
@@ -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)
diff --git a/lld/test/ELF/linkerscript/symbol-location.s b/lld/test/ELF/linkerscript/symbol-location.s
index 91070d8ec6df9..4620982bf3f20 100644
--- a/lld/test/ELF/linkerscript/symbol-location.s
+++ b/lld/test/ELF/linkerscript/symbol-location.s
@@ -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)
diff --git a/lld/test/ELF/mips-eh_frame-pic.s b/lld/test/ELF/mips-eh_frame-pic.s
index 4ec84a8869547..2d4141143b123 100644
--- a/lld/test/ELF/mips-eh_frame-pic.s
+++ b/lld/test/ELF/mips-eh_frame-pic.s
@@ -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
diff --git a/lld/test/ELF/ppc64-abs32-dyn.s b/lld/test/ELF/ppc64-abs32-dyn.s
index 8bfa0dd686c72..015a6b0f4ed2a 100644
--- a/lld/test/ELF/ppc64-abs32-dyn.s
+++ b/lld/test/ELF/ppc64-abs32-dyn.s
@@ -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
diff --git a/lld/test/ELF/relocation-size-err.s b/lld/test/ELF/relocation-size-err.s
index 8783fe9568da0..31cb5b0da9559 100644
--- a/lld/test/ELF/relocation-size-err.s
+++ b/lld/test/ELF/relocation-size-err.s
@@ -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:
diff --git a/lld/test/ELF/riscv-gp.s b/lld/test/ELF/riscv-gp.s
index e21cc0cc5bcec..3ca29b05b2a66 100644
--- a/lld/test/ELF/riscv-gp.s
+++ b/lld/test/ELF/riscv-gp.s
@@ -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$
diff --git a/lld/test/ELF/riscv-reloc-64-pic.s b/lld/test/ELF/riscv-reloc-64-pic.s
index 224aea93b8005..2c2dc7b9bb893 100644
--- a/lld/test/ELF/riscv-reloc-64-pic.s
+++ b/lld/test/ELF/riscv-reloc-64-pic.s
@@ -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
diff --git a/lld/test/ELF/vs-diagnostics-dynamic-relocation.s b/lld/test/ELF/vs-diagnostics-dynamic-relocation.s
index dec9c7b9b2a66..806ed81c438e3 100644
--- a/lld/test/ELF/vs-diagnostics-dynamic-relocation.s
+++ b/lld/test/ELF/vs-diagnostics-dynamic-relocation.s
@@ -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{{.+}})
diff --git a/lld/test/ELF/x86-64-dyn-rel-error.s b/lld/test/ELF/x86-64-dyn-rel-error.s
index 0b28db6d0b784..6093e4dada9a3 100644
--- a/lld/test/ELF/x86-64-dyn-rel-error.s
+++ b/lld/test/ELF/x86-64-dyn-rel-error.s
@@ -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
diff --git a/lld/test/ELF/x86-64-dyn-rel-error2.s b/lld/test/ELF/x86-64-dyn-rel-error2.s
index b3259395d2453..853e61faef68e 100644
--- a/lld/test/ELF/x86-64-dyn-rel-error2.s
+++ b/lld/test/ELF/x86-64-dyn-rel-error2.s
@@ -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)
diff --git a/lld/test/ELF/x86-64-dyn-rel-error3.s b/lld/test/ELF/x86-64-dyn-rel-error3.s
index 86cef1426df9c..434ed01ef4d6e 100644
--- a/lld/test/ELF/x86-64-dyn-rel-error3.s
+++ b/lld/test/ELF/x86-64-dyn-rel-error3.s
@@ -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
diff --git a/lld/test/ELF/x86-64-dyn-rel-error5.s b/lld/test/ELF/x86-64-dyn-rel-error5.s
index 483aa986ba974..4951045094926 100644
--- a/lld/test/ELF/x86-64-dyn-rel-error5.s
+++ b/lld/test/ELF/x86-64-dyn-rel-error5.s
@@ -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
diff --git a/lld/test/ELF/x86-64-reloc-32.s b/lld/test/ELF/x86-64-reloc-32.s
index e2871914725f7..70a46301ad24a 100644
--- a/lld/test/ELF/x86-64-reloc-32.s
+++ b/lld/test/ELF/x86-64-reloc-32.s
@@ -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)
diff --git a/lld/test/ELF/x86-64-reloc-pc32.s b/lld/test/ELF/x86-64-reloc-pc32.s
index ba66a51b81b49..78bfd8e564881 100644
--- a/lld/test/ELF/x86-64-reloc-pc32.s
+++ b/lld/test/ELF/x86-64-reloc-pc32.s
@@ -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)
diff --git a/lld/test/ELF/znotext-weak-undef.s b/lld/test/ELF/znotext-weak-undef.s
index ad9fb9e2b3379..614cbddd74a8e 100644
--- a/lld/test/ELF/znotext-weak-undef.s
+++ b/lld/test/ELF/znotext-weak-undef.s
@@ -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
diff --git a/lld/test/ELF/ztext.s b/lld/test/ELF/ztext.s
index e06d06baaddcd..11e89e025e060 100644
--- a/lld/test/ELF/ztext.s
+++ b/lld/test/ELF/ztext.s
@@ -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.
More information about the llvm-commits
mailing list