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: Wed, 20 Nov 2013 13:16:55 +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>
On Tue, Nov 19, 2013 at 05:23:16PM +0000, nick clifton wrote:
> Hi Senthil,
>
> >It does work if the input section is assigned to the .text output
> >section - it doesn't if gets assigned to the text MEMORY region.
>
> Umm - can you provide a small example for us to examine please ?
>
Sure.
â cat test.c
int y = 2;
int x __attribute__((section(".boot")));
int main()
{
return x;
}
â cat boot
SECTIONS
{
.boot :
{
*(.boot)
} > text
}
â ~/avr/install/bin/avr-gcc -mmcu=atmega1280 test.c boot
/home/saaadhu/avr/install/lib/gcc/avr/4.8.1/../../../../avr/bin/ld: warning: boot contains output sections; did you forget -T?
/home/saaadhu/avr/install/lib/gcc/avr/4.8.1/../../../../avr/bin/ld: section .boot loaded at [0000000000000130,0000000000000131] overlaps section .data loaded at [0000000000000130,0000000000000131]
collect2: error: ld returned 1 exit status
It works ok if the section is not assigned to the text MEMORY
region i.e. without > text. And it obviously works if the .text
output section contains *(.boot). I'm presuming this is because the .data
section's LMA is explicitly set to start where .text ends, and both .data
and .boot compete for that slot. Did I get that wrong?
Regards
Senthil