[lld] r327584 - Update Error Message
Rumeet Dhindsa via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 14 15:05:12 PDT 2018
Author: rdhindsa
Date: Wed Mar 14 15:05:12 2018
New Revision: 327584
URL: http://llvm.org/viewvc/llvm-project?rev=327584&view=rev
Log:
Update Error Message
Summary: Updates error message for dynamic relocation attempt for read only segments.
Reviewers: ruiu
Reviewed By: ruiu
Subscribers: emaste, javed.absar, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D44453
Modified:
lld/trunk/ELF/Relocations.cpp
lld/trunk/test/ELF/aarch64-fpic-add_abs_lo12_nc.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/arm-target1.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/got32-i386.s
lld/trunk/test/ELF/got32x-i386.s
lld/trunk/test/ELF/relocation-size-err.s
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Mar 14 15:05:12 2018
@@ -814,7 +814,8 @@ static RelExpr processRelocAux(InputSect
error(
"can't create dynamic relocation " + toString(Type) + " against " +
(Sym.getName().empty() ? "local symbol" : "symbol: " + toString(Sym)) +
- " in readonly segment; recompile object files with -fPIC" +
+ " in readonly segment; recompile object files with -fPIC "
+ "or pass '-Wl,-z,notext' to allow text relocations in the output" +
getLocation(Sec, Sym, Offset));
return Expr;
}
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=327584&r1=327583&r2=327584&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 Wed Mar 14 15:05:12 2018
@@ -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 %t.so 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC against symbol: dat
+// 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: >>> defined in {{.*}}.o
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
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=327584&r1=327583&r2=327584&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 Wed Mar 14 15:05:12 2018
@@ -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 %t.so 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_LDST32_ABS_LO12_NC against symbol: dat
+// 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: >>> defined in {{.*}}.o
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
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=327584&r1=327583&r2=327584&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 Wed Mar 14 15:05:12 2018
@@ -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 %t.so 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_LDST64_ABS_LO12_NC against symbol: dat
+// 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: >>> defined in {{.*}}.o
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
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=327584&r1=327583&r2=327584&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 Wed Mar 14 15:05:12 2018
@@ -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 %t.so 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_AARCH64_LDST8_ABS_LO12_NC against symbol: dat
+// 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: >>> defined in {{.*}}.o
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
Modified: lld/trunk/test/ELF/arm-target1.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/arm-target1.s?rev=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/arm-target1.s (original)
+++ lld/trunk/test/ELF/arm-target1.s Wed Mar 14 15:05:12 2018
@@ -31,6 +31,6 @@
// RELATIVE: SYMBOL TABLE:
// RELATIVE: 00001004 .text 00000000 patatino
-// ABS: can't create dynamic relocation R_ARM_TARGET1 against symbol: patatino
+// 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: >>> defined in {{.*}}.o
// ABS: >>> referenced by {{.*}}.o:(.text+0x0)
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=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-in-shared.s (original)
+++ lld/trunk/test/ELF/copy-in-shared.s Wed Mar 14 15:05:12 2018
@@ -4,7 +4,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o
// RUN: not ld.lld %t2.o %t1.so -o %t2.so -shared 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo in readonly segment
+// 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: >>> defined in {{.*}}.so
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
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=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/copy-rel-pie-error.s (original)
+++ lld/trunk/test/ELF/copy-rel-pie-error.s Wed Mar 14 15:05:12 2018
@@ -3,11 +3,11 @@
// 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: can't create dynamic relocation R_X86_64_64 against symbol: bar
+// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: bar in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
// CHECK: >>> defined in {{.*}}.so
// CHECK: >>> referenced by {{.*}}.o:(.text+0x0)
-// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo
+// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
// CHECK: >>> defined in {{.*}}.so
// CHECK: >>> referenced by {{.*}}.o:(.text+0x8)
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=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/dynamic-reloc-in-ro.s (original)
+++ lld/trunk/test/ELF/dynamic-reloc-in-ro.s Wed Mar 14 15:05:12 2018
@@ -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 %t.so -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
+// 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)
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=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/eh-frame-dyn-rel.s (original)
+++ lld/trunk/test/ELF/eh-frame-dyn-rel.s Wed Mar 14 15:05:12 2018
@@ -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 %t -shared 2>&1 | FileCheck %s
-// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo
+// CHECK: can't create dynamic relocation R_X86_64_64 against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
// CHECK: >>> defined in {{.*}}.o
// CHECK: >>> referenced by {{.*}}.o:(.eh_frame+0x12)
Modified: lld/trunk/test/ELF/got32-i386.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/got32-i386.s?rev=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/got32-i386.s (original)
+++ lld/trunk/test/ELF/got32-i386.s Wed Mar 14 15:05:12 2018
@@ -20,4 +20,4 @@ _start:
# CHECK: .got 00000004 0000000000012000
# RUN: not ld.lld %t.o -o %t -pie 2>&1 | FileCheck %s --check-prefix=ERR
-# ERR: error: can't create dynamic relocation R_386_GOT32 against symbol: foo in readonly segment; recompile object files with -fPIC
+# ERR: error: can't create dynamic relocation R_386_GOT32 against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
Modified: lld/trunk/test/ELF/got32x-i386.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/got32x-i386.s?rev=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/got32x-i386.s (original)
+++ lld/trunk/test/ELF/got32x-i386.s Wed Mar 14 15:05:12 2018
@@ -43,5 +43,5 @@
# RUN: not ld.lld %S/Inputs/i386-got32x-baseless.elf -o %t1 -pie 2>&1 | \
# RUN: FileCheck %s --check-prefix=ERR
-# ERR: error: can't create dynamic relocation R_386_GOT32X against symbol: foo in readonly segment; recompile object files with -fPIC
-# ERR: error: can't create dynamic relocation R_386_GOT32X against symbol: foo in readonly segment; recompile object files with -fPIC
+# ERR: error: can't create dynamic relocation R_386_GOT32X against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
+# ERR: error: can't create dynamic relocation R_386_GOT32X against symbol: foo in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
Modified: lld/trunk/test/ELF/relocation-size-err.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocation-size-err.s?rev=327584&r1=327583&r2=327584&view=diff
==============================================================================
--- lld/trunk/test/ELF/relocation-size-err.s (original)
+++ lld/trunk/test/ELF/relocation-size-err.s Wed Mar 14 15:05:12 2018
@@ -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 %t.so -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
+// 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
.global foo
foo:
More information about the llvm-commits
mailing list