1// REQUIRES: x86 2 3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t 4// RUN: ld.lld %t -o %t2 -shared --apply-dynamic-relocs 5// RUN: llvm-readobj -S --section-data -r %t2 | FileCheck -check-prefix CHECK -check-prefix APPLYDYNREL %s 6 7// RUN: ld.lld %t -o %t2 -shared 8// RUN: llvm-readobj -S --section-data -r %t2 | FileCheck -check-prefix CHECK -check-prefix NOAPPLYDYNREL %s 9// RUN: ld.lld %t -o %t2 -shared --no-apply-dynamic-relocs 10// RUN: llvm-readobj -S --section-data -r %t2 | FileCheck -check-prefix CHECK -check-prefix NOAPPLYDYNREL %s 11 12// APPLYDYNREL: Name: .data 13// APPLYDYNREL-NEXT: Type: SHT_PROGBITS 14// APPLYDYNREL-NEXT: Flags [ 15// APPLYDYNREL-NEXT: SHF_ALLOC 16// APPLYDYNREL-NEXT: SHF_WRITE 17// APPLYDYNREL-NEXT: ] 18// APPLYDYNREL-NEXT: Address: 0x3350 19// APPLYDYNREL-NEXT: Offset: 0x350 20// APPLYDYNREL-NEXT: Size: 16 21// APPLYDYNREL-NEXT: Link: 0 22// APPLYDYNREL-NEXT: Info: 0 23// APPLYDYNREL-NEXT: AddressAlignment: 1 24// APPLYDYNREL-NEXT: EntrySize: 0 25// APPLYDYNREL-NEXT: SectionData ( 26// APPLYDYNREL-NEXT: 0000: 50330000 00000000 00000000 00000000 27// APPLYDYNREL-NEXT: ) 28 29// NOAPPLYDYNREL: Name: .data 30// NOAPPLYDYNREL-NEXT: Type: SHT_PROGBITS 31// NOAPPLYDYNREL-NEXT: Flags [ 32// NOAPPLYDYNREL-NEXT: SHF_ALLOC 33// NOAPPLYDYNREL-NEXT: SHF_WRITE 34// NOAPPLYDYNREL-NEXT: ] 35// NOAPPLYDYNREL-NEXT: Address: 0x3350 36// NOAPPLYDYNREL-NEXT: Offset: 0x350 37// NOAPPLYDYNREL-NEXT: Size: 16 38// NOAPPLYDYNREL-NEXT: Link: 0 39// NOAPPLYDYNREL-NEXT: Info: 0 40// NOAPPLYDYNREL-NEXT: AddressAlignment: 1 41// NOAPPLYDYNREL-NEXT: EntrySize: 0 42// NOAPPLYDYNREL-NEXT: SectionData ( 43// NOAPPLYDYNREL-NEXT: 0000: 00000000 00000000 00000000 00000000 44// NOAPPLYDYNREL-NEXT: ) 45 46// CHECK: Name: foo 47// CHECK-NEXT: Type: SHT_PROGBITS 48// CHECK-NEXT: Flags [ 49// CHECK-NEXT: ] 50// CHECK-NEXT: Address: 0x0 51// CHECK-NEXT: Offset: 52// CHECK-NEXT: Size: 32 53// CHECK-NEXT: Link: 0 54// CHECK-NEXT: Info: 0 55// CHECK-NEXT: AddressAlignment: 1 56// CHECK-NEXT: EntrySize: 0 57// CHECK-NEXT: SectionData ( 58// CHECK-NEXT: 0000: 50330000 00000000 50330000 00000000 59// CHECK-NEXT: 0010: 50330000 00000000 50330000 00000000 60// CHECK-NEXT: ) 61 62// CHECK: Relocations [ 63// CHECK-NEXT: Section ({{.}}) .rela.dyn { 64// CHECK-NEXT: 0x3350 R_X86_64_RELATIVE - 0x3350 65// CHECK-NEXT: 0x3358 R_X86_64_64 zed 0x0 66// CHECK-NEXT: } 67// CHECK-NEXT: ] 68 69.data 70 .global zed 71zed: 72bar: 73 .quad bar 74 .quad zed 75 76 .section foo 77 .quad bar 78 .quad zed 79 80 .section foo 81 .quad bar 82 .quad zed 83