| ## Check that local private externs -- symbols without N_EXT but with N_PEXT set |
| ## -- are translation-unit-scoped. These symbols may be generated by `ld -r`, |
| ## which emits an object file. Since LLD does not yet support `-r`, we use |
| ## yaml2obj to construct the input. |
| |
| # RUN: rm -rf %t; mkdir %t |
| # RUN: yaml2obj %s > %t/foo.o |
| ## No duplicate symbol conflict since _foo is not extern |
| # RUN: %lld -dylib %t/foo.o %t/foo.o -o %t/foo |
| # RUN: llvm-nm -m %t/foo | FileCheck %s |
| |
| ## Note that the symbols in the output are no longer marked as "was a private |
| ## external". |
| # CHECK: (absolute) non-external _bar |
| # CHECK: (absolute) non-external _bar |
| # CHECK: (__DATA,__data) non-external _foo |
| # CHECK: (__DATA,__data) non-external _foo |
| |
| --- !mach-o |
| FileHeader: |
| magic: 0xFEEDFACF |
| cputype: 0x1000007 |
| cpusubtype: 0x3 |
| filetype: 0x1 |
| ncmds: 2 |
| sizeofcmds: 208 |
| flags: 0x0 |
| reserved: 0x0 |
| LoadCommands: |
| - cmd: LC_SEGMENT_64 |
| cmdsize: 152 |
| segname: '' |
| vmaddr: 0 |
| vmsize: 0 |
| fileoff: 272 |
| filesize: 0 |
| maxprot: 7 |
| initprot: 7 |
| nsects: 1 |
| flags: 0 |
| Sections: |
| - sectname: __data |
| segname: __DATA |
| addr: 0x0 |
| size: 0 |
| offset: 0x110 |
| align: 0 |
| reloff: 0x0 |
| nreloc: 0 |
| flags: 0x0 |
| reserved1: 0x0 |
| reserved2: 0x0 |
| reserved3: 0x0 |
| content: '' |
| - cmd: LC_SYMTAB |
| cmdsize: 24 |
| symoff: 272 |
| nsyms: 2 |
| stroff: 304 |
| strsize: 16 |
| LinkEditData: |
| NameList: |
| - n_strx: 2 ## _foo |
| n_type: 0x1E ## N_PEXT | N_SECT |
| n_sect: 1 |
| n_desc: 32 |
| n_value: 0 |
| - n_strx: 7 ## _bar |
| n_type: 0x12 ## N_PEXT | N_ABS |
| n_sect: 0 |
| n_desc: 0 |
| n_value: 291 |
| StringTable: |
| - ' ' |
| - _foo |
| - _bar |
| - '' |
| - '' |
| - '' |
| - '' |
| ... |