Use linker script to split text section ??
Ashwin Pathmudi
ashwin.pathmudi@gmail.com
Fri Dec 2 17:51:00 GMT 2005
hi,
On 12/2/05, Jer Yu Hsu <zysheu@sslab.cs.nthu.edu.tw> wrote:
> In linker script , I can control the input sections to output sections
> mapping.
>
> If I want one output section split to many subsections , how can I do it ?
>
> ex: output section : .text => (split to subsections) .text_1 + .text_2 +
> .text_3 + ....
>
I dont think you can do this.
>
> Another question, if i want to insert some null code (nop) in .text
> section , how can i do it ?
>
> ex: .text (128K) => 32K code + 2K nop + 32K code + 2K nop+ 32K code + 2K
> nop+ 32K code+ 2K nop ( 128K + 2K x 4 )
>
> every 32K code insett 2K null code .
I dont know if you can split the 128k code into the 32k chunks but you
could fill in
the nop instructions by doing something like this :
SECTION
{
/*...*/
.text :
{
*(.text_1)
. =. + 2000 ;
*(.text_2)
. = + 2000;
}=0x90
/* ... */
}
This will fill in the gaps created by the '. = . + 2000' by 0x90 assuming 0x90
is your nop instruction.
>
>
> If I want to do these , should I need to modify the linker's source code
> or linker script can help i do it ?
The linker scripts are generated. So you'll need to modify the files
creating the linker scripts. You'll find them in ld/scriptempl/<script>.sc.
<script> will be the value of the SCRIPT_NAME variable in the
`emulparams' script.
Usually both the emulparams as well as the scriptempl scripts depend
on the target that you are building for.
HTH,
cheers,
Ashwin Pathmudi.
>
>
> Thanks .
>
More information about the Binutils
mailing list