A symbol
The symbol table sits between the data and the relocation table; the header gives its length. It is a debugger’s help and most released programs have none (the header size is 0). In the Digital Research (DRI) format every entry is 14 bytes:
| Offset | Size | Field |
|---|---|---|
| 0 | 8 bytes | The name; a shorter name is ended by a 0 byte. |
| 8 | word | The type: a set of flag bits (below). |
| 10 | long | The value, an address. The explorer reads it as an offset from the start of the text. |
Types
| Bit | Meaning |
|---|---|
$0100 | in the BSS |
$0200 | in the text |
$0400 | in the data |
$0800 | external |
$1000 | register |
$2000 | global |
$4000 | equated |
$8000 | defined |
$0280 and $02C0 | the start of an object module and of a library (text plus extra bits) |
Long names
A name longer than 8 characters sets both bits of $0048 in the type, and the next 14-byte entry holds the rest of the name (up to 14 more characters: 22 in all; the GNU linker
truncates longer ones). The explorer joins the two and shows the entry as one symbol 28 bytes long.
What the explorer shows
The symbol table is a node with one child per symbol (the first 1500) and a Symbols table with name, type and value. Each symbol becomes a label at its value (relative to the
load address) in the disassembly, and the program’s start is labelled start when no symbol is there. A table whose size is not a multiple of 14 is reported as a problem:
Pure C and the GNU linker write their own symbol formats.
Not described
Known, not yet covered
- Reference: the types and entry size are from the FreeMiNT TOS documentation and the GNU linker source, read through summaries. The documentation says nothing about the long-name form (taken from the linker source) and that the value is relative to the start of the text rather than to its own segment is an assumption of the viewer: no real program with a symbol table was available. The Pure C, Alcyon extended and GNU a.out symbol formats are not described.
- Viewer: checked on built symbol tables only; no real one.
Links
Reference
- GEMDOS programs – FreeMiNT TOS documentation: the DRI symbol table and the type bits
- prg-mint.c – BFD code: the DRI symbol structure and the long-name bit