1# REQUIRES: x86 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 5 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 12 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: can't create dynamic relocation 16 17# If the preference is to have text relocations, don't create plt of copy relocations. 18 19# CHECK: DynamicSection [ 20# CHECK: FLAGS TEXTREL 21# CHECK: TEXTREL 0x0 22 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 28# CHECK-NEXT: } 29# CHECK-NEXT: ] 30 31# STATIC: DynamicSection [ 32# STATIC: FLAGS TEXTREL 33# STATIC: TEXTREL 0x0 34 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 39# STATIC-NEXT: } 40# STATIC-NEXT: ] 41 42foo: 43.quad foo 44.quad bar 45.quad zed - . 46