This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch, avr] Set data section's LMA to AT> text instead of end of .text
- From: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- To: nick clifton <nickc at redhat dot com>
- Cc: <binutils at sourceware dot org>, <chertykov at gmail dot com>
- Date: Fri, 22 Nov 2013 12:52:49 +0530
- Subject: Re: [Patch, avr] Set data section's LMA to AT> text instead of end of .text
- Authentication-results: sourceware.org; auth=none
- References: <20131118124055 dot GC4043 at atmel dot com> <528A35DA dot 1070901 at redhat dot com> <20131119061952 dot GA2108 at atmel dot com> <528B9E84 dot 5050100 at redhat dot com> <20131120074655 dot GA636 at atmel dot com> <528CDF45 dot 2020508 at redhat dot com>
On Wed, Nov 20, 2013 at 04:11:49PM +0000, nick clifton wrote:
> Hi Senthil,
>
> Thanks - I now understand the problem now. You were right with your
> original email, I just did not quite get that the .data section was using an
> explicit LMA assigment which was not taking into account the fact that
> *other* sections might be assigned to the TEXT memory region *after* the
> .text section. So the SIZEOF operator does work - it is just that it only
> returns the size of the .text section, not the size of the .text section and
> any other sections that follow it in the same region.
Ok, I guess I did a clumsy job of explaining the problem :)
>
> So, upon reflection I now agree with your original patch. Please go ahead
> and commit it. I will update the MSP430 linker script with a similar
> change.
I don't have commit access, so could you commit the patch for me please?
I've copy pasted it from the original email below.
>
> Cheers
> Nick
>
> PS. FYI you can avoid using extra linker scripts in the way that you showed
> in your test case. If you change the section attribute in test.c to be:
>
> int x __attribute__((section(".boot,\"ax\",@progbits ;")));
>
> then you do not need a "boot" linker script at all.
Didn't know about that, thanks.
Regards
Senthil
2013-11-18 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
ld/ChangeLog
* scripttempl/avr.sc: Set .data section's LMA to next available
address in text region.
diff --git ld/scripttempl/avr.sc ld/scripttempl/avr.sc
index bfce5fe..5143755 100644
--- ld/scripttempl/avr.sc
+++ ld/scripttempl/avr.sc
@@ -163,7 +163,7 @@ SECTIONS
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > text}
- .data ${RELOCATING-0} : ${RELOCATING+AT (ADDR (.text) + SIZEOF (.text))}
+ .data ${RELOCATING-0} :
{
${RELOCATING+ PROVIDE (__data_start = .) ; }
/* --gc-sections will delete empty .data. This leads to wrong start
@@ -177,7 +177,7 @@ SECTIONS
${RELOCATING+. = ALIGN(2);}
${RELOCATING+ _edata = . ; }
${RELOCATING+ PROVIDE (__data_end = .) ; }
- } ${RELOCATING+ > data}
+ } ${RELOCATING+ > data ${RELOCATING+AT> text}}
.bss ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
{