Interpreting Map files
Chris Holman
chrish@owl.co.uk
Thu May 18 07:51:00 GMT 2000
I am trying to understand how a linker script for gnu ld.exe works so that I
can re-write it for the ecos configuration utility.
After reading the manual for LD I thought I had a reasonable understanding
of how it worked, until I came across the following.
A snippet of the linker file reads,
############# Linker file start
USR_SP = 0x00000000 ;
SV_UNCACHE_SP = 0xa0000000 ;
SZ_ROM = 0 ;
SZ_RAM = 0 ;
/* The .text section is located at address passed in command line
e.g. -Ttext=0x40000000 */
.text :
{
_stext = .;
*reset.o(.text_boot) /* Boot Section locate at first */
*reset.o(.text) /* Boot Section locate at first */
} =0
ROM_START = ADDR(.text) ;
ROM_OFFSET = ROM_START & 0x1fffffff ;
SZ_ROM += SIZEOF(.text) ;
/* place .text_mon in uncacheable area */
.text_mon (SV_UNCACHE_SP + ROM_OFFSET + SZ_ROM) : AT (ROM_START + SZ_ROM)
{
*mainmon.o(.text_boot)
*mainmon.o(.text)
############# Linker file end
The application is built and the equivalent section of the map file is
displayed below.
############# map file start
0x00000000 USR_SP=0x0
0xa0000000 SV_UNCACHE_SP=0xa0000000
0x00000000 SZ_ROM=0x0
0x00000000 SZ_RAM=0x0
.text 0x40000000 0x8bc
0x40000000 _stext=.
*reset.o(.text_boot)
.text_boot 0x40000000 0x8bc /pie1.5/release/lib/reset.o
0x40000065 start_up
0x40000308 get_reset_info
0x4000084b scard_check
0x400005ac ram_acc_check
0x400007e2 speed_check
0x40000000 KNL_boot_boot
0x4000012c KNL_boot_post
0x400003bc set_ex_bus
0x40000570 rom_acc_check
0x400002f6 KNL_boot_dumphandler
0x4000041e set_opt_ex_bus
0x40000010 fatal_vec
0x40000360 set_bcu
0x40000891 buserr_check
0x4000071e ack_check
0x40000280 KNL_boot_nmihandler
0x40000008 nmi_vec
0x40000694 cs3_check
0x40000362 set_heg
0x40000755 cs_swap_check
*reset.o(.text)
0x40000000 ROM_START=ADDR(.text)
0x00000000 ROM_OFFSET=(ROM_START&0x1fffffff)
0x0004b244 SZ_ROM=(SZ_ROM+SIZEOF(.text))
.text_mon 0xa00008bc 0x1286 load address 0x4004a988
*mainmon.o(.text_boot)
.text_boot 0xa00008bc 0x21e /pie1.5/release/lib/boot.a(mainmon.o)
############# map file end
My confusion starts here.
1) Why is the last calculation of SZ_ROM not equal to (0 + 0x8bc)?
2) How is the load address for .text_mon arrived at? It doesn't seem to fit
with the calcualtion used.
I'm sure I'm missing something here?
Are there any good references or guides to interpreting the map file or how
the linker comes up with these addresses?
Regards,
Chris Holman
European Support Coordinator,
Panasonic OWL, 2 Anderson Place,
EDINBURGH, EH6 5NP
Tel: 0131 5611041
e-mail: chris.holman@owl.co.uk
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list