The OpenD Programming Language

1 /**
2  * Bindings for symbols and defines in `mach-o/stab.h`
3  *
4  * This file gives definitions supplementing <nlist.h> for permanent symbol
5  * table entries of Mach-O files.  Modified from the BSD definitions.  The
6  * modifications from the original definitions were changing what the values of
7  * what was the n_other field (an unused field) which is now the n_sect field.
8  * These modifications are required to support symbols in an arbitrary number of
9  * sections not just the three sections (text, data and bss) in a BSD file.
10  * The values of the defined constants have NOT been changed.
11  *
12  * These must have one of the N_STAB bits on.  The n_value fields are subject
13  * to relocation according to the value of their n_sect field.  So for types
14  * that refer to things in sections the n_sect field must be filled in with the
15  * proper section ordinal.  For types that are not to have their n_value field
16  * relocatated the n_sect field must be NO_SECT.
17  *
18  * This file was created based on the MacOSX 10.15 SDK.
19  *
20  * Copyright:
21  * D Language Foundation 2020
22  * Some documentation was extracted from the C headers
23  * and is the property of Apple Inc.
24  *
25  * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
26  * Authors: Mathias 'Geod24' Lang
27  * Source: $(DRUNTIMESRC core/sys/darwin/mach/_nlist.d)
28  */
29 module core.sys.darwin.mach.stab;
30 
31 extern(C):
32 nothrow:
33 @nogc:
34 pure:
35 
36 /**
37  * Symbolic debugger symbols.
38  *
39  * The comments give the conventional use for
40  * ```
41  *  .stabs "n_name", n_type, n_sect, n_desc, n_value
42  * ```
43  *
44  * where n_type is the defined constant and not listed in the comment.  Other
45  * fields not listed are zero. n_sect is the section ordinal the entry is
46  * refering to.
47  */
48 enum
49 {
50     N_GSYM  = 0x20,    /// global symbol: name,,NO_SECT,type,0
51     N_FNAME = 0x22,    /// procedure name (f77 kludge): name,,NO_SECT,0,0
52     N_FUN   = 0x24,    /// procedure: name,,n_sect,linenumber,address
53     N_STSYM = 0x26,    /// static symbol: name,,n_sect,type,address
54     N_LCSYM = 0x28,    /// .lcomm symbol: name,,n_sect,type,address
55     N_BNSYM = 0x2e,    /// begin nsect sym: 0,,n_sect,0,address
56     N_AST   = 0x32,    /// AST file path: name,,NO_SECT,0,0
57     N_OPT   = 0x3c,    /// emitted with gcc2_compiled and in gcc source
58     N_RSYM  = 0x40,    /// register sym: name,,NO_SECT,type,register
59     N_SLINE = 0x44,    /// src line: 0,,n_sect,linenumber,address
60     N_ENSYM = 0x4e,    /// end nsect sym: 0,,n_sect,0,address
61     N_SSYM  = 0x60,    /// structure elt: name,,NO_SECT,type,struct_offset
62     N_SO    = 0x64,    /// source file name: name,,n_sect,0,address
63     /**
64      * Object file name: name,,(see below),0,st_mtime
65      *
66      * Historically N_OSO set n_sect to 0.
67      * The N_OSO n_sect may instead hold the low byte of the cpusubtype value
68      * from the Mach-O header.
69      */
70     N_OSO   = 0x66,
71     N_LSYM  = 0x80,    /// local sym: name,,NO_SECT,type,offset
72     N_BINCL = 0x82,    /// include file beginning: name,,NO_SECT,0,sum
73     N_SOL   = 0x84,    /// #included file name: name,,n_sect,0,address
74     N_PARAMS = 0x86,   /// compiler parameters: name,,NO_SECT,0,0
75     N_VERSION = 0x88,  /// compiler version: name,,NO_SECT,0,0
76     N_OLEVEL = 0x8A,   /// compiler -O level: name,,NO_SECT,0,0
77     N_PSYM  = 0xa0,    /// parameter: name,,NO_SECT,type,offset
78     N_EINCL = 0xa2,    /// include file end: name,,NO_SECT,0,0
79     N_ENTRY = 0xa4,    /// alternate entry: name,,n_sect,linenumber,address
80     N_LBRAC = 0xc0,    /// left bracket: 0,,NO_SECT,nesting level,address
81     N_EXCL =  0xc2,    /// deleted include file: name,,NO_SECT,0,sum
82     N_RBRAC = 0xe0,    /// right bracket: 0,,NO_SECT,nesting level,address
83     N_BCOMM = 0xe2,    /// begin common: name,,NO_SECT,0,0
84     N_ECOMM = 0xe4,    /// end common: name,,n_sect,0,0
85     N_ECOML = 0xe8,    /// end common (local name): 0,,n_sect,0,address
86     N_LENG =  0xfe,    /// second stab entry with length information
87 
88     // For the berkeley pascal compiler, pc(1):
89     N_PC   = 0x30,    /// global pascal symbol: name,,NO_SECT,subtype,line
90 }