1// REQUIRES: x86 2 3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 4// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy.s -o %t2.o 5// RUN: ld.lld %t2.o -o %t2.so -shared -soname=so 6// RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t.exe 7// RUN: llvm-readobj -S --section-data -r %t.exe | FileCheck %s 8 9// Copy relocate x in a non-writable position. 10 .global _start 11_start: 12 .quad x 13 14// Resolved to 0 in a non-alloc section. 15 .section foo 16 .quad y 17 18// Produce a dynamic relocation in a writable position. 19 .section bar, "aw" 20 .quad z 21 22// CHECK: Name: .text 23// CHECK: SectionData ( 24// CHECK-NEXT: 0000: 90332000 25// CHECK-NEXT: ) 26 27// CHECK: Name: bar 28// CHECK-NEXT: Type: SHT_PROGBITS 29// CHECK-NEXT: Flags [ 30// CHECK-NEXT: SHF_ALLOC 31// CHECK-NEXT: SHF_WRITE 32// CHECK-NEXT: ] 33// CHECK-NEXT: Address: 0x203380 34// CHECK-NEXT: Offset: 0x380 35// CHECK-NEXT: Size: 8 36// CHECK-NEXT: Link: 0 37// CHECK-NEXT: Info: 0 38// CHECK-NEXT: AddressAlignment: 1 39// CHECK-NEXT: EntrySize: 0 40// CHECK-NEXT: SectionData ( 41// CHECK-NEXT: 0000: 00000000 42// CHECK-NEXT: ) 43 44// CHECK: Name: foo 45// CHECK-NEXT: Type: SHT_PROGBITS 46// CHECK-NEXT: Flags [ 47// CHECK-NEXT: ] 48// CHECK-NEXT: Address: 0x0 49// CHECK-NEXT: Offset: 0x388 50// CHECK-NEXT: Size: 8 51// CHECK-NEXT: Link: 0 52// CHECK-NEXT: Info: 0 53// CHECK-NEXT: AddressAlignment: 1 54// CHECK-NEXT: EntrySize: 0 55// CHECK-NEXT: SectionData ( 56// CHECK-NEXT: 0000: 00000000 57// CHECK-NEXT: ) 58 59// CHECK: Relocations [ 60// CHECK-NEXT: Section (4) .rela.dyn { 61// CHECK-NEXT: 0x203390 R_X86_64_COPY x 0x0 62// CHECK-NEXT: 0x203380 R_X86_64_64 z 0x0 63// CHECK-NEXT: } 64// CHECK-NEXT: ] 65