2.4.3.6 Symbol Table

A symbol table is present if the -as option is given to the assembler. A list of defined symbols and a list of undefined symbols will be given.

The defined symbols will have the format:

DEFINED SYMBOLS
<filename>:<line #> <section>:<addr> <symbol>

For example:

DEFINED SYMBOLS
foo.S:79     .text:00000000 main
foo.S:107    .text:00000014 mPORTAClearBits

The undefined symbols will have the format:

UNDEFINED SYMBOLS
<symbol>

For example:

UNDEFINED SYMBOLS
WDTCON
WDTCONCLR

Sample Assembler Listing File

GAS LISTING foo.s page 1
1 # 1 “foo.S”
2 # 1 “<built-in>”
1 .nolist
0
0
3 .list
4
5 #define IOPORT_BIT_7 (1 << 7)
6
8 .global baz /* define all global symbols here */
9
10 /* define which section (for example “text”)
11 * does this portion of code resides in.
12 * Typically, all of your code will reside in
* the .text section as shown.
14 */
15 .text
16
17 /* This is important for an assembly programmer.
18 * This directive tells the assembler not to
19 * optimize the order of the instructions
20 * as well as not to insert 'nop' instructions
21 * after jumps and branches.
22 */
23 .set noreorder
24
25 .ent baz /* directive that marks symbol 'baz' as
26 * a function in ELF output
27 */
28
29 baz:
30
31 /* Call function to clear bit relevant to pin
32 * 7 in port A. The 'jal' instruction places
33 * the return address in $ra.
34 */
35 0000 80000434 ori $a0, $zero, IOPORT_BIT_7
36 0004 0500000C jal mPORTAClearBits
37 0008 00000000 nop
38
39 /* endless loop */
40 endless:
41 000c 03000008 j endless
42 0010 00000000 nop
43
44 .end baz /* directive that marks end of 'baz'
45 * function and registers size in ELF
46 * output
47 */
DEFINED SYMBOLS
*ABS*:00000000 foo.S
*ABS*:00000001 __DEBUG
foo.S:56 .text:00000014 mPORTAClearBitsfoo.S:38 .text:0000000c endless