This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[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: <binutils at sourceware dot org>
- Cc: <nickc at redhat dot com>, <chertykov at gmail dot com>
- Date: Mon, 18 Nov 2013 18:10:56 +0530
- Subject: [Patch, avr] Set data section's LMA to AT> text instead of end of .text
- Authentication-results: sourceware.org; auth=none
Hi,
This patch sets the LMA for the .data section to the next available
address in the text region (AT> text), rather than ADDR(.text) + SIZE(.text).
This prevents address overlap errors from the linker if there are
other sections (unknown to the default linker script) that go into the text region.
However, I see that the MSP430 port also sets the LMA for .data by adding
naming sections and adding section sizes. Am I missing something?
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))}
{