Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / obj2yaml / MachO / simple-exporttrie.yaml
blob9641ac66dea2128ff93043032ef0590b9822256a
1 # Test that obj2yaml + yaml2obj can round-trip mach-o library simple export trie entries.
3 # RUN: rm -rf %t &&  mkdir -p %t
4 # RUN: yaml2obj %s -o %t/libfoo.dylib | FileCheck %s --allow-empty --implicit-check-not warning: --implicit-check-not error:
5 # RUN: llvm-nm --dyldinfo-only %t/libfoo.dylib | FileCheck %s --check-prefix=NM
6 # NM: 3fb0 T _foo
8 # RUN: obj2yaml %t/libfoo.dylib | FileCheck %s --check-prefix=YAML
9 # YAML: LinkEditData:
10 # YAML-NEXT:  ExportTrie:
11 # YAML:    Children:
12 #YAML-NEXT:      - TerminalSize:    3
13 #YAML-NEXT:        NodeOffset:      8
14 #YAML-NEXT:        Name:            _foo
15 #YAML-NEXT:        Flags:           0x0
16 #YAML-NEXT:        Address:         0x3FB0
17 #YAML-NEXT:        Other:           0x0
18 #YAML-NEXT:        ImportName:      ''
23 # This file was produced using:
24 #  int foo() {return 1;} > tmp.c 
25 #  xcrun clang -Wl,-ld64 -isysroot `xcrun --show-sdk-path -sdk macosx` --target=arm64-apple-macos11.3 -dynamiclib -o libfoo.dylib -install_name @rpath/libfoo.dylib tmp.c
27 --- !mach-o
28 FileHeader:
29   magic:           0xFEEDFACF
30   cputype:         0x100000C
31   cpusubtype:      0x0
32   filetype:        0x6
33   ncmds:           13
34   sizeofcmds:      680
35   flags:           0x100085
36   reserved:        0x0
37 LoadCommands:
38   - cmd:             LC_SEGMENT_64
39     cmdsize:         232
40     segname:         __TEXT
41     vmaddr:          0
42     vmsize:          16384
43     fileoff:         0
44     filesize:        16384
45     maxprot:         5
46     initprot:        5
47     nsects:          2
48     flags:           0
49     Sections:
50       - sectname:        __text
51         segname:         __TEXT
52         addr:            0x3FB0
53         size:            8
54         offset:          0x3FB0
55         align:           2
56         reloff:          0x0
57         nreloc:          0
58         flags:           0x80000400
59         reserved1:       0x0
60         reserved2:       0x0
61         reserved3:       0x0
62         content:         20008052C0035FD6
63       - sectname:        __unwind_info
64         segname:         __TEXT
65         addr:            0x3FB8
66         size:            72
67         offset:          0x3FB8
68         align:           2
69         reloff:          0x0
70         nreloc:          0
71         flags:           0x0
72         reserved1:       0x0
73         reserved2:       0x0
74         reserved3:       0x0
75         content:         010000001C000000000000001C000000000000001C00000002000000B03F00003400000034000000B93F00000000000034000000030000000C000100100001000000000000000002
76   - cmd:             LC_SEGMENT_64
77     cmdsize:         72
78     segname:         __LINKEDIT
79     vmaddr:          16384
80     vmsize:          16384
81     fileoff:         16384
82     filesize:        361
83     maxprot:         1
84     initprot:        1
85     nsects:          0
86     flags:           0
87   - cmd:             LC_ID_DYLIB
88     cmdsize:         48
89     dylib:
90       name:            24
91       timestamp:       1
92       current_version: 0
93       compatibility_version: 0
94     Content:         '@rpath/libfoo.dylib'
95     ZeroPadBytes:    5
96   - cmd:             LC_DYLD_INFO_ONLY
97     cmdsize:         48
98     rebase_off:      0
99     rebase_size:     0
100     bind_off:        0
101     bind_size:       0
102     weak_bind_off:   0
103     weak_bind_size:  0
104     lazy_bind_off:   0
105     lazy_bind_size:  0
106     export_off:      16384
107     export_size:     16
108   - cmd:             LC_SYMTAB
109     cmdsize:         24
110     symoff:          16408
111     nsyms:           2
112     stroff:          16440
113     strsize:         24
114   - cmd:             LC_DYSYMTAB
115     cmdsize:         80
116     ilocalsym:       0
117     nlocalsym:       0
118     iextdefsym:      0
119     nextdefsym:      1
120     iundefsym:       1
121     nundefsym:       1
122     tocoff:          0
123     ntoc:            0
124     modtaboff:       0
125     nmodtab:         0
126     extrefsymoff:    0
127     nextrefsyms:     0
128     indirectsymoff:  0
129     nindirectsyms:   0
130     extreloff:       0
131     nextrel:         0
132     locreloff:       0
133     nlocrel:         0
134   - cmd:             LC_UUID
135     cmdsize:         24
136     uuid:            A2CF51D8-828B-3E0F-B8FA-0DF9C5D1C91A
137   - cmd:             LC_BUILD_VERSION
138     cmdsize:         32
139     platform:        1
140     minos:           721664
141     sdk:             917504
142     ntools:          1
143     Tools:
144       - tool:            3
145         version:         59441152
146   - cmd:             LC_SOURCE_VERSION
147     cmdsize:         16
148     version:         0
149   - cmd:             LC_LOAD_DYLIB
150     cmdsize:         56
151     dylib:
152       name:            24
153       timestamp:       2
154       current_version: 87556096
155       compatibility_version: 65536
156     Content:         '/usr/lib/libSystem.B.dylib'
157     ZeroPadBytes:    6
158   - cmd:             LC_FUNCTION_STARTS
159     cmdsize:         16
160     dataoff:         16400
161     datasize:        8
162   - cmd:             LC_DATA_IN_CODE
163     cmdsize:         16
164     dataoff:         16408
165     datasize:        0
166   - cmd:             LC_CODE_SIGNATURE
167     cmdsize:         16
168     dataoff:         16464
169     datasize:        281
170 LinkEditData:
171   ExportTrie:
172     TerminalSize:    0
173     NodeOffset:      0
174     Name:            ''
175     Flags:           0x0
176     Address:         0x0
177     Other:           0x0
178     ImportName:      ''
179     Children:
180       - TerminalSize:    3
181         NodeOffset:      8
182         Name:            _foo
183         Flags:           0x0
184         Address:         0x3FB0
185         Other:           0x0
186         ImportName:      ''
187   NameList:
188     - n_strx:          2
189       n_type:          0xF
190       n_sect:          1
191       n_desc:          0
192       n_value:         16304
193     - n_strx:          7
194       n_type:          0x1
195       n_sect:          0
196       n_desc:          256
197       n_value:         0
198   StringTable:
199     - ' '
200     - _foo
201     - dyld_stub_binder
202   FunctionStarts:  [ 0x3FB0 ]