1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
## This file contains test cases for generating Fat Mach-O binaries.
## a) Test that yaml2obj emits Fat Mach-O binary and obj2yaml converts it
## back to YAML file.
# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s
--- !fat-mach-o
FatHeader:
magic: 0xCAFEBABE
nfat_arch: 2
FatArchs:
- cputype: 0x00000007
cpusubtype: 0x00000003
offset: 0x0000000000001000
size: 15244
align: 12
- cputype: 0x01000007
cpusubtype: 0x80000003
offset: 0x0000000000005000
size: 15380
align: 12
Slices:
- FileHeader:
magic: 0xFEEDFACE
cputype: 0x00000007
cpusubtype: 0x00000003
filetype: 0x00000002
ncmds: 0
sizeofcmds: 0
flags: 0x01218085
- FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x80000003
filetype: 0x00000002
ncmds: 0
sizeofcmds: 0
flags: 0x00218085
reserved: 0x00000000
...
#CHECK: --- !fat-mach-o
#CHECK: FatHeader:
#CHECK: magic: 0xCAFEBABE
#CHECK: nfat_arch: 2
#CHECK: FatArchs:
#CHECK: - cputype: 0x7
#CHECK: cpusubtype: 0x3
#CHECK: offset: 0x1000
#CHECK: size: 15244
#CHECK: align: 12
#CHECK: - cputype: 0x1000007
#CHECK: cpusubtype: 0x80000003
#CHECK: offset: 0x5000
#CHECK: size: 15380
#CHECK: align: 12
#CHECK: Slices:
#CHECK: - !mach-o
#CHECK: FileHeader:
#CHECK: magic: 0xFEEDFACE
#CHECK: cputype: 0x7
#CHECK: cpusubtype: 0x3
#CHECK: filetype: 0x2
#CHECK: ncmds: 0
#CHECK: sizeofcmds: 0
#CHECK: flags: 0x1218085
#CHECK: - !mach-o
#CHECK: FileHeader:
#CHECK: magic: 0xFEEDFACF
#CHECK: cputype: 0x1000007
#CHECK: cpusubtype: 0x80000003
#CHECK: filetype: 0x2
#CHECK: ncmds: 0
#CHECK: sizeofcmds: 0
#CHECK: flags: 0x218085
#CHECK: reserved: 0x0
#CHECK: ...
## b) Test that yaml2obj emits an error message if the number of 'FatArchs' is less than
## the number of 'Slices'.
# RUN: not yaml2obj --docnum=2 %s -o %t2.fat-macho 2>&1 | FileCheck %s --check-prefix=ERROR
# ERROR: yaml2obj: error: cannot write 'Slices' if not described in 'FatArches'
--- !fat-mach-o
FatHeader:
magic: 0xCAFEBABE
nfat_arch: 2
FatArchs:
## 2 FatArchs are expected.
- cputype: 0x00000007
cpusubtype: 0x00000003
offset: 0x0000000000001000
size: 0
align: 0
Slices:
- FileHeader:
magic: 0xFEEDFACE
cputype: 0x00000007
cpusubtype: 0x00000003
filetype: 0x00000002
ncmds: 0
sizeofcmds: 0
flags: 0x00000000
- FileHeader:
magic: 0xFEEDFACE
cputype: 0x00000007
cpusubtype: 0x00000003
filetype: 0x00000002
ncmds: 0
sizeofcmds: 0
flags: 0x00000000
|