1# REQUIRES: x86 2 3## On RELA targets, --apply-dynamic-relocs writes addends to the relocated positions. 4 5# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 6# RUN: ld.lld %t.o -o %t.so -shared --apply-dynamic-relocs 7# RUN: llvm-readobj -r -S -l --section-data %t.so | FileCheck -check-prefixes=CHECK,APPLY %s 8 9# RUN: ld.lld %t.o -o %t2.so -shared 10# RUN: llvm-readobj -r -S -l --section-data %t2.so | FileCheck -check-prefixes=CHECK,NOAPPLY %s 11# RUN: ld.lld %t.o -o %t3.so -shared --no-apply-dynamic-relocs 12# RUN: cmp %t2.so %t3.so 13 14# CHECK: Name: .got 15# CHECK: Address: 0x[[GOT:.*]] 16# CHECK: SectionData ( 17# APPLY-NEXT: 0000: 30220000 00000000 | 18# NOAPPLY-NEXT: 0000: 00000000 00000000 | 19# CHECK-NEXT: ) 20 21# CHECK: Relocations [ 22# CHECK-NEXT: Section ({{.*}}) .rela.dyn { 23# CHECK-NEXT: 0x[[GOT]] R_X86_64_RELATIVE - 0x[[ADDEND:.*]] 24# CHECK-NEXT: } 25# CHECK-NEXT: ] 26 27# CHECK: Type: PT_DYNAMIC 28# CHECK-NEXT: Offset: 0x230 29# CHECK-NEXT: VirtualAddress: 0x[[ADDEND]] 30# CHECK-NEXT: PhysicalAddress: 0x[[ADDEND]] 31 32cmpq $0, _DYNAMIC@GOTPCREL(%rip) 33