1# Check we accept -install_name correctly:
2# RUN: ld64.lld -arch x86_64 -install_name libwibble.dylib -dylib \
3# RUN:     -compatibility_version 2.0 -current_version 5.3 \
4# RUN:     %p/Inputs/x86_64/libSystem.yaml %s -o %t.dylib
5# RUN: llvm-objdump --private-headers %t.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
6
7# Check we read LC_ID_DYLIB correctly:
8# RUN: ld64.lld -arch x86_64 %p/Inputs/use-dylib-install-names.yaml \
9# RUN:      %p/Inputs/x86_64/libSystem.yaml %t.dylib -dylib -o %t2.dylib
10# RUN: llvm-objdump --private-headers %t2.dylib | FileCheck %s --check-prefix=CHECK-BINARY-READ
11
12# Check we default the install-name to the output file:
13# RUN: ld64.lld -arch x86_64 -dylib %s -o libwibble.dylib \
14# RUN:     -compatibility_version 2.0 -current_version 5.3 \
15# RUN:     %p/Inputs/x86_64/libSystem.yaml
16# RUN: llvm-objdump --private-headers libwibble.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
17# RUN: rm -f libwibble.dylib
18
19# Check -single_module does nothing
20# RUN: ld64.lld -arch x86_64 -dylib %s -install_name libwibble.dylib \
21# RUN:     -compatibility_version 2.0 -current_version 5.3 \
22# RUN:     -single_module -o %t2.dylib %p/Inputs/x86_64/libSystem.yaml
23# RUN: llvm-objdump --private-headers %t2.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
24
25--- !mach-o
26arch:            x86_64
27file-type:       MH_OBJECT
28flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
29has-UUID:        false
30OS:              unknown
31sections:
32  - segment:         __TEXT
33    section:         __text
34    type:            S_REGULAR
35    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
36    alignment:       4
37    address:         0x0000000000000000
38    content:         [ 0xCC, 0xC3, 0x90, 0xC3, 0x90, 0x90, 0xC3, 0x90,
39                       0x90, 0x90, 0xC3, 0x90, 0x90, 0x90, 0x90, 0xC3,
40                       0x31, 0xC0, 0xC3 ]
41local-symbols:
42  - name:            _myStatic
43    type:            N_SECT
44    sect:            1
45    value:           0x000000000000000B
46global-symbols:
47  - name:            _myGlobal
48    type:            N_SECT
49    scope:           [ N_EXT ]
50    sect:            1
51    value:           0x0000000000000001
52...
53
54
55# CHECK-BINARY-WRITE: cmd LC_ID_DYLIB
56# CHECK-BINARY-WRITE-NEXT: cmdsize 40
57# CHECK-BINARY-WRITE-NEXT:  name libwibble.dylib (offset 24)
58# CHECK-BINARY-WRITE-NEXT:  time stamp 1
59# CHECK-BINARY-WRITE-NEXT:  current version 5.3.0
60# CHECK-BINARY-WRITE-NEXT:  compatibility version 2.0.0
61
62# CHECK-BINARY-READ: cmd LC_LOAD_DYLIB
63# CHECK-BINARY-READ-NEXT: cmdsize 56
64# CHECK-BINARY-READ-NEXT:  name /usr/lib/libSystem.B.dylib (offset 24)
65# CHECK-BINARY-READ-NEXT:  time stamp 2
66# CHECK-BINARY-READ-NEXT:  current version 1.0.0
67# CHECK-BINARY-READ-NEXT:  compatibility version 1.0.0
68
69# CHECK-BINARY-READ: cmd LC_LOAD_DYLIB
70# CHECK-BINARY-READ-NEXT: cmdsize 40
71# CHECK-BINARY-READ-NEXT:  name libwibble.dylib (offset 24)
72# CHECK-BINARY-READ-NEXT:  time stamp 2
73# CHECK-BINARY-READ-NEXT:  current version 5.3.0
74# CHECK-BINARY-READ-NEXT:  compatibility version 2.0.0
75