xref: /llvm-project/lld/test/ELF/x86-64-dyn-rel-error5.s (revision 82ed93ea0552c8f82df05859ee93e70b71c4e65d)
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
3# RUN: not ld.lld -pie %t.o -o /dev/null 2>&1 | FileCheck %s
4# RUN: not ld.lld -shared %t.o -o /dev/null 2>&1 | FileCheck %s
5
6## Check we don't create dynamic relocations in a writable section,
7## if the number of bits is smaller than the wordsize.
8
9.globl hidden
10.hidden hidden
11local:
12hidden:
13
14# CHECK: error: relocation R_X86_64_8 cannot be used against local symbol; recompile with -fPIC
15# CHECK-NEXT: >>> defined in {{.*}}.o
16# CHECK-NEXT: >>> referenced by {{.*}}.o:(.data+0x0)
17# CHECK: error: relocation R_X86_64_16 cannot be used against local symbol; recompile with -fPIC
18# CHECK: error: relocation R_X86_64_32 cannot be used against local symbol; recompile with -fPIC
19
20# CHECK: error: relocation R_X86_64_32 cannot be used against symbol 'hidden'; recompile with -fPIC
21
22.data
23.byte local     # R_X86_64_8
24.short local    # R_X86_64_16
25.long local     # R_X86_64_32
26
27.long hidden    # R_X86_64_32
28