1 # RUN: yaml2obj %s -o %t
3 ## Verify that the input file is valid and contains the expected load command.
4 # RUN: llvm-objdump --private-headers %t | FileCheck %s --check-prefix=CHECK-ORIGINAL
6 # CHECK-ORIGINAL: cmd LC_CODE_SIGNATURE
7 # CHECK-ORIGINAL-NEXT: cmdsize 16
8 # CHECK-ORIGINAL-NEXT: dataoff 16544
9 # CHECK-ORIGINAL-NEXT: datasize 280
11 # RUN: llvm-objcopy %t %t.copy
12 # RUN: obj2yaml %t > %t.yaml
13 # RUN: obj2yaml %t.copy > %t.copy.yaml
15 ## Verify that the copy still includes the load command
16 # RUN: FileCheck %s --check-prefix=CHECK-COPY < %t.copy.yaml
17 # CHECK-COPY: - cmd: LC_CODE_SIGNATURE
18 # CHECK-COPY-NEXT: cmdsize: 16
19 # CHECK-COPY-NEXT: dataoff: 16544
20 # CHECK-COPY-NEXT: datasize: 304
22 ## Remove information changed by regeneration of load command:
23 ## - __LINKEDIT segment filesize may change (4 lines)
24 ## - LC_CODE_SIGNATURE command dataoff and datasize may change (3 lines)
25 ## - __LINKEDIT data locations may change
26 ## NOTE: The {N;N;N;N;d} means delete the next four lines for BSD and GNU sed.
27 ## The ,+4d is a GNU extension which seems not to work in macOS 10.15
29 # RUN: sed -e '/__LINKEDIT/{N;N;N;N;d;}' \
30 # RUN: -e '/LC_CODE_SIGNATURE/{N;N;N;d;}' \
31 # RUN: -e '/n_strx/d' \
32 # RUN: -e '/dyld_stub_binder/d' %t.yaml > %t.clean.yaml
34 # RUN: sed -e '/__LINKEDIT/{N;N;N;N;d;}' \
35 # RUN: -e '/LC_CODE_SIGNATURE/{N;N;N;d;}' \
36 # RUN: -e '/n_strx/d' \
37 # RUN: -e '/dyld_stub_binder/d' %t.copy.yaml > %t.copy.clean.yaml
39 ## Verify the remainder of the object file remains unchanged
40 # RUN: diff %t.clean.yaml %t.copy.clean.yaml
42 ## Verify the new signature is valid
43 # RUN: %python %p/Inputs/code-signature-check.py %t.copy 16544 304 0 16544
91 content: 554889E531C0C745FC000000005DC3
92 - sectname: __unwind_info
104 content: 010000001C000000000000001C000000000000001C00000002000000A03F00003400000034000000B03F00000000000034000000030000000C000100100001000000000000000001
116 - cmd: LC_DYLD_INFO_ONLY
154 - cmd: LC_LOAD_DYLINKER
157 Content: '/usr/lib/dyld'
161 uuid: 42759668-1CBA-3094-8E2D-F01E1A66E815
162 - cmd: LC_BUILD_VERSION
171 - cmd: LC_SOURCE_VERSION
183 current_version: 84698117
184 compatibility_version: 65536
185 Content: '/usr/lib/libSystem.B.dylib'
187 - cmd: LC_FUNCTION_STARTS
191 - cmd: LC_DATA_IN_CODE
195 - cmd: LC_CODE_SIGNATURE
219 Name: _mh_execute_header
249 - __mh_execute_header