1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3// RUN: ld.lld --hash-style=sysv %t.o %t.o -o %t -shared
4// RUN: llvm-readobj -S --section-data %t | FileCheck %s
5
6/// Also show that the merging happens when going via a -r link.
7// RUN: ld.lld -r %t.o %t.o -o %t.r.o
8// RUN: ld.lld --hash-style=sysv %t.r.o -o %t2 -shared
9// RUN: llvm-readobj -S --section-data %t2 | FileCheck %s
10
11        .section	foo,"ax",@progbits
12	.cfi_startproc
13        nop
14	.cfi_endproc
15
16        .section	bar,"axG",@progbits,foo,comdat
17        .cfi_startproc
18        nop
19        nop
20	.cfi_endproc
21
22// FIXME: We could really use a .eh_frame parser.
23// The intention is to show that:
24// * There is only one copy of the CIE
25// * There are two copies of the first FDE
26// * There is only one copy of the second FDE
27
28// CHECK:      Name: .eh_frame
29// CHECK-NEXT: Type: SHT_PROGBITS
30// CHECK-NEXT: Flags [
31// CHECK-NEXT:   SHF_ALLOC
32// CHECK-NEXT: ]
33// CHECK-NEXT: Address:
34// CHECK-NEXT: Offset:
35// CHECK-NEXT: Size: 100
36// CHECK-NEXT: Link: 0
37// CHECK-NEXT: Info: 0
38// CHECK-NEXT: AddressAlignment: 8
39// CHECK-NEXT: EntrySize: 0
40// CHECK-NEXT: SectionData (
41// CHECK-NEXT: 0000: 14000000 00000000 017A5200 01781001  |
42// CHECK-NEXT: 0010: 1B0C0708 90010000 14000000 1C000000  |
43// CHECK-NEXT: 0020: 44100000 01000000 00000000 00000000  |
44// CHECK-NEXT: 0030: 14000000 34000000 2E100000 02000000  |
45// CHECK-NEXT: 0040: 00000000 00000000 14000000 4C000000  |
46// CHECK-NEXT: 0050: 15100000 01000000 00000000 00000000  |
47// CHECK-NEXT: 0060: 00000000
48// CHECK-NEXT: )
49
50// CHECK:      Name: foo
51// CHECK-NEXT: Type: SHT_PROGBITS
52// CHECK-NEXT: Flags [
53// CHECK-NEXT:   SHF_ALLOC
54// CHECK-NEXT:   SHF_EXECINSTR
55// CHECK-NEXT: ]
56// CHECK-NEXT: Address: 0x125C
57
58// CHECK:      Name: bar
59// CHECK-NEXT: Type: SHT_PROGBITS
60// CHECK-NEXT: Flags [
61// CHECK-NEXT:   SHF_ALLOC
62// CHECK-NEXT:   SHF_EXECINSTR
63// CHECK-NEXT: ]
64// CHECK-NEXT: Address: 0x125E
65