1 // RUN: llvm-mc -triple x86_64-apple-darwin -filetype=obj %s -o - | llvm-readobj -sections | FileCheck %s 2 3 // We were trying to generate compact unwind info for assembly like this. 4 // The .cfi_def_cfa directive, however, throws a wrench into that and was 5 // causing an llvm_unreachable() failure. Make sure the assembler can handle 6 // the input. The actual eh_frames created using these directives are checked 7 // elsewhere. This test is a simpler "does the code assemble" check. 8 9 // rdar://15406518 10 11 .macro SaveRegisters 12 13 push %rbp 14 .cfi_def_cfa_offset 16 15 .cfi_offset rbp, -16 16 17 mov %rsp, %rbp 18 .cfi_def_cfa_register rbp 19 20 sub $$0x80+8, %rsp 21 22 movdqa %xmm0, -0x80(%rbp) 23 push %rax 24 movdqa %xmm1, -0x70(%rbp) 25 push %rdi 26 movdqa %xmm2, -0x60(%rbp) 27 push %rsi 28 movdqa %xmm3, -0x50(%rbp) 29 push %rdx 30 movdqa %xmm4, -0x40(%rbp) 31 push %rcx 32 movdqa %xmm5, -0x30(%rbp) 33 push %r8 34 movdqa %xmm6, -0x20(%rbp) 35 push %r9 36 movdqa %xmm7, -0x10(%rbp) 37 38 .endmacro 39 .macro RestoreRegisters 40 41 movdqa -0x80(%rbp), %xmm0 42 pop %r9 43 movdqa -0x70(%rbp), %xmm1 44 pop %r8 45 movdqa -0x60(%rbp), %xmm2 46 pop %rcx 47 movdqa -0x50(%rbp), %xmm3 48 pop %rdx 49 movdqa -0x40(%rbp), %xmm4 50 pop %rsi 51 movdqa -0x30(%rbp), %xmm5 52 pop %rdi 53 movdqa -0x20(%rbp), %xmm6 54 pop %rax 55 movdqa -0x10(%rbp), %xmm7 56 57 leave 58 .cfi_def_cfa rsp, 8 59 .cfi_same_value rbp 60 61 .endmacro 62 63 _foo: 64 .cfi_startproc 65 SaveRegisters 66 67 RestoreRegisters 68 ret 69 .cfi_endproc 70 71 // CHECK: Section { 72 // CHECK: Index: 1 73 // CHECK: Name: __eh_frame (5F 5F 65 68 5F 66 72 61 6D 65 00 00 00 00 00 00) 74 // CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 75 // CHECK: Address: 0x70 76 // CHECK: Size: 0x40 77 // CHECK: Offset: 480 78 // CHECK: Alignment: 3 79 // CHECK: RelocationOffset: 0x0 80 // CHECK: RelocationCount: 0 81 // CHECK: Type: 0xB 82 // CHECK: Attributes [ (0x680000) 83 // CHECK: LiveSupport (0x80000) 84 // CHECK: NoTOC (0x400000) 85 // CHECK: StripStaticSyms (0x200000) 86 // CHECK: ] 87 // CHECK: Reserved1: 0x0 88 // CHECK: Reserved2: 0x0 89 // CHECK: } 90