[Patch,AVR]: Fix PR13697: Wrong symbols with --gc-sections

Georg-Johann Lay avr@gjlay.de
Thu May 31 06:42:00 GMT 2012


Alan Modra schrieb:
> On Tue, May 29, 2012 at 03:37:45PM -0400, Hans-Peter Nilsson wrote:
>> On Tue, 29 May 2012, Georg-Johann Lay wrote:
>>> At the start of .bss the location counter is moved backwards!
>>> I still think this is a linker bug.
>> Well yes, but the point was that the bug is not the linker
>> script's lack of KEEP.
> 
> Whether or not this is a bug depends on how you think zero size
> discarded output sections should be treated.

However the treatment with --gc-sections is, if you read the map
and observe that the location pointer is moved /backwards/ then
it's clearly a bug.

.data           0x00800100        0x0 load address 0x0000009e
                 0x00800100                PROVIDE (__data_start, .)
  *(.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


> Johann seems to want this latter behaviour judging from his
> comment about optimisation.

It's just plain wrong to move . backwards!

> +FAIL: ld-scripts/empty-address-2a
> +FAIL: ld-scripts/empty-address-2b
> 
> Seems someone wants this behaviour enough to write a testcase.

Moving location backwards???

Johann



More information about the Binutils mailing list