2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/ztext.s -o %t2.o
4 # RUN: ld.lld %t2.o -o %t2.so -shared -soname=so
6 # RUN: ld.lld -z notext %t.o %t2.so -o %t -shared
7 # RUN: llvm-readobj --dynamic-table -r %t | FileCheck %s
8 # RUN: ld.lld -z notext %t.o %t2.so -o %t2 -pie
9 # RUN: llvm-readobj --dynamic-table -r %t2 | FileCheck %s
10 # RUN: ld.lld -z notext %t.o %t2.so -o %t3
11 # RUN: llvm-readobj --dynamic-table -r %t3 | FileCheck --check-prefix=STATIC %s
13 # RUN: not ld.lld %t.o %t2.so -o /dev/null -shared 2>&1 | FileCheck --check-prefix=ERR %s
14 # RUN: not ld.lld -z text %t.o %t2.so -o /dev/null -shared 2>&1 | FileCheck --check-prefix=ERR %s
15 # ERR: error: relocation R_X86_64_64 cannot be used against symbol 'bar'; recompile with -fPIC
17 # If the preference is to have text relocations, don't create plt of copy relocations.
19 # CHECK: DynamicSection [
20 # CHECK: FLAGS TEXTREL
23 # CHECK: Relocations [
24 # CHECK-NEXT: Section {{.*}} .rela.dyn {
25 # CHECK-NEXT: 0x12A0 R_X86_64_RELATIVE - 0x12A0
26 # CHECK-NEXT: 0x12A8 R_X86_64_64 bar 0x0
27 # CHECK-NEXT: 0x12B0 R_X86_64_PC64 zed 0x0
31 # STATIC: DynamicSection [
32 # STATIC: FLAGS TEXTREL
35 # STATIC: Relocations [
36 # STATIC-NEXT: Section {{.*}} .rela.dyn {
37 # STATIC-NEXT: 0x201290 R_X86_64_64 bar 0x0
38 # STATIC-NEXT: 0x201298 R_X86_64_PC64 zed 0x0