# Test reading an ExceptionRecord which is referenced in different ways:
# - Relocation against base of .xdata record, immediate offset in .pdata
# (what LLVM produces)
# - Relocation against symbol in .xdata, no immediate offset in .pdata
# (what MSVC produces)
# - Combination of the two above (unlikely to occur in the wild, but for
# testing the consistency of the code)
# RUN: yaml2obj %s -o %t.obj
# RUN: llvm-readobj --unwind %t.obj | FileCheck %s
# CHECK: UnwindInformation [
# CHECK-NEXT: RuntimeFunction {
# CHECK-NEXT: Function: func (0x0)
# CHECK-NEXT: ExceptionRecord: .xdata (0x0)
# CHECK-NEXT: ExceptionData {
# CHECK-NEXT: FunctionLength: 4
# CHECK-NEXT: Version: 0
# CHECK-NEXT: ExceptionData: No
# CHECK-NEXT: EpiloguePacked: No
# CHECK-NEXT: EpilogueScopes: 0
# CHECK-NEXT: ByteCodeLength: 4
# CHECK-NEXT: Prologue [
# CHECK-NEXT: 0xd400 ; str x19, [sp, #-8]!
# CHECK-NEXT: 0xe4 ; end
# CHECK-NEXT: ]
# CHECK-NEXT: EpilogueScopes [
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: RuntimeFunction {
# CHECK-NEXT: Function: func2 (0x4)
# CHECK-NEXT: ExceptionRecord: .xdata +0x8 (0x8)
# CHECK-NEXT: ExceptionData {
# CHECK-NEXT: FunctionLength: 4
# CHECK-NEXT: Version: 0
# CHECK-NEXT: ExceptionData: No
# CHECK-NEXT: EpiloguePacked: No
# CHECK-NEXT: EpilogueScopes: 0
# CHECK-NEXT: ByteCodeLength: 4
# CHECK-NEXT: Prologue [
# CHECK-NEXT: 0xdc01 ; str d8, [sp, #8]
# CHECK-NEXT: 0xe4 ; end
# CHECK-NEXT: ]
# CHECK-NEXT: EpilogueScopes [
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: RuntimeFunction {
# CHECK-NEXT: Function: func3 (0x8)
# CHECK-NEXT: ExceptionRecord: func3_xdata (0x10)
# CHECK-NEXT: ExceptionData {
# CHECK-NEXT: FunctionLength: 4
# CHECK-NEXT: Version: 0
# CHECK-NEXT: ExceptionData: No
# CHECK-NEXT: EpiloguePacked: No
# CHECK-NEXT: EpilogueScopes: 0
# CHECK-NEXT: ByteCodeLength: 4
# CHECK-NEXT: Prologue [
# CHECK-NEXT: 0xe1 ; mov fp, sp
# CHECK-NEXT: 0xe4 ; end
# CHECK-NEXT: ]
# CHECK-NEXT: EpilogueScopes [
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: RuntimeFunction {
# CHECK-NEXT: Function: func4 (0xC)
# CHECK-NEXT: ExceptionRecord: func3_xdata +0x8 (0x18)
# CHECK-NEXT: ExceptionData {
# CHECK-NEXT: FunctionLength: 4
# CHECK-NEXT: Version: 0
# CHECK-NEXT: ExceptionData: No
# CHECK-NEXT: EpiloguePacked: No
# CHECK-NEXT: EpilogueScopes: 0
# CHECK-NEXT: ByteCodeLength: 4
# CHECK-NEXT: Prologue [
# CHECK-NEXT: 0x81 ; stp x29, x30, [sp, #-16]!
# CHECK-NEXT: 0xe4 ; end
# CHECK-NEXT: ]
# CHECK-NEXT: EpilogueScopes [
# CHECK-NEXT: ]
# CHECK-NEXT: }
# CHECK-NEXT: }
# CHECK-NEXT: ]
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_ARM64
Characteristics: [ ]
sections:
- Name: .text
Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
Alignment: 4
SectionData: F38F1FF8E80700FDFD030091FD7BBFA9
- Name: .xdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
Alignment: 4
SectionData: 01000008D400E4E301000008DC01E4E301000008E1E4E3E30100000881E4E3E3
- Name: .pdata
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
Alignment: 4
SectionData: '0000000000000000000000000800000000000000000000000000000008000000'
Relocations:
- VirtualAddress: 0
SymbolName: func
Type: IMAGE_REL_ARM64_ADDR32NB
- VirtualAddress: 4
SymbolName: .xdata
Type: IMAGE_REL_ARM64_ADDR32NB
- VirtualAddress: 8
SymbolName: func2
Type: IMAGE_REL_ARM64_ADDR32NB
- VirtualAddress: 12
SymbolName: .xdata
Type: IMAGE_REL_ARM64_ADDR32NB
- VirtualAddress: 16
SymbolName: func3
Type: IMAGE_REL_ARM64_ADDR32NB
- VirtualAddress: 20
SymbolName: func3_xdata
Type: IMAGE_REL_ARM64_ADDR32NB
- VirtualAddress: 24
SymbolName: func4
Type: IMAGE_REL_ARM64_ADDR32NB
- VirtualAddress: 28
SymbolName: func3_xdata
Type: IMAGE_REL_ARM64_ADDR32NB
symbols:
- Name: .text
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 16
NumberOfRelocations: 0
NumberOfLinenumbers: 0
CheckSum: 2581817939
Number: 1
- Name: .xdata
Value: 0
SectionNumber: 2
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 32
NumberOfRelocations: 0
NumberOfLinenumbers: 0
CheckSum: 3086971960
Number: 2
- Name: .pdata
Value: 0
SectionNumber: 3
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
SectionDefinition:
Length: 32
NumberOfRelocations: 8
NumberOfLinenumbers: 0
CheckSum: 0
Number: 3
- Name: func
Value: 0
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
- Name: func2
Value: 4
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
- Name: func3
Value: 8
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
- Name: func4
Value: 12
SectionNumber: 1
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
- Name: func3_xdata
Value: 16
SectionNumber: 2
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_STATIC
...