• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: ld64.lld -arch x86_64 -r  %s -o %t \
2# RUN:    && llvm-nm -m %t | FileCheck %s
3#
4# RUN: ld64.lld -arch x86_64 -r  %s -o %t2 -keep_private_externs \
5# RUN:    && llvm-nm -m %t2 | FileCheck -check-prefix=CHECK_KPE %s
6#
7# Test -keep_private_externs in -r mode.
8#
9
10--- !mach-o
11arch:            x86_64
12file-type:       MH_OBJECT
13flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
14sections:
15  - segment:         __TEXT
16    section:         __text
17    type:            S_REGULAR
18    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
19    address:         0x0000000000000000
20    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3, 0x55, 0x48,
21                       0x89, 0xE5, 0x5D, 0xC3 ]
22  - segment:         __DATA
23    section:         __data
24    type:            S_REGULAR
25    attributes:      [  ]
26    alignment:       2
27    address:         0x000000000000000C
28    content:         [ 0x0A, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 ]
29
30global-symbols:
31  - name:            _a
32    type:            N_SECT
33    scope:           [ N_EXT ]
34    sect:            2
35    value:           0x000000000000000C
36  - name:            _b
37    type:            N_SECT
38    scope:           [ N_EXT, N_PEXT ]
39    sect:            2
40    value:           0x0000000000000010
41  - name:            _bar
42    type:            N_SECT
43    scope:           [ N_EXT ]
44    sect:            1
45    value:           0x0000000000000006
46  - name:            _foo
47    type:            N_SECT
48    scope:           [ N_EXT, N_PEXT  ]
49    sect:            1
50    value:           0x0000000000000000
51
52
53...
54
55# CHECK: (__DATA,__data) external _a
56# CHECK: (__DATA,__data) non-external (was a private external) _b
57# CHECK: (__TEXT,__text) external _bar
58# CHECK: (__TEXT,__text) non-external (was a private external) _foo
59
60# CHECK_KPE: (__DATA,__data) external _a
61# CHECK_KPE: (__DATA,__data) private external _b
62# CHECK_KPE: (__TEXT,__text) external _bar
63# CHECK_KPE: (__TEXT,__text) private external _foo
64