On Wed, 27 Oct 1999, Benjamin Herrenschmidt wrote:
> I beleive this could be improved by using linker tricks to have the
> linker store this size in a place where the code can fetch it via
> pc-relative access, but I don't know ld well enough to write such a script.

Excuse me for the delay, I just read the ld documentation last night.
(http://www.gnu.org/manual/ld-2.9.1/html_mono/ld.html)

Hey the elfbios.lds script is already there, almost good!

There are errors in it however:
>SECTIONS
>{
>  _text = .;                   /* Text and read-only data      */
>  .text : {
>        *(.text)
>        *(.fixup)
>        *(.gnu.warning)
>        *(.rodata)
>  }
>  _etext = .;                  /* End of text section          */
>
>  _data = .;
>  .data : {                    /* Data                         */
>        *(.data)
>        }
>
>  _edata = .;                  /* End of data section          */
>
>  _bss_start = .;              /* BSS                          */
>  .bss : {
>        *(.bss)
>        }
>  _end = . ;
>}

_text and _data (_etext and _edata as well for aesthetic reasons) should
be _inside_ .text et .data sections definitions because .text et .data value
are forced by Makefile variables TEXTADDR and DATAADDR.
So right now _text is 0,
.text is forced by Makefile to 0x41000C0 (providing I use bank 0), 
_etext= 0x4100xxxx
Therefore _etext - _text = 4100xxxx instead of xxxx.

Same thing with _data = 0x4100xxxx , 
.data is force by Makefile to 0x1000
_edata 0x1xxx and
_edata - data = BEFFxxxx
A really Bad Thing! 

We can even calculate the size value at link time by creating new symbols like
_sz_data = _edata - _data;
or even
_sz_data = SIZEOF(.data)
which are equivalent.

I therefore propose the corrected following  elfbios.lds:
>SECTIONS
>{
>                       /* Text and read-only data      */
>  .text : {
>        _text = .;
>        *(.text)
>        *(.fixup)
>        *(.gnu.warning)
>        *(.rodata)
>         _etext = .;   /* End of text section          */
>  }
>  _sz_text = SIZEOF(.text) ;
>
>  _data = .;
>  .data : {                    /* Data                         */
>        *(.data)
>        }
>
>  _edata = .;                  /* End of data section          */
> _sz_data = SIZEOF(.data) ;
>
>               /* BSS                          */
>  .bss : {
>       _bss_start = .;  
>      *(.bss)
>       _end = . ;
>        }
>  _sz_bss = SIZEOF(.bss)
>}

What do we think?
-- 
Fran�ois Desloges
[EMAIL PROTECTED]
unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]

Reply via email to