1cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// RUN: llvm-mc -triple i386-apple-darwin %s -filetype=obj -o - | llvm-readobj -s -sd -r | FileCheck %s
2e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola
35fbe5e783ee0c5ae27c17490a752d7e603e84ed2Evan Cheng// Make sure MC can handle file level .cfi_startproc and .cfi_endproc that creates
45fbe5e783ee0c5ae27c17490a752d7e603e84ed2Evan Cheng// an empty frame.
55fbe5e783ee0c5ae27c17490a752d7e603e84ed2Evan Cheng// rdar://10017184
6dce4a407a24b04eebc6a376f8e62b41aaa7b071fStephen Hines_proc:
75fbe5e783ee0c5ae27c17490a752d7e603e84ed2Evan Cheng.cfi_startproc
85fbe5e783ee0c5ae27c17490a752d7e603e84ed2Evan Cheng.cfi_endproc
95fbe5e783ee0c5ae27c17490a752d7e603e84ed2Evan Cheng
10e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola// Check that we don't produce a relocation for the CIE pointer and therefore
11e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola// we have only one relocation in __debug_frame.
12e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola
13e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	.section	__TEXT,__text,regular,pure_instructions
14e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	.globl	_f
15e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	.align	4, 0x90
16e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola_f:                                     ## @f
17e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael EspindolaLtmp0:
18e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	.cfi_startproc
19e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola## BB#0:                                ## %entry
20e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	movl	$42, %eax
21e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	ret
22e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael EspindolaLtmp1:
23e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	.cfi_endproc
24e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael EspindolaLeh_func_end0:
25e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola
26e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola	.cfi_sections .debug_frame
27e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael EspindolaLtext_end:
28e3a0e987f3d4f07512cdb64b9034369f966cb448Rafael Espindola
29cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Section {
30cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Index: 1
31cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Name: __debug_frame (5F 5F 64 65 62 75 67 5F 66 72 61 6D 65 00 00 00)
32cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Segment: __DWARF (5F 5F 44 57 41 52 46 00 00 00 00 00 00 00 00 00)
33cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Address: 0x8
34cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Size: 0x34
35cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Offset: 332
36cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Alignment: 2
37cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     RelocationOffset: 0x180
38cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     RelocationCount: 2
39cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Type: 0x0
40cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Attributes [ (0x20000)
41cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:       Debug (0x20000)
42cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     ]
43cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Reserved1: 0x0
44cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     Reserved2: 0x0
45cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     SectionData (
46cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:       0000: 10000000 FFFFFFFF 04000400 017C080C  |.............|..|
47cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:       0010: 04048801 0C000000 00000000 00000000  |................|
48cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:       0020: 00000000 0C000000 00000000 00000000  |................|
49cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:       0030: 06000000                             |....|
50cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     )
51cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:   }
52cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ]
53cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Relocations [
54cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:   Section __debug_frame {
55cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     0x2C 0 2 0 GENERIC_RELOC_VANILLA 0 __text
56cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:     0x1C 0 2 0 GENERIC_RELOC_VANILLA 0 __text
57cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK:   }
58cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ]
59