1// This test checks the alignment and padding of the unwind info. 2 3// RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s | llvm-readobj -s -sd -sr -u | FileCheck %s 4 5// CHECK: Sections [ 6// CHECK: Section { 7// CHECK: Name: .xdata 8// CHECK: RawDataSize: 16 9// CHECK: RelocationCount: 1 10// CHECK: Characteristics [ 11// CHECK-NEXT: ALIGN_4BYTES 12// CHECK-NEXT: CNT_INITIALIZED_DATA 13// CHECK-NEXT: MEM_READ 14// CHECK-NEXT: ] 15// CHECK: Relocations [ 16// CHECK-NEXT: [[HandlerDisp:0x[A-F0-9]+]] IMAGE_REL_AMD64_ADDR32NB __C_specific_handler 17// CHECK-NEXT: ] 18// CHECK: SectionData ( 19// CHECK-NEXT: 0000: 19000200 04D002C0 00000000 BEBAFECA 20// CHECK-NEXT: ) 21// CHECK-NEXT: } 22// CHECK-NEXT: Section { 23// CHECK: Name: .pdata 24// CHECK: RawDataSize: 12 25// CHECK: RelocationCount: 3 26// CHECK: Characteristics [ 27// CHECK-NEXT: IMAGE_SCN_ALIGN_4BYTES 28// CHECK-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA 29// CHECK-NEXT: IMAGE_SCN_MEM_READ 30// CHECK-NEXT: ] 31// CHECK: Relocations [ 32// CHECK-NEXT: [[BeginDisp:0x[A-F0-9]+]] IMAGE_REL_AMD64_ADDR32NB func 33// CHECK-NEXT: [[EndDisp:0x[A-F0-9]+]] IMAGE_REL_AMD64_ADDR32NB func 34// CHECK-NEXT: [[UnwindDisp:0x[A-F0-9]+]] IMAGE_REL_AMD64_ADDR32NB .xdata 35// CHECK-NEXT: ] 36// CHECK: SectionData ( 37// CHECK-NEXT: 0000: FCFFFFFF 05000000 00000000 38// CHECK-NEXT: ) 39// CHECK-NEXT: } 40// CHECK-NEXT: ] 41// CHECK: UnwindInformation [ 42// CHECK-NEXT: RuntimeFunction { 43// CHECK-NEXT: StartAddress: func {{(\+0x[A-F0-9]+ )?}}([[BeginDisp]]) 44// CHECK-NEXT: EndAddress: func {{(\+0x[A-F0-9]+ )?}}([[EndDisp]]) 45// CHECK-NEXT: UnwindInfoAddress: .xdata {{(\+0x[A-F0-9]+ )?}}([[UnwindDisp]]) 46// CHECK-NEXT: UnwindInfo { 47// CHECK-NEXT: Version: 1 48// CHECK-NEXT: Flags [ 49// CHECK-NEXT: ExceptionHandler 50// CHECK-NEXT: TerminateHandler 51// CHECK-NEXT: ] 52// CHECK-NEXT: PrologSize: 0 53// CHECK-NEXT: FrameRegister: - 54// CHECK-NEXT: FrameOffset: - 55// CHECK-NEXT: UnwindCodeCount: 2 56// CHECK-NEXT: UnwindCodes [ 57// CHECK-NEXT: 0x04: PUSH_NONVOL reg=R13 58// CHECK-NEXT: 0x02: PUSH_NONVOL reg=R12 59// CHECK-NEXT: ] 60// CHECK-NEXT: Handler: __C_specific_handler ([[HandlerDisp]]) 61// CHECK-NEXT: } 62// CHECK-NEXT: } 63// CHECK-NEXT: ] 64 65// Generates two unwind codes. 66// Requires no padding of the unwind code array. 67 .globl func 68 .def func; .scl 2; .type 32; .endef 69 .seh_proc func 70 push %r12 71 .seh_pushreg 12 72 push %r13 73 .seh_pushreg 13 74 .seh_handler __C_specific_handler, @except, @unwind 75 .seh_handlerdata 76 .long 0xcafebabe 77 .text 78 .seh_endprologue 79func: 80 pop %r13 81 pop %r12 82 ret 83 .seh_endproc 84