The OpenD Programming Language

core.sys.darwin.mach.nlist

Bindings for symbols and defines in mach-o/nlist.h

This file was created based on the MacOSX 10.15 SDK.

Members

Enums

N_NO_DEAD_STRIP
anonymousenum N_NO_DEAD_STRIP

The bit 0x0020 of the n_desc field is used for two non-overlapping purposes and has two different symbolic names, N_NO_DEAD_STRIP and N_DESC_DISCARDED.

N_STAB
anonymousenum N_STAB

Mask to use with nlist_64.n_type to check what the entry describes

N_UNDF
anonymousenum N_UNDF

Values for NTypeMask.N_TYPE bits of the nlist_64.n_type field.

REFERENCE_TYPE
anonymousenum REFERENCE_TYPE

To support the lazy binding of undefined symbols in the dynamic link-editor, the undefined symbols in the symbol table (the nlist structures) are marked with the indication if the undefined reference is a lazy reference or non-lazy reference. If both a non-lazy reference and a lazy reference is made to the same symbol the non-lazy reference takes precedence. A reference is lazy only when all references to that symbol are made through a symbol pointer in a lazy symbol pointer section.

SELF_LIBRARY_ORDINAL
anonymousenum SELF_LIBRARY_ORDINAL

For images created by the static link editor with the -twolevel_namespace option in effect the flags field of the mach header is marked with MH_TWOLEVEL. And the binding of the undefined references of the image are determined by the static link editor. Which library an undefined symbol is bound to is recorded by the static linker in the high 8 bits of the n_desc field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded references the libraries listed in the Mach-O's LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the headers. The library ordinals start from 1. For a dynamic library that is built as a two-level namespace image the undefined references from module defined in another use the same nlist struct an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For defined symbols in all images they also must have the library ordinal set to SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable image for references from plugins that refer to the executable that loads them.

Functions

GET_COMM_ALIGN
ubyte GET_COMM_ALIGN(uint n_desc)

Common symbols are represented by undefined (N_UNDF) external (N_EXT) types who's values (n_value) are non-zero. In which case the value of the n_value field is the size (in bytes) of the common symbol. The n_sect field is set to NO_SECT. The alignment of a common symbol may be set as a power of 2 between 2^1 and 2^15 as part of the n_desc field using the macros below. If the alignment is not set (a value of zero) then natural alignment based on the size is used.

GET_LIBRARY_ORDINAL
ubyte GET_LIBRARY_ORDINAL(uint n_desc)

For images created by the static link editor with the -twolevel_namespace option in effect the flags field of the mach header is marked with MH_TWOLEVEL. And the binding of the undefined references of the image are determined by the static link editor. Which library an undefined symbol is bound to is recorded by the static linker in the high 8 bits of the n_desc field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded references the libraries listed in the Mach-O's LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the headers. The library ordinals start from 1. For a dynamic library that is built as a two-level namespace image the undefined references from module defined in another use the same nlist struct an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For defined symbols in all images they also must have the library ordinal set to SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable image for references from plugins that refer to the executable that loads them.

SET_COMM_ALIGN
ushort SET_COMM_ALIGN(ushort n_desc, size_t wanted_align)

Common symbols are represented by undefined (N_UNDF) external (N_EXT) types who's values (n_value) are non-zero. In which case the value of the n_value field is the size (in bytes) of the common symbol. The n_sect field is set to NO_SECT. The alignment of a common symbol may be set as a power of 2 between 2^1 and 2^15 as part of the n_desc field using the macros below. If the alignment is not set (a value of zero) then natural alignment based on the size is used.

SET_LIBRARY_ORDINAL
ushort SET_LIBRARY_ORDINAL(ushort n_desc, uint ordinal)

For images created by the static link editor with the -twolevel_namespace option in effect the flags field of the mach header is marked with MH_TWOLEVEL. And the binding of the undefined references of the image are determined by the static link editor. Which library an undefined symbol is bound to is recorded by the static linker in the high 8 bits of the n_desc field using the SET_LIBRARY_ORDINAL macro below. The ordinal recorded references the libraries listed in the Mach-O's LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LOAD_UPWARD_DYLIB, and LC_LAZY_LOAD_DYLIB, etc. load commands in the order they appear in the headers. The library ordinals start from 1. For a dynamic library that is built as a two-level namespace image the undefined references from module defined in another use the same nlist struct an in that case SELF_LIBRARY_ORDINAL is used as the library ordinal. For defined symbols in all images they also must have the library ordinal set to SELF_LIBRARY_ORDINAL. The EXECUTABLE_ORDINAL refers to the executable image for references from plugins that refer to the executable that loads them.

Manifest constants

MAX_SECT
enum MAX_SECT;

Maximum number of sections: 1 thru 255 inclusive

NO_SECT
enum NO_SECT;

Symbol is not in any section

Structs

nlist_64
struct nlist_64

An entry in a list of symbols for 64-bits architectures

Meta

Authors

Mathias 'Geod24' Lang