public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29141] New: static constructors beyond 64k fail
@ 2006-09-19 13:26 joerg dot diederich at graffiti dot net
2006-09-19 13:29 ` [Bug c++/29141] " joerg dot diederich at graffiti dot net
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: joerg dot diederich at graffiti dot net @ 2006-09-19 13:26 UTC (permalink / raw)
To: gcc-bugs
Contruction of global static objects fails while using flash adresses over
0xFFFF, e.g. for bootloader purposes. avr mcu hangs completly before main or
even the called constructor itself.
minimal gcc call:
avr-c++ -c -mmcu=at90can128 -I. -I. -g -O0 -Wall -Wextra -Wshadow
-Wpointer-arith -Wcast-align -Wsign-compare -Waggregate-return -Wunused
-fno-exceptions a_test.cpp -o a_test.o
linked with the following options
-Wl,-Map=a_test.map,--cref,--section-start=.text=0x1F000
short example code in attachment.
--
Summary: static constructors beyond 64k fail
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: joerg dot diederich at graffiti dot net
GCC host triplet: Linux 2.6.16-1.2111_FC4 i686 athlon i386 GNU/Linux
GCC target triplet: avr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/29141] static constructors beyond 64k fail
2006-09-19 13:26 [Bug c++/29141] New: static constructors beyond 64k fail joerg dot diederich at graffiti dot net
@ 2006-09-19 13:29 ` joerg dot diederich at graffiti dot net
2006-09-19 13:37 ` joerg dot diederich at graffiti dot net
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: joerg dot diederich at graffiti dot net @ 2006-09-19 13:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from joerg dot diederich at graffiti dot net 2006-09-19 13:28 -------
Created an attachment (id=12297)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12297&action=view)
example source file
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/29141] static constructors beyond 64k fail
2006-09-19 13:26 [Bug c++/29141] New: static constructors beyond 64k fail joerg dot diederich at graffiti dot net
2006-09-19 13:29 ` [Bug c++/29141] " joerg dot diederich at graffiti dot net
@ 2006-09-19 13:37 ` joerg dot diederich at graffiti dot net
2007-02-02 22:19 ` [Bug target/29141] " pete at vavaroutsos dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: joerg dot diederich at graffiti dot net @ 2006-09-19 13:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from joerg dot diederich at graffiti dot net 2006-09-19 13:36 -------
thanks to joerg wunsch, additional information is already available.
#ifdef L_ctors
.section .init6,"ax",@progbits
.global __do_global_ctors
__do_global_ctors:
ldi r17, hi8(__ctors_start)
ldi r28, lo8(__ctors_end)
ldi r29, hi8(__ctors_end)
rjmp .do_global_ctors_start
.do_global_ctors_loop:
sbiw r28, 2
mov_h r31, r29
mov_l r30, r28
XCALL __tablejump__
.do_global_ctors_start:
cpi r28, lo8(__ctors_start)
cpc r29, r17
brne .do_global_ctors_loop
#endif /* L_ctors */
using r28/r29 only works for data <64k. r30/r31 are filled with wrong data in
return, in detail 64k less than intended.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/29141] static constructors beyond 64k fail
2006-09-19 13:26 [Bug c++/29141] New: static constructors beyond 64k fail joerg dot diederich at graffiti dot net
2006-09-19 13:29 ` [Bug c++/29141] " joerg dot diederich at graffiti dot net
2006-09-19 13:37 ` joerg dot diederich at graffiti dot net
@ 2007-02-02 22:19 ` pete at vavaroutsos dot com
2008-10-30 16:05 ` eric dot weddington at atmel dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: pete at vavaroutsos dot com @ 2007-02-02 22:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pete at vavaroutsos dot com 2007-02-02 22:19 -------
I too have ran into this problem. The code in __tablejump__ that calls the
constructors is using LPM instructions instead of ELPM, so the value in the
RAMPZ register is being ignored. Thus a bad pointer to the constructor is
fetched.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/29141] static constructors beyond 64k fail
2006-09-19 13:26 [Bug c++/29141] New: static constructors beyond 64k fail joerg dot diederich at graffiti dot net
` (2 preceding siblings ...)
2007-02-02 22:19 ` [Bug target/29141] " pete at vavaroutsos dot com
@ 2008-10-30 16:05 ` eric dot weddington at atmel dot com
2009-01-12 20:42 ` aesok at gcc dot gnu dot org
2009-01-28 17:53 ` aesok at gcc dot gnu dot org
5 siblings, 0 replies; 9+ messages in thread
From: eric dot weddington at atmel dot com @ 2008-10-30 16:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from eric dot weddington at atmel dot com 2008-10-30 16:03 -------
See also WinAVR bug #2209796 on SourceForge:
https://sourceforge.net/tracker/?func=detail&atid=520074&aid=2209796&group_id=68108
--
eric dot weddington at atmel dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-10-30 16:03:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/29141] static constructors beyond 64k fail
2006-09-19 13:26 [Bug c++/29141] New: static constructors beyond 64k fail joerg dot diederich at graffiti dot net
` (3 preceding siblings ...)
2008-10-30 16:05 ` eric dot weddington at atmel dot com
@ 2009-01-12 20:42 ` aesok at gcc dot gnu dot org
2009-01-28 17:53 ` aesok at gcc dot gnu dot org
5 siblings, 0 replies; 9+ messages in thread
From: aesok at gcc dot gnu dot org @ 2009-01-12 20:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from aesok at gcc dot gnu dot org 2009-01-12 20:42 -------
Subject: Bug 29141
Author: aesok
Date: Mon Jan 12 20:41:57 2009
New Revision: 143306
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=143306
Log:
PR target/29141
* config/avr/t-avr (LIB1ASMFUNCS): Add _tablejump_elpm.
* config/avr/libgcc.S (__do_global_ctors, __do_global_dtors): Add
variant for devices with 3-byte PC.
(__tablejump_elpm__) : New.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/avr/libgcc.S
trunk/gcc/config/avr/t-avr
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/29141] static constructors beyond 64k fail
2006-09-19 13:26 [Bug c++/29141] New: static constructors beyond 64k fail joerg dot diederich at graffiti dot net
` (4 preceding siblings ...)
2009-01-12 20:42 ` aesok at gcc dot gnu dot org
@ 2009-01-28 17:53 ` aesok at gcc dot gnu dot org
5 siblings, 0 replies; 9+ messages in thread
From: aesok at gcc dot gnu dot org @ 2009-01-28 17:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from aesok at gcc dot gnu dot org 2009-01-28 17:53 -------
Fixed.
--
aesok at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/29141] static constructors beyond 64k fail
[not found] <bug-29141-4@http.gcc.gnu.org/bugzilla/>
2010-11-26 21:01 ` mschulze at ivs dot cs.ovgu.de
@ 2010-11-29 22:21 ` gcc@d-silva.org
1 sibling, 0 replies; 9+ messages in thread
From: gcc@d-silva.org @ 2010-11-29 22:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
Alastair D'Silva <gcc@d-silva.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc@d-silva.org
--- Comment #8 from Alastair D'Silva <gcc@d-silva.org> 2010-11-29 21:39:37 UTC ---
Michael,
I agree. I authored the other patch, but did not have enough knowledge of GCC
for a proper solution. The patch offered in bug 45263 was a workaround based on
what I could observe.
Could you please offer a patch? I can test it and add it to MHV AVR Tools.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/29141] static constructors beyond 64k fail
[not found] <bug-29141-4@http.gcc.gnu.org/bugzilla/>
@ 2010-11-26 21:01 ` mschulze at ivs dot cs.ovgu.de
2010-11-29 22:21 ` gcc@d-silva.org
1 sibling, 0 replies; 9+ messages in thread
From: mschulze at ivs dot cs.ovgu.de @ 2010-11-26 21:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29141
Michael Schulze <mschulze at ivs dot cs.ovgu.de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mschulze at ivs dot
| |cs.ovgu.de
--- Comment #7 from Michael Schulze <mschulze at ivs dot cs.ovgu.de> 2010-11-26 19:21:00 UTC ---
In my opinion this bug is still pending and not fixed. The proposed fix uses
register r20 but this could be clobbered by constructor that are called,
leading to destructing the exit condition of the __do_global_ctors loop. In new
version of gcc (see bug 45263 but still not confirmed) this is weakly fixed by
pushing and poping r20 around the constructor call.
I would suggest using a register between r2-r17 instead of r20. According to
the compiler abi this should be a register that the called routine has to save
if it needs to use it.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-11-29 21:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-19 13:26 [Bug c++/29141] New: static constructors beyond 64k fail joerg dot diederich at graffiti dot net
2006-09-19 13:29 ` [Bug c++/29141] " joerg dot diederich at graffiti dot net
2006-09-19 13:37 ` joerg dot diederich at graffiti dot net
2007-02-02 22:19 ` [Bug target/29141] " pete at vavaroutsos dot com
2008-10-30 16:05 ` eric dot weddington at atmel dot com
2009-01-12 20:42 ` aesok at gcc dot gnu dot org
2009-01-28 17:53 ` aesok at gcc dot gnu dot org
[not found] <bug-29141-4@http.gcc.gnu.org/bugzilla/>
2010-11-26 21:01 ` mschulze at ivs dot cs.ovgu.de
2010-11-29 22:21 ` gcc@d-silva.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).