1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1 3# RUN: ld.lld --emit-relocs %t1 -o %t2 4# RUN: llvm-readobj --sections --section-data -r %t2 | FileCheck %s 5 6## Check if we produce proper relocations when doing merging of SHF_MERGE sections. 7 8# CHECK: Section { 9# CHECK: Index: 10# CHECK: Name: .strings 11# CHECK-NEXT: Type: SHT_PROGBITS 12# CHECK-NEXT: Flags [ 13# CHECK-NEXT: SHF_MERGE 14# CHECK-NEXT: SHF_STRINGS 15# CHECK-NEXT: ] 16# CHECK-NEXT: Address: 17# CHECK-NEXT: Offset: 18# CHECK-NEXT: Size: 12 19# CHECK-NEXT: Link: 20# CHECK-NEXT: Info: 21# CHECK-NEXT: AddressAlignment: 22# CHECK-NEXT: EntrySize: 23# CHECK-NEXT: SectionData ( 24# CHECK-NEXT: 0000: 41414100 43434300 42424200 |AAA.CCC.BBB.| 25# CHECK-NEXT: ) 26# CHECK-NEXT: } 27 28# CHECK: Relocations [ 29# CHECK-NEXT: Section {{.*}} .rela.foo { 30# CHECK-NEXT: 0x201120 R_X86_64_64 .strings 0x0 31# CHECK-NEXT: 0x201128 R_X86_64_64 .strings 0x8 32# CHECK-NEXT: 0x201130 R_X86_64_64 .strings 0x8 33# CHECK-NEXT: 0x201138 R_X86_64_64 .strings 0x4 34# CHECK-NEXT: } 35# CHECK-NEXT: ] 36 37.section .strings,"MS",@progbits,1,unique,10 38.Linfo_string0: 39 .asciz "AAA" 40.Linfo_string1: 41 .asciz "BBB" 42 43.section .strings,"MS",@progbits,1,unique,20 44.Linfo_string2: 45 .asciz "BBB" 46.Linfo_string3: 47 .asciz "CCC" 48 49.section .foo,"ax",@progbits 50.quad .Linfo_string0 51.quad .Linfo_string1 52.quad .Linfo_string2 53.quad .Linfo_string3 54