syms(4)
NAME
syms − common object file symbol table format
SYNOPSIS
#include <syms.h>
DESCRIPTION
Common object files contain information to support symbolic software testing (see sdb(1)). Line number entries, linenum(4), and extensive symbolic information permit testing at the C source level. Every object file’s symbol table is organized as shown below.
File name 1.
Function 1.
Local symbols for function 1.
Function 2.
Local symbols for function 2.
...
Static externs for file 1.
File name 2.
Function 1.
Local symbols for function 1.
Function 2.
Local symbols for function 2.
...
Static externs for file 2.
...
Defined global symbols.
Undefined global symbols.
The entry for a symbol is a fixed-length structure. The members of the structure hold the name (null padded), its value, and other information. The C structure is given below.
#define SYMNMLEN8
#define FILNMLEN14
struct syment
{
union/∗ all ways to get symbol name ∗/
{
char_n_name[SYMNMLEN]; /∗ symbol name ∗/
struct
{
long_n_zeroes;/∗ == 0L when in string table ∗/
long_n_offset;/∗ location of name in table ∗/
} _n_n;
char∗_n_nptr[2];/∗ allows overlaying ∗/
} _n;
longn_value;/∗ value of symbol ∗/
shortn_scnum;/∗ section number ∗/
unsigned shortn_type;/∗ type and derived type ∗/
charn_sclass;/∗ storage class ∗/
charn_numaux;/∗ number of aux entries ∗/
unsigned shortn_pad;/∗ unused - must be zero ∗/
};
#define n_name_n._n_name
#define n_zeroes_n._n_n._n_zeroes
#define n_offset_n._n_n._n_offset
#define n_nptr_n._n_nptr[1]
Meaningful values and explanations for them are given in both syms.h and Common Object File Format. Anyone who needs to interpret the entries should seek more information in these sources. Some symbols require more information than a single entry; they are followed by auxiliary entries that are the same size as a symbol entry. The format follows.
union auxent
{
struct
{
longx_tagndx;/∗ str, un, or enum tag indx ∗/
union
{
struct
{
unsigned longx_lnno; /∗ declaration line number ∗/
unsigned longx_size; /∗ str, union, array size ∗/
} x_lnsz;
longx_fsize;/∗ size of function ∗/
} x_misc;
union
{
struct/∗ if ISFCN, tag, or .bb ∗/
{
longx_lnnoptr; /∗ ptr to fcn line # ∗/
longx_endndx; /∗ entry ndx past block end ∗/
} x_fcn;
struct /∗ up to 4 short dimensions ∗/
{
unsigned shortx_dimen[DIMNUM];
} x_ary;
struct /∗ hcx & gcx - first dimension ∗/
{
unsigned long x_dimen1[DIM1NUM];
} x_ary1;
} x_fcnary;
} x_sym;
struct /∗ successive dimensions ∗/
{
unsigned longx_dimen2[DIM2NUM];
} x_ary2;
union
{
charx_fname[FILNMLEN]; /∗ old COFF versio ∗/
struct
{
long _x_zeroes; /∗ 0 if name is in string table ∗/
long _x_offset; /∗ offset into string table ∗/
} _x_x;
} x_file;
struct
{
long x_scnlen; /∗ section length ∗/
unsigned long x_nreloc; /∗ number of relocation entries ∗/
unsigned long x_nlinno; /∗ number of line numbers ∗/
} x_scn;
struct
{
longx_tvfill;/∗ tv fill value ∗/
unsigned shortx_tvlen;/∗ length of .tv ∗/
unsigned shortx_tvran[2];/∗ tv range ∗/
}x_tv;/∗ info about .tv section (in auxent of symbol .tv)) ∗/
};
Indexes of symbol table entries begin at zero.
SEE ALSO
a.out(4), linenum(4).
psdb(1) in the CX/UX User’s Reference Manual.
CAVEATS
On machines in which longs are equivalent to ints, they are converted to ints in the compiler to minimize the complexity of the compiler code generator. Thus the information about which symbols are declared as longs and which, as ints, does not show up in the symbol table.
CX/UX Programmer’s Reference Manual