This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch, avr] Fix PR 13697 without KEEPing .data
- From: Denis Chertykov <chertykov at gmail dot com>
- To: Senthil Kumar Selvaraj <senthil_kumar dot selvaraj at atmel dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, Nick Clifton <nickc at redhat dot com>, Georg Johann Lay <avr at gjlay dot de>
- Date: Thu, 3 Jul 2014 19:46:13 +0400
- Subject: Re: [Patch, avr] Fix PR 13697 without KEEPing .data
- Authentication-results: sourceware.org; auth=none
- References: <20140702115557 dot GA20760 at atmel dot com>
2014-07-02 15:55 GMT+04:00 Senthil Kumar Selvaraj
<senthil_kumar.selvaraj@atmel.com>:
>
> The fix for PR 13697
> (https://sourceware.org/bugzilla/show_bug.cgi?id=13697) added a
> KEEP(*(.data)) to prevent the .bss section from getting an incorrect
> VMA.
>
> The patch fixes the problem, but it also prevents the linker
> from gc'ing .data sections. It also only keeps sections named
> .data, so -fdata-sections could potentially cause the fix to break
> (it works right now because the assembler generates an empty .data section).
>
> The following patch fixes the problem by explicitly setting the
> .bss section's VMA to the end of .data's VMA. It kinda looks redundant,
> as both .data and .bss are assigned to the same region, but is needed because
> the region's ORIGIN is hardcoded whereas the start of .data/.bss varies
> by device (and is passed along as -Tdata=<address> by the compiler
> driver).
>
> Does this look ok? I verified that the testcase mentioned in the
> bug report works fine.
>
> If ok, could someone commit please? I don't have commit access.
>
> Regards
> Senthil
>
> ld/ChangeLog
>
> 2014-07-02 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
>
> * scripttempl/avr.sc: Remove KEEP for .data and
> force .bss VMA to end of .data VMA.
>
Committed.
Denis.