1# RUN: ld64.lld.darwinold -arch x86_64  %s %p/Inputs/interposing-section.yaml \
2# RUN: -dylib -o %t %p/Inputs/x86_64/libSystem.yaml
3# RUN: llvm-objdump --private-headers %t | FileCheck %s
4#
5# RUN: ld64.lld.darwinold -arch x86_64  %s -r -o %t1
6# RUN: llvm-objdump --private-headers %t1 | FileCheck %s
7#
8# Test that interposing section is preserved by linker.
9#
10
11--- !mach-o
12arch:            x86_64
13file-type:       MH_OBJECT
14flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
15sections:
16  - segment:         __TEXT
17    section:         __text
18    type:            S_REGULAR
19    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
20    address:         0x0000000000000000
21    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x31, 0xC0, 0x5D, 0xE9,
22                       0x00, 0x00, 0x00, 0x00 ]
23    relocations:
24      - offset:          0x00000008
25        type:            X86_64_RELOC_BRANCH
26        length:          2
27        pc-rel:          true
28        extern:          true
29        symbol:          2
30  - segment:         __DATA
31    section:         __interpose
32    type:            S_INTERPOSING
33    attributes:      [  ]
34    alignment:       8
35    address:         0x0000000000000010
36    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
38    relocations:
39      - offset:          0x00000008
40        type:            X86_64_RELOC_UNSIGNED
41        length:          3
42        pc-rel:          false
43        extern:          true
44        symbol:          2
45      - offset:          0x00000000
46        type:            X86_64_RELOC_UNSIGNED
47        length:          3
48        pc-rel:          false
49        extern:          true
50        symbol:          0
51local-symbols:
52  - name:            _my_open
53    type:            N_SECT
54    sect:            1
55    value:           0x0000000000000000
56  - name:            __interpose_open
57    type:            N_SECT
58    sect:            2
59    desc:            [ N_NO_DEAD_STRIP ]
60    value:           0x0000000000000010
61undefined-symbols:
62  - name:            _open
63    type:            N_UNDF
64    scope:           [ N_EXT ]
65    value:           0x0000000000000000
66...
67
68
69# CHECK:	  sectname __interposing
70# CHECK:	   segname __DATA
71# CHECK:	      type S_INTERPOSING
72
73