Patchwork [libstdc++-v3] PR 44461: Explicitly mention the section where inline assembly is emitted for __cxa_end_cleanup

login
register
mail settings
Submitter Khem Raj
Date June 9, 2010, 2:28 p.m.
Message ID <1276093718-30563-1-git-send-email-raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/55098/
State New
Headers show

Comments

Khem Raj - June 9, 2010, 2:28 p.m.
Hi

This patch fixes PR 44461 where in some cases __cxa_end_cleanup
was not emitted in .text section.

Thanks
-Khem

2010-06-07  Khem Raj  <raj.khem@gmail.com>

	PR libstdc++/44461
	* libsupc++/eh_arm.cc (__cxa_end_cleanup): Use .pushsection/.popsection
	to emit inline assembly into .text section.
Paolo Carlini - June 9, 2010, 3:09 p.m.
On 06/09/2010 04:28 PM, Khem Raj wrote:
> Hi
>
> This patch fixes PR 44461 where in some cases __cxa_end_cleanup
> was not emitted in .text section.
>   
I would suggest adding in CC arm-eabi maintainers, otherwise the patch
can be mistakenly considered a libstdc++-proper contribution and remain
unreviewed.

I'm adding a few myself.

Paolo.
Paul Brook - June 9, 2010, 3:29 p.m.
> 2010-06-07  Khem Raj  <raj.khem@gmail.com>
> 
> 	PR libstdc++/44461
> 	* libsupc++/eh_arm.cc (__cxa_end_cleanup): Use .pushsection/.popsection
> 	to emit inline assembly into .text section.

Ok.

Paul
Paolo Carlini - June 9, 2010, 3:35 p.m.
On 06/09/2010 05:29 PM, Paul Brook wrote:
>> 2010-06-07  Khem Raj  <raj.khem@gmail.com>
>>
>> 	PR libstdc++/44461
>> 	* libsupc++/eh_arm.cc (__cxa_end_cleanup): Use .pushsection/.popsection
>> 	to emit inline assembly into .text section.
>>     
> Ok.
>   
Applied, thanks Paul.

Paolo.

Patch

Index: gcc-4.5/libstdc++-v3/libsupc++/eh_arm.cc
===================================================================
--- gcc-4.5.orig/libstdc++-v3/libsupc++/eh_arm.cc	2010-06-04 23:20:18.000000000 -0700
+++ gcc-4.5/libstdc++-v3/libsupc++/eh_arm.cc	2010-06-08 11:27:34.247541722 -0700
@@ -157,22 +157,26 @@  __gnu_end_cleanup(void)
 // Assembly wrapper to call __gnu_end_cleanup without clobbering r1-r3.
 // Also push r4 to preserve stack alignment.
 #ifdef __thumb__
-asm (".global __cxa_end_cleanup\n"
+asm ("  .pushsection .text.__cxa_end_cleanup\n"
+"	.global __cxa_end_cleanup\n"
 "	.type __cxa_end_cleanup, \"function\"\n"
 "	.thumb_func\n"
 "__cxa_end_cleanup:\n"
 "	push\t{r1, r2, r3, r4}\n"
 "	bl\t__gnu_end_cleanup\n"
 "	pop\t{r1, r2, r3, r4}\n"
-"	bl\t_Unwind_Resume @ Never returns\n");
+"	bl\t_Unwind_Resume @ Never returns\n"
+"	.popsection\n");
 #else
-asm (".global __cxa_end_cleanup\n"
+asm ("  .pushsection .text.__cxa_end_cleanup\n"
+"	.global __cxa_end_cleanup\n"
 "	.type __cxa_end_cleanup, \"function\"\n"
 "__cxa_end_cleanup:\n"
 "	stmfd\tsp!, {r1, r2, r3, r4}\n"
 "	bl\t__gnu_end_cleanup\n"
 "	ldmfd\tsp!, {r1, r2, r3, r4}\n"
-"	bl\t_Unwind_Resume @ Never returns\n");
+"	bl\t_Unwind_Resume @ Never returns\n"
+"	.popsection\n");
 #endif
 
 #endif