This is the mail archive of the 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 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.


2013-11-18  Senthil Kumar Selvaraj <>


	* scripttempl/ Set .data section's LMA to next available
	address in text region.

diff --git ld/scripttempl/ ld/scripttempl/
index bfce5fe..5143755 100644
--- ld/scripttempl/
+++ ld/scripttempl/
@@ -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))}

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