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
81 content: '0000001000000080'
99 compatibility_version: 0
100 Content: '@executable_path/libfixups.dylib'
102 - cmd: LC_DYLD_CHAINED_FIXUPS
106 - cmd: LC_DYLD_EXPORTS_TRIE
138 uuid: 56F7BCE0-C1A7-38E3-A90D-742D8E3D5FA9
139 - cmd: LC_BUILD_VERSION
148 - cmd: LC_SOURCE_VERSION
151 - cmd: LC_ENCRYPTION_INFO_64
163 compatibility_version: 0
164 Content: '@executable_path/liba.dylib'
171 current_version: 85917696
172 compatibility_version: 65536
173 Content: '/usr/lib/libSystem.B.dylib'
175 - cmd: LC_FUNCTION_STARTS
179 - cmd: LC_DATA_IN_CODE
183 __LINKEDIT: 0000000020000000480000004C000000010000000100000000000000000000000300000000000000100000000000000018000000004006000040000000000000000000000100000001020000005F6578740000000000000000015F700006040080800100000000000000000000000000020000000F02000000400000000000000500000001000001000000000000000020005F70005F65787400000000000000