This is the mail archive of the
mailing list for the binutils project.
Re: [Patch,AVR]: Fix PR13697: Wrong symbols with --gc-sections
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: binutils at sourceware dot org, Denis Chertykov <chertykov at gmail dot com>, Marek Michalkiewicz <marekm at amelek dot gda dot pl>, Eric Weddington <eric dot weddington at atmel dot com>
- Date: Tue, 29 May 2012 08:29:25 +0200
- Subject: Re: [Patch,AVR]: Fix PR13697: Wrong symbols with --gc-sections
- References: <4FC34A3D.email@example.com> <alpine.BSF.firstname.lastname@example.org>
Hans-Peter Nilsson schrieb:
On Mon, 28 May 2012, Georg-Johann Lay wrote:
This bug is because an empty .data will be removed by the ld machinery.
I think that bug has been fixed, at least, if you add a
symbol-setting (one without PROVIDE) which seems slightly better
than decorating input .data sections with KEEP, which just stops
--gc-sections for *any* input .data.
* scripttempl/avr.sc (.data): Keep it.
(bah, I have to cutnpaste; pine doesn't quote attachments):
+ /* --gc-sections will delete empty .data. This leads to wrong start
+ addresses for subsequent sections because -Tdata= from the command
+ line will have no effect, see PR13697. Thus, keep .data */
+ KEEP (*(.data))
"KEEP" is a decoration, not a separate statement. At a minimum,
drop the first "*(.data). It's at least confusing, but might
add a second copy, I'm not sure.
I am definitely no linker hero... it's just like
*(.init0) /* Start here after reset. */
and many others. So all this in the avr ls script is plain wrong?
Try without --gc-sections and gc:able .data.
er... sorry, would you outline this? I searched for "gc:able"
documentation but with no avail.
Though, adding a symbol should do it, at least for a corrected
You mean adding a symbol to .data by letting the compiler add a symbol
in .data for each module?