[PATCH, RFC] gcov: dump in a static dtor instead of in an atexit handler

Martin Liška mliska@suse.cz
Thu Oct 13 14:01:00 GMT 2016


On 10/13/2016 03:46 PM, Rainer Orth wrote:
> Hi Martin,
> 
> sorry for the long delay: I've been extremely busy the last two weeks.

Hello

Never mind, still plenty of time before we'll release 7.1.0 :)

> 
>> On 09/30/2016 02:31 PM, Rainer Orth wrote:
>>> this would be i386-pc-solaris2.12.  I'm not sure if the constructor
>>> priority detection works in a cross scenario.
>>
>> Hi.
>>
>> By the way, I tried to test the cross-compiler:
>> $ ../configure --disable-bootstrap --enable-languages=c,c++,fortran --enable-valgrind-annotations --prefix=/home/marxin/bin/gcc2 --disable-multilib --disable-libsanitizer --target=i386-pc-solaris2.12
>>
>> and I get for:
>> cat /tmp/priority.c
>> void __attribute__ ((constructor(150))) foo()
>> {
>> }
>>
>> void __attribute__ ((constructor(151))) bar()
>> {
>> }
>>
>> int main()
>> {
>>   return 0;
>> }
>>
>> $ ./xgcc -B. /tmp/priority.c -fprofile-generate -S
>> /tmp/priority.c:2:1: error: constructor priorities are not supported
>>  {
>>  ^
>> /tmp/priority.c:6:1: error: constructor priorities are not supported
>>  {
>>  ^
>>
>> I guess even cross compiler should detect whether the target supports ctor/dtor priorities.
> 
> maybe it could, but right now acinclude.m4 (gcc_AC_INITFINI_ARRAY) has
> this for crosses:
> 
>     AC_MSG_CHECKING(cross compile... guessing)
>     gcc_cv_initfini_array=no
> 
> You could work around this by overriding configure with
> --enable-initfini-array.

Good, I've just done that.

> 
>> May I ask you for assembly file of a native compiler with the suggested patch?
> 
> Sure: this time from an i386-pc-solaris2.12 compiler configured to use
> gas and ld.
> 
> 	Rainer
> 

Just running my previous example (priotity.c), I can see with -S:

_GLOBAL__sub_D_00099_1_foo:
	jmp	__gcov_exit
	.size	_GLOBAL__sub_D_00099_1_foo, .-_GLOBAL__sub_D_00099_1_foo
	.section	.fini_array.00099,"aw"
	.align 4
	.long	_GLOBAL__sub_D_00099_1_foo
	.data
	.align 4
	.type	.LPBX1, @object
	.size	.LPBX1, 12

Which looks good. I guess the sent snippet is before r240857, where I fixed the
priority to 99. Can you please test it with current trunk?

Thanks,
Martin



More information about the Gcc-patches mailing list