This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch,AVR]: Fix PR13697: Wrong symbols with --gc-sections
Hans-Peter Nilsson schrieb:
On Tue, 29 May 2012, Georg-Johann Lay wrote:
Hans-Peter Nilsson schrieb:
Though, adding a symbol should do it, at least for a corrected
linker.
You mean adding a symbol to .data by letting the compiler add a symbol
in .data for each module?
No, I mean add a symbol in the linker script, like
${RELOCATING+ ___data_start_reserved = .) ; }
(i.e. another one like there is, but without the PROVIDE decoration).
I tried this:
.data : AT (ADDR (.text) + SIZEOF (.text))
{
PROVIDE (__data_start = .) ;
__pr__ = .;
*(.data)
But with no avail. The map file shows that .data starts at 0x100,
just as without the __pr__, but .bss is wrong and overlaps I/O:
.data 0x00800100 0x0 load address 0x0000009e
0x00800100 PROVIDE (__data_start, .)
0x00800100 __pr__ = .
*(.data)
*(.data*)
*(.rodata)
*(.rodata*)
*(.gnu.linkonce.d*)
0x00800100 . = ALIGN (0x2)
0x00800100 _edata = .
0x00800100 PROVIDE (__data_end, .)
.bss 0x00800060 0x2
0x00800060 PROVIDE (__bss_start, .)
*(.bss)
.bss 0x00800060 0x2 foo.o
0x00800060 aaa
At the start of .bss the location counter is moved backwards!
I still think this is a linker bug.
An optimization should never ever change the semantic of a program!