This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, avr] Set data section's LMA to AT> text instead of end of .text


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]