[Bug ld/13697] New: [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

 Bug #: 13697
   Summary: [avr ] Wrong symbol values with --gc-sections
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: g...@gcc.gnu.org
Classification: Unclassified


Suppose the following small C program:

int main (void)
{
extern char __heap_start;
return (int) & __heap_start;
}

Compile with:

avr-gcc heap-start.c -mmcu=atmega168 -o heal-start.elf -Os -save-temps
-Wl,-Map,heap-start.map -Wl,--gc-sections

Assembler output is:


.file"heap-start.c"
__SP_H__ = 0x3e
__SP_L__ = 0x3d
__SREG__ = 0x3f
__tmp_reg__ = 0
__zero_reg__ = 1
.section.text.startup,"ax",@progbits
.globalmain
.typemain, @function
main:
.L__stack_usage = 0
ldi r24,lo8(__heap_start)
ldi r25,hi8(__heap_start)
ret
.sizemain, .-main
.ident"GCC: (GNU) 4.7.0 20120206 (experimental)"


ATmega168 has RAM start at 0x100 but the generated map file reads

...
 *(.data)
 *(.data*)
 *(.rodata)
 *(.rodata*)
 *(.gnu.linkonce.d*)
0x00800100. = ALIGN (0x2)
0x00800100_edata = .
0x00800100PROVIDE (__data_end, .)

.bss0x008000600x0
0x00800060PROVIDE (__bss_start, .)
 *(.bss)
 *(.bss*)
 *(COMMON)
0x00800060PROVIDE (__bss_end, .)
0x008a__data_load_start = LOADADDR (.data)
0x008a__data_load_end = (__data_load_start
+ SIZEOF (.data))

.noinit 0x008000600x0
0x00800060PROVIDE (__noinit_start, .)
 *(.noinit*)
0x00800060PROVIDE (__noinit_end, .)
0x00800060_end = .
0x00800060PROVIDE (__heap_start, .)
...

That is obviously wrong because .bss starts at RAM 0x60.

Notice that the program does not define data in the static storage.
If data in static storage is added or --gc-sectons is removed, the values are
as expected.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

Georg-Johann Lay  changed:

   What|Removed |Added

 Target||avr
 CC||eric.weddington at atmel
   ||dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

--- Comment #1 from Georg-Johann Lay  2012-02-16 
10:21:47 UTC ---
Created attachment 6217
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6217
heap-start.s

avr-gcc's assembler output

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

--- Comment #3 from Georg-Johann Lay  2012-02-16 
10:26:29 UTC ---
Created attachment 6219
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6219
Console Output with -v -Wl,-v

Console output for the following command:

avr-gcc heap-start.c -mmcu=atmega168 -o heal-start.elf -Os -save-temps
-Wl,-Map,heap-start.map -Wl,--gc-sections -v -Wl,-v

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

--- Comment #2 from Georg-Johann Lay  2012-02-16 
10:22:58 UTC ---
Created attachment 6218
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6218
heap-start.map

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

--- Comment #4 from Georg-Johann Lay  2012-02-16 
10:32:07 UTC ---
Created attachment 6220
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6220
heal-start.elf: Disassembly from avr-objdump -d

avr-objdump -d heal-start.elf | grep -A 3 ':'

0080 :
  80:   80 e6   ldi r24, 0x60   ; 96
  82:   90 e0   ldi r25, 0x00   ; 0
  84:   08 95   ret

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

Georg-Johann Lay  changed:

   What|Removed |Added

 CC||childbear0 at gmail dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread amodra at gmail dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #5 from Alan Modra  2012-02-16 11:51:57 
UTC ---
I think this pain is self-inflicted.

You're using -m avr5 -Tdata 0x800100 instead of -m avr51.  So you get the avr5
ld script with the data section fudged to be at 0x800100.  However, the data
section is stripped by -gc-sections.  So the address change doesn't affect
following sections.  They stay at the avr5 data memory region of 0x800060.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/13697] [avr ] Wrong symbol values with --gc-sections

2012-02-16 Thread gjl at gcc dot gnu.org
http://sourceware.org/bugzilla/show_bug.cgi?id=13697

--- Comment #6 from Georg-Johann Lay  2012-02-16 
12:30:29 UTC ---
(In reply to comment #5)
> I think this pain is self-inflicted.
> 
> You're using -m avr5 -Tdata 0x800100 instead of -m avr51.  So you get the avr5
> ld script with the data section fudged to be at 0x800100.  However, the data
> section is stripped by -gc-sections.  So the address change doesn't affect
> following sections.  They stay at the avr5 data memory region of 0x800060.

atmega168 is element of avr5 and not element of avr51 (avr51 has ELPM
instruction for example. ATmega168 has no ELPM).

avr-gcc mixes devices with different RAM-start in the same core architecture,
see mcu-devices.def:

http://gcc.gnu.org/viewcvs/trunk/gcc/config/avr/avr-mcus.def?revision=184276&content-type=text%2Fplain&view=co

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/4933] windres does not escape path with spaces in them

2012-02-16 Thread manus at eiffel dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=4933

--- Comment #6 from Emmanuel Stapf  2012-02-16 
23:42:09 UTC ---
I'm still following this bug. So far I've been using the workaround
successfully. I'll try on more time without the `--preprocessor' option and
report back.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils