From: Fangrui Song Date: Sun, 31 Oct 2021 19:10:42 +0000 (-0700) Subject: [ELF] Remove -Wl,-z,notext hint X-Git-Tag: upstream/15.0.7~27084 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55e69ece721dbfb2a34b89cacd565fb2aa7b05a7;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 838626f..40159dc 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 085fe15..97dd0d1 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 c180939..edc53b3 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 fc58e06..68b4564 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 4b6f43f..5d5a5f3 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 8be6e5a..b2d70f11 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 b68b9f2..66723b5 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 1d5b943..27b6ebf 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 a3f8243..5536935 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 1de7f6f..4781e39 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 0988b26..8444a54 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 653f542..70482f6 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 a95adc1..a8eed08 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 a550893..2e383e3 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 920f1d5..0000000 --- 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 f54e62b..04828e7b 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 91070d8..4620982 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 4ec84a8..2d41411 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 8bfa0dd..015a6b0 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 8783fe9..31cb5b0 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 e21cc0c..3ca29b0 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 224aea9..2c2dc7b 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 dec9c7b..806ed81 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 0b28db6..6093e4d 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 b325939..853e61f 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 86cef14..434ed01 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 483aa98..4951045 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 e287191..70a4630 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 ba66a51..78bfd8e 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 ad9fb9e..614cbdd 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 e06d06b..11e89e0 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.