Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / obj2yaml / MachO / raw-linkedit.yaml
blobb9d0cae8ce8a1b6f55f496dda0f854bd54dcc64f
1 # Test that obj2yaml + yaml2obj can round-trip mach-o executables with
2 #  raw __LINKEDIT segments.
4 # RUN: yaml2obj %s | obj2yaml --raw-segment=data --raw-segment=linkedit | FileCheck %s
6 # This file was produced using:
7 #   echo "int ext;" > a.c
8 #   xcrun --sdk iphoneos clang -target arm64-apple-ios15.1 -o a.o a.c -c
9 #   xcrun --sdk iphoneos clang -target arm64-apple-ios15.1 -dynamiclib a.o -o liba.dylib -install_name @executable_path/liba.dylib
10 #   echo "extern int ext;" > b.c
11 #   echo "int padding;" >> b.c
12 #   echo "int *p = &ext + 4;" >> b.c
13 #   xcrun --sdk iphoneos clang -target arm64-apple-ios15.1 -o b.o b.c -c
14 #   xcrun --sdk iphoneos clang -target arm64-apple-ios15.1 -dynamiclib b.o -o libfixups.dylib -install_name @executable_path/libfixups.dylib -L. -la
16 # CHECK:      - sectname:        __data
17 # CHECK:        segname:         __DATA
18 # CHECK:        content:         '0000001000000080'
19 # CHECK: __LINKEDIT:      0000000020000000480000004C000000010000000100000000000000000000000300000000000000100000000000000018000000004006000040000000000000000000000100000001020000005F6578740000000000000000015F700006040080800100000000000000000000000000020000000F02000000400000000000000500000001000001000000000000000020005F70005F65787400000000000000
21 --- !mach-o
22 FileHeader:
23   magic:           0xFEEDFACF
24   cputype:         0x100000C
25   cpusubtype:      0x0
26   filetype:        0x6
27   ncmds:           16
28   sizeofcmds:      816
29   flags:           0x100085
30   reserved:        0x0
31 LoadCommands:
32   - cmd:             LC_SEGMENT_64
33     cmdsize:         152
34     segname:         __TEXT
35     vmaddr:          0
36     vmsize:          16384
37     fileoff:         0
38     filesize:        16384
39     maxprot:         5
40     initprot:        5
41     nsects:          1
42     flags:           0
43     Sections:
44       - sectname:        __text
45         segname:         __TEXT
46         addr:            0x4000
47         size:            0
48         offset:          0x4000
49         align:           0
50         reloff:          0x0
51         nreloc:          0
52         flags:           0x80000400
53         reserved1:       0x0
54         reserved2:       0x0
55         reserved3:       0x0
56         content:         ''
57   - cmd:             LC_SEGMENT_64
58     cmdsize:         152
59     segname:         __DATA
60     vmaddr:          16384
61     vmsize:          16384
62     fileoff:         16384
63     filesize:        16384
64     maxprot:         3
65     initprot:        3
66     nsects:          1
67     flags:           0
68     Sections:
69       - sectname:        __data
70         segname:         __DATA
71         addr:            0x4000
72         size:            8
73         offset:          0x4000
74         align:           3
75         reloff:          0x0
76         nreloc:          0
77         flags:           0x0
78         reserved1:       0x0
79         reserved2:       0x0
80         reserved3:       0x0
81         content:         '0000001000000080'
82   - cmd:             LC_SEGMENT_64
83     cmdsize:         72
84     segname:         __LINKEDIT
85     vmaddr:          32768
86     vmsize:          16384
87     fileoff:         32768
88     filesize:        160
89     maxprot:         1
90     initprot:        1
91     nsects:          0
92     flags:           0
93   - cmd:             LC_ID_DYLIB
94     cmdsize:         64
95     dylib:
96       name:            24
97       timestamp:       1
98       current_version: 0
99       compatibility_version: 0
100     Content:         '@executable_path/libfixups.dylib'
101     ZeroPadBytes:    8
102   - cmd:             LC_DYLD_CHAINED_FIXUPS
103     cmdsize:         16
104     dataoff:         32768
105     datasize:        88
106   - cmd:             LC_DYLD_EXPORTS_TRIE
107     cmdsize:         16
108     dataoff:         32856
109     datasize:        16
110   - cmd:             LC_SYMTAB
111     cmdsize:         24
112     symoff:          32880
113     nsyms:           2
114     stroff:          32912
115     strsize:         16
116   - cmd:             LC_DYSYMTAB
117     cmdsize:         80
118     ilocalsym:       0
119     nlocalsym:       0
120     iextdefsym:      0
121     nextdefsym:      1
122     iundefsym:       1
123     nundefsym:       1
124     tocoff:          0
125     ntoc:            0
126     modtaboff:       0
127     nmodtab:         0
128     extrefsymoff:    0
129     nextrefsyms:     0
130     indirectsymoff:  0
131     nindirectsyms:   0
132     extreloff:       0
133     nextrel:         0
134     locreloff:       0
135     nlocrel:         0
136   - cmd:             LC_UUID
137     cmdsize:         24
138     uuid:            56F7BCE0-C1A7-38E3-A90D-742D8E3D5FA9
139   - cmd:             LC_BUILD_VERSION
140     cmdsize:         32
141     platform:        2
142     minos:           983296
143     sdk:             983552
144     ntools:          1
145     Tools:
146       - tool:            3
147         version:         46596096
148   - cmd:             LC_SOURCE_VERSION
149     cmdsize:         16
150     version:         0
151   - cmd:             LC_ENCRYPTION_INFO_64
152     cmdsize:         24
153     cryptoff:        16384
154     cryptsize:       0
155     cryptid:         0
156     pad:             0
157   - cmd:             LC_LOAD_DYLIB
158     cmdsize:         56
159     dylib:
160       name:            24
161       timestamp:       2
162       current_version: 0
163       compatibility_version: 0
164     Content:         '@executable_path/liba.dylib'
165     ZeroPadBytes:    5
166   - cmd:             LC_LOAD_DYLIB
167     cmdsize:         56
168     dylib:
169       name:            24
170       timestamp:       2
171       current_version: 85917696
172       compatibility_version: 65536
173     Content:         '/usr/lib/libSystem.B.dylib'
174     ZeroPadBytes:    6
175   - cmd:             LC_FUNCTION_STARTS
176     cmdsize:         16
177     dataoff:         32872
178     datasize:        8
179   - cmd:             LC_DATA_IN_CODE
180     cmdsize:         16
181     dataoff:         32880
182     datasize:        0
183 __LINKEDIT:      0000000020000000480000004C000000010000000100000000000000000000000300000000000000100000000000000018000000004006000040000000000000000000000100000001020000005F6578740000000000000000015F700006040080800100000000000000000000000000020000000F02000000400000000000000500000001000001000000000000000020005F70005F65787400000000000000