This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Use linker script to split text section ??
- From: Ashwin Pathmudi <ashwin dot pathmudi at gmail dot com>
- To: Jer Yu Hsu <zysheu at sslab dot cs dot nthu dot edu dot tw>
- Cc: binutils at sourceware dot org
- Date: Fri, 2 Dec 2005 23:21:18 +0530
- Subject: Re: Use linker script to split text section ??
- References: <438FE96F.6000808@sslab.cs.nthu.edu.tw>
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 .
>