Generating symbol map for flat binary with LD
Posted: Tue Jun 17, 2003 11:00 pm
Anyone know how to generate a file containing addresses and symbols while linking together several objects into a flat binary using LD? Below is the linker script I'm currently using:
OUTPUT_FORMAT(binary)
ENTRY(boot_start)
SECTIONS
{
.text 0x00007C00: {
*(.text)
}
.data : {
*(.data)
}
.bss : {
*(.bss)
}
.rodata : {
*(.rodata)
}
}
and my LD command line is something like:
ld -nostdlib -Bstatic --no-undefined -L./ -T boot.lnk -o boot.bin boot_main.o boot_fs.o
I would like to have a file containing addresses and symbol names something like:
00000000 boot_start
0000004c bootstrap
000001b9 boot_main
...
Which I could then load into bochs's debugger and get easier to fallow debugging:
<bochs:1> load-symbols global "boot.sym" 0x7c00
<bochs:2> lb 0x7c00
<bochs:3> c
(0) Breakpoint 1, 0x7c00 in ?? ()
Next at t=1221697
(0) [0x00007c00] 0000:7c00 (boot_start+0): jmp 7c4c ; eb4a
<bochs:4>
Any ideas?
OUTPUT_FORMAT(binary)
ENTRY(boot_start)
SECTIONS
{
.text 0x00007C00: {
*(.text)
}
.data : {
*(.data)
}
.bss : {
*(.bss)
}
.rodata : {
*(.rodata)
}
}
and my LD command line is something like:
ld -nostdlib -Bstatic --no-undefined -L./ -T boot.lnk -o boot.bin boot_main.o boot_fs.o
I would like to have a file containing addresses and symbol names something like:
00000000 boot_start
0000004c bootstrap
000001b9 boot_main
...
Which I could then load into bochs's debugger and get easier to fallow debugging:
<bochs:1> load-symbols global "boot.sym" 0x7c00
<bochs:2> lb 0x7c00
<bochs:3> c
(0) Breakpoint 1, 0x7c00 in ?? ()
Next at t=1221697
(0) [0x00007c00] 0000:7c00 (boot_start+0): jmp 7c4c ; eb4a
<bochs:4>
Any ideas?