|
| 1 | +## Check parsing and dumping of the SFrame header. |
| 2 | +# RUN: yaml2obj --docnum=1 %s -o %t.1 |
| 3 | +# RUN: llvm-readobj --sframe=.sframe_1b --sframe=.sframe_bad_magic \ |
| 4 | +# RUN: --sframe=.sframe_bad_version --sframe=.sframe_6b \ |
| 5 | +# RUN: --sframe=.sframe_header %t.1 2>&1 \ |
| 6 | +# RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=CASE1 |
| 7 | + |
| 8 | +## Check big-endian support and the handling of --sframe argument default. |
| 9 | +# RUN: yaml2obj --docnum=2 %s -o %t.2 |
| 10 | +# RUN: llvm-readobj --sframe %t.2 2>&1 \ |
| 11 | +# RUN: | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=CASE2 |
| 12 | + |
| 13 | +--- !ELF |
| 14 | +FileHeader: |
| 15 | + Class: ELFCLASS64 |
| 16 | + Data: ELFDATA2LSB |
| 17 | + Type: ET_EXEC |
| 18 | + Machine: EM_X86_64 |
| 19 | +Sections: |
| 20 | + - Name: .sframe_1b |
| 21 | + Type: SHT_PROGBITS |
| 22 | + Flags: [ SHF_ALLOC ] |
| 23 | + ContentArray: [ 0x00 ] |
| 24 | +# CASE1-LABEL:SFrame section '.sframe_1b' { |
| 25 | +# CASE1:{{.*}}: warning: {{.*}}: unexpected end of data at offset 0x1 while reading [0x0, 0x4) |
| 26 | + |
| 27 | + - Name: .sframe_bad_magic |
| 28 | + Type: SHT_PROGBITS |
| 29 | + Flags: [ SHF_ALLOC ] |
| 30 | + ContentArray: [ 0xde, 0xad, 0xbe, 0xef] |
| 31 | +# CASE1-LABEL:SFrame section '.sframe_bad_magic' { |
| 32 | +# CASE1:{{.*}}: warning: {{.*}}: invalid magic number |
| 33 | + |
| 34 | + - Name: .sframe_bad_version |
| 35 | + Type: SHT_PROGBITS |
| 36 | + Flags: [ SHF_ALLOC ] |
| 37 | + ContentArray: [ |
| 38 | + 0xe2, 0xde, 0x01, 0x00 # Preamble (magic, version, flags) |
| 39 | + ] |
| 40 | +# CASE1-LABEL:SFrame section '.sframe_bad_version' { |
| 41 | +# CASE1:{{.*}}: warning: {{.*}}: invalid/unsupported version number |
| 42 | + |
| 43 | + - Name: .sframe_6b |
| 44 | + Type: SHT_PROGBITS |
| 45 | + Flags: [ SHF_ALLOC ] |
| 46 | + ContentArray: [ |
| 47 | + 0xe2, 0xde, 0x02, 0x00, # Preamble (magic, version, flags) |
| 48 | + 0x01, 0x02 |
| 49 | + ] |
| 50 | + |
| 51 | +# CASE1-LABEL:SFrame section '.sframe_6b' { |
| 52 | +# CASE1:{{.*}}: warning: {{.*}}: unexpected end of data at offset 0x6 while reading [0x0, 0x1c) |
| 53 | + |
| 54 | + - Name: .sframe_header |
| 55 | + Type: SHT_PROGBITS |
| 56 | + Flags: [ SHF_ALLOC ] |
| 57 | + ContentArray: [ |
| 58 | + 0xe2, 0xde, 0x02, 0x06, # Preamble (magic, version, flags) |
| 59 | + # Header: |
| 60 | + 0x03, 0x42, 0x47, 0x00, # ABI, Fixed FP offset, Fixed RA Offset, AUX header length |
| 61 | + 0x01, 0x00, 0x00, 0x00, # Number of FDEs |
| 62 | + 0x10, 0x00, 0x00, 0x00, # Number of FREs |
| 63 | + 0x00, 0x10, 0x00, 0x00, # FRE length |
| 64 | + 0x04, 0x00, 0x00, 0x00, # FDE offset |
| 65 | + 0x00, 0x01, 0x00, 0x00, # FRE offset |
| 66 | + ] |
| 67 | +# CASE1-LABEL:SFrame section '.sframe_header' { |
| 68 | +# CASE1: Header { |
| 69 | +# CASE1-NEXT: Magic: 0xDEE2 |
| 70 | +# CASE1-NEXT: Version: V2 (0x2) |
| 71 | +# CASE1-NEXT: Flags [ (0x6) |
| 72 | +# CASE1-NEXT: FDEFuncStartPCRel (0x4){{ *}} |
| 73 | +# CASE1-NEXT: FramePointer (0x2){{ *}} |
| 74 | +# CASE1-NEXT: ] |
| 75 | +# CASE1-NEXT: ABI: AMD64EndianLittle (0x3) |
| 76 | +# CASE1-NEXT: CFA fixed FP offset (unused): 66 |
| 77 | +# CASE1-NEXT: CFA fixed RA offset: 71 |
| 78 | +# CASE1-NEXT: Auxiliary header length: 0 |
| 79 | +# CASE1-NEXT: Num FDEs: 1 |
| 80 | +# CASE1-NEXT: Num FREs: 16 |
| 81 | +# CASE1-NEXT: FRE subsection length: 4096 |
| 82 | +# CASE1-NEXT: FDE subsection offset: 4 |
| 83 | +# CASE1-NEXT: FRE subsection offset: 256 |
| 84 | +# CASE1-NEXT: } |
| 85 | +# CASE1-NEXT:} |
| 86 | + |
| 87 | +--- !ELF |
| 88 | +FileHeader: |
| 89 | + Class: ELFCLASS64 |
| 90 | + Data: ELFDATA2MSB |
| 91 | + Type: ET_EXEC |
| 92 | + Machine: EM_AARCH64 |
| 93 | +Sections: |
| 94 | + - Name: .sframe |
| 95 | + Type: SHT_PROGBITS |
| 96 | + Flags: [ SHF_ALLOC ] |
| 97 | + ContentArray: [ |
| 98 | + 0xde, 0xe2, 0x02, 0x01, # Preamble (magic, version, flags) |
| 99 | + # Header: |
| 100 | + 0x01, 0x42, 0x47, 0x00, # ABI, Fixed FP offset, Fixed RA Offset, AUX header length |
| 101 | + 0x00, 0x00, 0x00, 0x01, # Number of FDEs |
| 102 | + 0x00, 0x00, 0x00, 0x10, # Number of FREs |
| 103 | + 0x00, 0x00, 0x10, 0x00, # FRE length |
| 104 | + 0x00, 0x00, 0x00, 0x04, # FDE offset |
| 105 | + 0x00, 0x00, 0x01, 0x00, # FRE offset |
| 106 | + ] |
| 107 | +# CASE2-LABEL:SFrame section '.sframe' { |
| 108 | +# CASE2: Header { |
| 109 | +# CASE2-NEXT: Magic: 0xDEE2 |
| 110 | +# CASE2-NEXT: Version: V2 (0x2) |
| 111 | +# CASE2-NEXT: Flags [ (0x1) |
| 112 | +# CASE2-NEXT: FDESorted (0x1){{ *}} |
| 113 | +# CASE2-NEXT: ] |
| 114 | +# CASE2-NEXT: ABI: AArch64EndianBig (0x1) |
| 115 | +# CASE2-NEXT: CFA fixed FP offset (unused): 66 |
| 116 | +# CASE2-NEXT: CFA fixed RA offset (unused): 71 |
| 117 | +# CASE2-NEXT: Auxiliary header length: 0 |
| 118 | +# CASE2-NEXT: Num FDEs: 1 |
| 119 | +# CASE2-NEXT: Num FREs: 16 |
| 120 | +# CASE2-NEXT: FRE subsection length: 4096 |
| 121 | +# CASE2-NEXT: FDE subsection offset: 4 |
| 122 | +# CASE2-NEXT: FRE subsection offset: 256 |
| 123 | +# CASE2-NEXT: } |
| 124 | +# CASE2-NEXT:} |
0 commit comments