## Verify that llvm-readobj can dump files containing stabs symbols,
## particularly symbols of type N_OSO which have repurposed the n_sect field
## to store a non-section-index value.
# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj --syms %t | FileCheck %s
# CHECK: Symbols [
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: /Volumes/Sandbox/ (2)
# CHECK-NEXT: Type: SymDebugTable (0x64)
# CHECK-NEXT: Section: (0x0)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Value: 0x0
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: /Volumes/Sandbox/test.o (20)
# CHECK-NEXT: Type: SymDebugTable (0x66)
# CHECK-NEXT: Section: (0x3)
# CHECK-NEXT: RefType: ReferenceFlagUndefinedLazy (0x1)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Value: 0x5F72D5E2
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: (1)
# CHECK-NEXT: Type: SymDebugTable (0x2E)
# CHECK-NEXT: Section: (0x1)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Value: 0x100000FA0
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: _foo (44)
# CHECK-NEXT: Type: SymDebugTable (0x24)
# CHECK-NEXT: Section: (0x1)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Value: 0x100000FA0
# CHECK-NEXT: }
# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: (1)
# CHECK-NEXT: Type: SymDebugTable (0x4E)
# CHECK-NEXT: Section: (0x1)
# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Value: 0xF
# CHECK-NEXT: }
# CHECK-NEXT: ]
---
FileHeader:
magic: 0xFEEDFACF
cputype: 0x01000007
cpusubtype: 0x00000003
filetype: 0x00000002
ncmds: 2
sizeofcmds: 744
flags: 0x00200085
reserved: 0x00000000
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 232
segname: __TEXT
vmaddr: 4294967296
vmsize: 4096
fileoff: 0
filesize: 4096
maxprot: 5
initprot: 5
nsects: 1
flags: 0
Sections:
- sectname: __text
segname: __TEXT
addr: 0x00000000
size: 0
offset: 0x00000000
align: 4
reloff: 0x00000000
nreloc: 0
flags: 0x80000400
reserved1: 0x00000000
reserved2: 0x00000000
reserved3: 0x00000000
- cmd: LC_SYMTAB
cmdsize: 24
symoff: 4152
nsyms: 5
stroff: 4328
strsize: 49
LinkEditData:
NameList:
- n_strx: 2
n_type: 0x64 ## N_SO
n_sect: 0
n_desc: 0
n_value: 0
- n_strx: 20
n_type: 0x66 ## N_OSO
n_sect: 3
n_desc: 1
n_value: 1601361378
- n_strx: 1
n_type: 0x2E ## N_BNSYM
n_sect: 1
n_desc: 0
n_value: 4294971296
- n_strx: 44
n_type: 0x24 ## N_FUN
n_sect: 1
n_desc: 0
n_value: 4294971296
- n_strx: 1
n_type: 0x4E ## N_ENSYM
n_sect: 1
n_desc: 0
n_value: 15
StringTable:
- ' '
- '/Volumes/Sandbox/'
- '/Volumes/Sandbox/test.o'
- _foo
...