* [Patch,AVR]: Fix PR45263
@ 2011-04-01 18:20 Georg-Johann Lay
2011-04-01 22:06 ` Georg-Johann Lay
0 siblings, 1 reply; 9+ messages in thread
From: Georg-Johann Lay @ 2011-04-01 18:20 UTC (permalink / raw)
To: gcc-patches; +Cc: Denis Chertykov, Anatoly Sokolov, Eric Weddington
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
This is straight forward fix for PR45263 (R20 clobbered by
constructor/destructor).
Using call-saved register like R15 is undesired because upcoming
ATtiny10 architecture.
2011-04-01 Georg-Johann Lay <avr@gjlay.de>
PR target/45263
* config/avr/libgcc.S (__do_global_ctors, __do_global_dtors): Save
R20 around calls of __tablejump_elpm__
[-- Attachment #2: pr45263.diff --]
[-- Type: text/x-patch, Size: 612 bytes --]
Index: config/avr/libgcc.S
===================================================================
--- config/avr/libgcc.S (Revision 171824)
+++ config/avr/libgcc.S (Arbeitskopie)
@@ -802,7 +802,9 @@ __do_global_ctors:
mov_h r31, r29
mov_l r30, r28
out __RAMPZ__, r20
+ push r20
XCALL __tablejump_elpm__
+ pop r20
.L__do_global_ctors_start:
cpi r28, lo8(__ctors_start)
cpc r29, r17
@@ -843,7 +845,9 @@ __do_global_dtors:
mov_h r31, r29
mov_l r30, r28
out __RAMPZ__, r20
+ push r20
XCALL __tablejump_elpm__
+ pop r20
.L__do_global_dtors_start:
cpi r28, lo8(__dtors_end)
cpc r29, r17
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch,AVR]: Fix PR45263
2011-04-01 18:20 [Patch,AVR]: Fix PR45263 Georg-Johann Lay
@ 2011-04-01 22:06 ` Georg-Johann Lay
2011-04-01 22:29 ` Weddington, Eric
0 siblings, 1 reply; 9+ messages in thread
From: Georg-Johann Lay @ 2011-04-01 22:06 UTC (permalink / raw)
To: Georg-Johann Lay
Cc: gcc-patches, Denis Chertykov, Anatoly Sokolov, Eric Weddington
[-- Attachment #1: Type: text/plain, Size: 397 bytes --]
This is a better fix that does not need push/pop and does not increase
numer of instructions.
r16 takes the role of r20, and the value formerly in r16,
i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
2011-04-02 Georg-Johann Lay <avr@gjlay.de>
PR target/45263
* config/avr/libgcc.S (__do_global_ctors, __do_global_dtors): Don't use
r20 around calls of __tablejump_elpm__
[-- Attachment #2: pr45263-v2.diff --]
[-- Type: text/plain, Size: 1509 bytes --]
Index: libgcc.S
===================================================================
--- libgcc.S (Revision 171857)
+++ libgcc.S (Arbeitskopie)
@@ -791,22 +791,22 @@
#if defined(__AVR_HAVE_RAMPZ__)
__do_global_ctors:
ldi r17, hi8(__ctors_start)
- ldi r16, hh8(__ctors_start)
ldi r28, lo8(__ctors_end)
ldi r29, hi8(__ctors_end)
- ldi r20, hh8(__ctors_end)
+ ldi r16, hh8(__ctors_end)
rjmp .L__do_global_ctors_start
.L__do_global_ctors_loop:
sbiw r28, 2
- sbc r20, __zero_reg__
+ sbc r16, __zero_reg__
mov_h r31, r29
mov_l r30, r28
- out __RAMPZ__, r20
+ out __RAMPZ__, r16
XCALL __tablejump_elpm__
.L__do_global_ctors_start:
cpi r28, lo8(__ctors_start)
cpc r29, r17
- cpc r20, r16
+ ldi r24, hh8(__ctors_start)
+ cpc r16, r24
brne .L__do_global_ctors_loop
#else
__do_global_ctors:
@@ -832,22 +832,22 @@
#if defined(__AVR_HAVE_RAMPZ__)
__do_global_dtors:
ldi r17, hi8(__dtors_end)
- ldi r16, hh8(__dtors_end)
ldi r28, lo8(__dtors_start)
ldi r29, hi8(__dtors_start)
- ldi r20, hh8(__dtors_start)
+ ldi r16, hh8(__dtors_start)
rjmp .L__do_global_dtors_start
.L__do_global_dtors_loop:
sbiw r28, 2
- sbc r20, __zero_reg__
+ sbc r16, __zero_reg__
mov_h r31, r29
mov_l r30, r28
- out __RAMPZ__, r20
+ out __RAMPZ__, r16
XCALL __tablejump_elpm__
.L__do_global_dtors_start:
cpi r28, lo8(__dtors_end)
cpc r29, r17
- cpc r20, r16
+ ldi r24, hh8(__dtors_end)
+ cpc r16, r24
brne .L__do_global_dtors_loop
#else
__do_global_dtors:
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [Patch,AVR]: Fix PR45263
2011-04-01 22:06 ` Georg-Johann Lay
@ 2011-04-01 22:29 ` Weddington, Eric
2011-04-04 14:03 ` Georg-Johann Lay
0 siblings, 1 reply; 9+ messages in thread
From: Weddington, Eric @ 2011-04-01 22:29 UTC (permalink / raw)
To: Georg-Johann Lay; +Cc: gcc-patches, Denis Chertykov, Anatoly Sokolov
> -----Original Message-----
> From: Georg-Johann Lay [mailto:avr@gjlay.de]
> Sent: Friday, April 01, 2011 4:01 PM
> To: Georg-Johann Lay
> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington,
> Eric
> Subject: Re: [Patch,AVR]: Fix PR45263
>
> This is a better fix that does not need push/pop and does not increase
> numer of instructions.
>
> r16 takes the role of r20, and the value formerly in r16,
> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
>
Hi Johann,
Have you tested this patch against the test case in bug #45263?
Eric
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch,AVR]: Fix PR45263
2011-04-01 22:29 ` Weddington, Eric
@ 2011-04-04 14:03 ` Georg-Johann Lay
2011-04-06 13:30 ` Georg-Johann Lay
0 siblings, 1 reply; 9+ messages in thread
From: Georg-Johann Lay @ 2011-04-04 14:03 UTC (permalink / raw)
To: Weddington, Eric; +Cc: gcc-patches, Denis Chertykov, Anatoly Sokolov
Weddington, Eric schrieb:
>
>> -----Original Message-----
>> From: Georg-Johann Lay [mailto:avr@gjlay.de]
>> Sent: Friday, April 01, 2011 4:01 PM
>> To: Georg-Johann Lay
>> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington,
>> Eric
>> Subject: Re: [Patch,AVR]: Fix PR45263
>>
>> This is a better fix that does not need push/pop and does not increase
>> numer of instructions.
>>
>> r16 takes the role of r20, and the value formerly in r16,
>> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
>>
>
> Hi Johann,
>
> Have you tested this patch against the test case in bug #45263?
avr-gcc still aborts on building avr-libc as of
http://gcc.gnu.org/ml/gcc/2011-04/msg00008.html
Using avr-gdb-7.2 to debug with stubs runs on errors and doesn't show
me any code... no assembly with "A syntax error in expression, near
`0x29c'" in assembly window.
Trying to compile with avr-gcc and dwarf crashes avr-gcc.
__do_copy_data fails to initialize var1 and var2 (are 0x0).
Too much is broken... giving up.
Johann
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch,AVR]: Fix PR45263
2011-04-04 14:03 ` Georg-Johann Lay
@ 2011-04-06 13:30 ` Georg-Johann Lay
2011-04-11 17:05 ` Ping: " Georg-Johann Lay
0 siblings, 1 reply; 9+ messages in thread
From: Georg-Johann Lay @ 2011-04-06 13:30 UTC (permalink / raw)
To: Weddington, Eric; +Cc: gcc-patches, Denis Chertykov, Anatoly Sokolov
Georg-Johann Lay schrieb:
> Weddington, Eric schrieb:
>>> -----Original Message-----
>>> From: Georg-Johann Lay [mailto:avr@gjlay.de]
>>> Sent: Friday, April 01, 2011 4:01 PM
>>> To: Georg-Johann Lay
>>> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington,
>>> Eric
>>> Subject: Re: [Patch,AVR]: Fix PR45263
>>>
>>> This is a better fix that does not need push/pop and does not increase
>>> numer of instructions.
>>>
>>> r16 takes the role of r20, and the value formerly in r16,
>>> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
>>>
>> Hi Johann,
>>
>> Have you tested this patch against the test case in bug #45263?
Tested patch v2 from 2010-04-02 now for atmega2560 on avrtest
simulator. In main, var1 and var2 are initialized as expected and
anObject.getVal() is 30.
Without patch the program hangs.
> Using avr-gdb-7.2 to debug with stubs runs on errors and doesn't show
> me any code... no assembly with "A syntax error in expression, near
> `0x29c'" in assembly window.
> Trying to compile with avr-gcc and dwarf crashes avr-gcc.
>
> __do_copy_data fails to initialize var1 and var2 (are 0x0).
Seems atmega2560 is not supported in avr-gdb-7.2 simulator? Same elf
fails to initialize .data. Do you know for which targets avr-gdb is
supposed to work?
Johann
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Ping: [Patch,AVR]: Fix PR45263
2011-04-06 13:30 ` Georg-Johann Lay
@ 2011-04-11 17:05 ` Georg-Johann Lay
2011-04-12 5:35 ` Denis Chertykov
2011-05-27 16:41 ` [Patch, 4.6, AVR]: " Georg-Johann Lay
0 siblings, 2 replies; 9+ messages in thread
From: Georg-Johann Lay @ 2011-04-11 17:05 UTC (permalink / raw)
To: gcc-patches; +Cc: Weddington, Eric, Denis Chertykov, Anatoly Sokolov
[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]
Georg-Johann Lay schrieb:
> Georg-Johann Lay schrieb:
>> Weddington, Eric schrieb:
>>>> -----Original Message-----
>>>> From: Georg-Johann Lay [mailto:avr@gjlay.de]
>>>> Sent: Friday, April 01, 2011 4:01 PM
>>>> To: Georg-Johann Lay
>>>> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington,
>>>> Eric
>>>> Subject: Re: [Patch,AVR]: Fix PR45263
>>>>
>>>> This is a better fix that does not need push/pop and does not increase
>>>> numer of instructions.
>>>>
>>>> r16 takes the role of r20, and the value formerly in r16,
>>>> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
>>>>
>>> Hi Johann,
>>>
>>> Have you tested this patch against the test case in bug #45263?
>
> Tested patch v2 from 2010-04-02 now for atmega2560 on avrtest
> simulator. In main, var1 and var2 are initialized as expected and
> anObject.getVal() is 30.
>
> Without patch the program hangs.
2011-04-11 Georg-Johann Lay <avr@gjlay.de>
PR target/45263
* config/avr/libgcc.S (__do_global_ctors, __do_global_dtors):
Don't use
r20 around calls of __tablejump_elpm__
[-- Attachment #2: pr45263-v2.diff --]
[-- Type: text/x-patch, Size: 1571 bytes --]
Index: config/avr/libgcc.S
===================================================================
--- config/avr/libgcc.S (Revision 172258)
+++ config/avr/libgcc.S (Arbeitskopie)
@@ -791,22 +791,22 @@ __do_clear_bss:
#if defined(__AVR_HAVE_RAMPZ__)
__do_global_ctors:
ldi r17, hi8(__ctors_start)
- ldi r16, hh8(__ctors_start)
ldi r28, lo8(__ctors_end)
ldi r29, hi8(__ctors_end)
- ldi r20, hh8(__ctors_end)
+ ldi r16, hh8(__ctors_end)
rjmp .L__do_global_ctors_start
.L__do_global_ctors_loop:
sbiw r28, 2
- sbc r20, __zero_reg__
+ sbc r16, __zero_reg__
mov_h r31, r29
mov_l r30, r28
- out __RAMPZ__, r20
+ out __RAMPZ__, r16
XCALL __tablejump_elpm__
.L__do_global_ctors_start:
cpi r28, lo8(__ctors_start)
cpc r29, r17
- cpc r20, r16
+ ldi r24, hh8(__ctors_start)
+ cpc r16, r24
brne .L__do_global_ctors_loop
#else
__do_global_ctors:
@@ -832,22 +832,22 @@ __do_global_ctors:
#if defined(__AVR_HAVE_RAMPZ__)
__do_global_dtors:
ldi r17, hi8(__dtors_end)
- ldi r16, hh8(__dtors_end)
ldi r28, lo8(__dtors_start)
ldi r29, hi8(__dtors_start)
- ldi r20, hh8(__dtors_start)
+ ldi r16, hh8(__dtors_start)
rjmp .L__do_global_dtors_start
.L__do_global_dtors_loop:
sbiw r28, 2
- sbc r20, __zero_reg__
+ sbc r16, __zero_reg__
mov_h r31, r29
mov_l r30, r28
- out __RAMPZ__, r20
+ out __RAMPZ__, r16
XCALL __tablejump_elpm__
.L__do_global_dtors_start:
cpi r28, lo8(__dtors_end)
cpc r29, r17
- cpc r20, r16
+ ldi r24, hh8(__dtors_end)
+ cpc r16, r24
brne .L__do_global_dtors_loop
#else
__do_global_dtors:
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Ping: [Patch,AVR]: Fix PR45263
2011-04-11 17:05 ` Ping: " Georg-Johann Lay
@ 2011-04-12 5:35 ` Denis Chertykov
2011-05-27 16:41 ` [Patch, 4.6, AVR]: " Georg-Johann Lay
1 sibling, 0 replies; 9+ messages in thread
From: Denis Chertykov @ 2011-04-12 5:35 UTC (permalink / raw)
To: Georg-Johann Lay; +Cc: gcc-patches, Weddington, Eric, Anatoly Sokolov
2011/4/11 Georg-Johann Lay <avr@gjlay.de>:
> Georg-Johann Lay schrieb:
>> Tested patch v2 from 2010-04-02 now for atmega2560 on avrtest
>> simulator. In main, var1 and var2 are initialized as expected and
>> anObject.getVal() is 30.
>>
>> Without patch the program hangs.
>
>
> 2011-04-11 Georg-Johann Lay <avr@gjlay.de>
>
> PR target/45263
> * config/avr/libgcc.S (__do_global_ctors, __do_global_dtors):
> Don't use
> r20 around calls of __tablejump_elpm__
>
Approved.
Denis.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Patch, 4.6, AVR]: Fix PR45263
2011-04-11 17:05 ` Ping: " Georg-Johann Lay
2011-04-12 5:35 ` Denis Chertykov
@ 2011-05-27 16:41 ` Georg-Johann Lay
2011-05-27 18:42 ` Denis Chertykov
1 sibling, 1 reply; 9+ messages in thread
From: Georg-Johann Lay @ 2011-05-27 16:41 UTC (permalink / raw)
To: gcc-patches; +Cc: Weddington, Eric, Denis Chertykov, Anatoly Sokolov
Georg-Johann Lay schrieb:
> Georg-Johann Lay schrieb:
>> Georg-Johann Lay schrieb:
>>> Weddington, Eric schrieb:
>>>>> -----Original Message-----
>>>>> From: Georg-Johann Lay [mailto:avr@gjlay.de]
>>>>> Sent: Friday, April 01, 2011 4:01 PM
>>>>> To: Georg-Johann Lay
>>>>> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington,
>>>>> Eric
>>>>> Subject: Re: [Patch,AVR]: Fix PR45263
>>>>>
>>>>> This is a better fix that does not need push/pop and does not increase
>>>>> numer of instructions.
>>>>>
>>>>> r16 takes the role of r20, and the value formerly in r16,
>>>>> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
>>>>>
>>>> Hi Johann,
>>>>
>>>> Have you tested this patch against the test case in bug #45263?
>> Tested patch v2 from 2010-04-02 now for atmega2560 on avrtest
>> simulator. In main, var1 and var2 are initialized as expected and
>> anObject.getVal() is 30.
>>
>> Without patch the program hangs.
>
>
> 2011-04-11 Georg-Johann Lay <avr@gjlay.de>
>
> PR target/45263
> * config/avr/libgcc.S (__do_global_ctors, __do_global_dtors):
> Don't use
> r20 around calls of __tablejump_elpm__
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00774.html
This patch applies similar to 4.6.
Ok to install?
Johann
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Patch, 4.6, AVR]: Fix PR45263
2011-05-27 16:41 ` [Patch, 4.6, AVR]: " Georg-Johann Lay
@ 2011-05-27 18:42 ` Denis Chertykov
0 siblings, 0 replies; 9+ messages in thread
From: Denis Chertykov @ 2011-05-27 18:42 UTC (permalink / raw)
To: Georg-Johann Lay; +Cc: gcc-patches, Weddington, Eric, Anatoly Sokolov
2011/5/27 Georg-Johann Lay <avr@gjlay.de>:
> Georg-Johann Lay schrieb:
>> Georg-Johann Lay schrieb:
>>> Georg-Johann Lay schrieb:
>>>> Weddington, Eric schrieb:
>>>>>> -----Original Message-----
>>>>>> From: Georg-Johann Lay [mailto:avr@gjlay.de]
>>>>>> Sent: Friday, April 01, 2011 4:01 PM
>>>>>> To: Georg-Johann Lay
>>>>>> Cc: gcc-patches@gcc.gnu.org; Denis Chertykov; Anatoly Sokolov; Weddington,
>>>>>> Eric
>>>>>> Subject: Re: [Patch,AVR]: Fix PR45263
>>>>>>
>>>>>> This is a better fix that does not need push/pop and does not increase
>>>>>> numer of instructions.
>>>>>>
>>>>>> r16 takes the role of r20, and the value formerly in r16,
>>>>>> i.e. hh8(__dtors_end resp. __ctors_start) is recreated as needed.
>>>>>>
>>>>> Hi Johann,
>>>>>
>>>>> Have you tested this patch against the test case in bug #45263?
>>> Tested patch v2 from 2010-04-02 now for atmega2560 on avrtest
>>> simulator. In main, var1 and var2 are initialized as expected and
>>> anObject.getVal() is 30.
>>>
>>> Without patch the program hangs.
>>
>>
>> 2011-04-11 Georg-Johann Lay <avr@gjlay.de>
>>
>> PR target/45263
>> * config/avr/libgcc.S (__do_global_ctors, __do_global_dtors):
>> Don't use
>> r20 around calls of __tablejump_elpm__
>
> http://gcc.gnu.org/ml/gcc-patches/2011-04/msg00774.html
>
> This patch applies similar to 4.6.
> Ok to install?
>
> Johann
Please, install.
Denis.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-05-27 17:40 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-01 18:20 [Patch,AVR]: Fix PR45263 Georg-Johann Lay
2011-04-01 22:06 ` Georg-Johann Lay
2011-04-01 22:29 ` Weddington, Eric
2011-04-04 14:03 ` Georg-Johann Lay
2011-04-06 13:30 ` Georg-Johann Lay
2011-04-11 17:05 ` Ping: " Georg-Johann Lay
2011-04-12 5:35 ` Denis Chertykov
2011-05-27 16:41 ` [Patch, 4.6, AVR]: " Georg-Johann Lay
2011-05-27 18:42 ` Denis Chertykov
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).