Home | History | Annotate | Download | only in COFF
      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: 8
      9 // CHECK:          RelocationCount: 0
     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:     ]
     17 // CHECK:          SectionData (
     18 // CHECK-NEXT:       0000: 01000000 00000000
     19 // CHECK-NEXT:     )
     20 // CHECK-NEXT:   }
     21 // CHECK:        Section {
     22 // CHECK:          Name: .pdata
     23 // CHECK:          RawDataSize: 12
     24 // CHECK:          RelocationCount: 3
     25 // CHECK:          Characteristics [
     26 // CHECK-NEXT:       IMAGE_SCN_ALIGN_4BYTES
     27 // CHECK-NEXT:       IMAGE_SCN_CNT_INITIALIZED_DATA
     28 // CHECK-NEXT:       IMAGE_SCN_MEM_READ
     29 // CHECK-NEXT:     ]
     30 // CHECK:          Relocations [
     31 // CHECK-NEXT:       [[BeginDisp:0x[A-F0-9]+]] IMAGE_REL_AMD64_ADDR32NB smallFunc
     32 // CHECK-NEXT:       [[EndDisp:0x[A-F0-9]+]] IMAGE_REL_AMD64_ADDR32NB smallFunc
     33 // CHECK-NEXT:       [[UnwindDisp:0x[A-F0-9]+]] IMAGE_REL_AMD64_ADDR32NB .xdata
     34 // CHECK-NEXT:     ]
     35 // CHECK:          SectionData (
     36 // CHECK-NEXT:       0000: 00000000 01000000 00000000
     37 // CHECK-NEXT:     )
     38 // CHECK-NEXT:   }
     39 // CHECK:        UnwindInformation [
     40 // CHECK-NEXT:     RuntimeFunction {
     41 // CHECK-NEXT:     StartAddress: smallFunc {{(\+0x[A-F0-9]+ )?}}([[BeginDisp]])
     42 // CHECK-NEXT:     EndAddress: smallFunc {{(\+0x[A-F0-9]+ )?}}([[EndDisp]])
     43 // CHECK-NEXT:     UnwindInfoAddress: .xdata {{(\+0x[A-F0-9]+ )?}}([[UnwindDisp]])
     44 // CHECK-NEXT:     UnwindInfo {
     45 // CHECK-NEXT:       Version: 1
     46 // CHECK-NEXT:       Flags [
     47 // CHECK-NEXT:       ]
     48 // CHECK-NEXT:       PrologSize: 0
     49 // CHECK-NEXT:       FrameRegister: -
     50 // CHECK-NEXT:       FrameOffset: -
     51 // CHECK-NEXT:       UnwindCodeCount: 0
     52 // CHECK-NEXT:       UnwindCodes [
     53 // CHECK-NEXT:       ]
     54 // CHECK-NEXT:     }
     55 // CHECK-NEXT:   }
     56 // CHECK-NEXT: ]
     57 
     58 // Generate the minimal unwind info.
     59 // It contains only the version set to 1. All other bytes are 0.
     60     .globl smallFunc
     61     .def smallFunc; .scl 2; .type 32; .endef
     62     .seh_proc smallFunc
     63 smallFunc:
     64     ret
     65     .seh_endproc
     66