At 03:30 7/6/00, Nick Behnken wrote:
>Ok Ramon... explain what does the link map do and how do I create one?

When you compile sources with GCC, it creates an ELF file; in this file, code
and data are arranged into sections.  The link map defines, which section
is put at which address in memory.

Usually you use the standard system linkmap for applications.  However, for
kernels you may want to use your own linkmap.  The texinfo documentation for
ld describes how to make and use linkmaps; I suggest you read it.

I unfortunately do not have the ld docs handy here, but based on a piece of
code I wrote a long time ago, I believe this linkmap should work:

--------------------------------------------------------------------------------

OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)

ENTRY(_start)

PHDRS
{
    text    PT_LOAD ;
    data    PT_LOAD ;
}

SECTIONS
{
    . = 0x100000;

    _text = .;

    .text   : { *(.text)   } :text
    .rodata : { *(.rodata) } :text

    _etext = .;

    .data : { *(.data) } :data

    _edata = .;

    .bss : { *(.bss) } :data

    _end = .;
}

--------------------------------------------------------------------------------

-- Ramon



Reply via email to