This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, RFC] gcov: dump in a static dtor instead of in an atexit handler
- From: Martin Liška <mliska at suse dot cz>
- To: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- Cc: Nathan Sidwell <nathan at acm dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 13 Oct 2016 16:01:04 +0200
- Subject: Re: [PATCH, RFC] gcov: dump in a static dtor instead of in an atexit handler
- Authentication-results: sourceware.org; auth=none
- References: <dd23acd2-392b-e39f-1f42-b6d383308abf@suse.cz> <521cd409-284b-b109-e26f-00a312eb06cc@acm.org> <447a5571-5a7c-32a6-a72d-b268af13f733@suse.cz> <5270de7f-71e7-12d0-8046-460c75005399@suse.cz> <yddwphvulm2.fsf@CeBiTec.Uni-Bielefeld.DE> <183356f0-d8cf-ec59-8bc5-c8d7cd920092@suse.cz> <yddfuohspwe.fsf@CeBiTec.Uni-Bielefeld.DE> <99ac0c9b-9636-3aaf-f4b7-a926c1608a1f@suse.cz> <yddy429r2kn.fsf@CeBiTec.Uni-Bielefeld.DE> <b7833802-564c-23e5-0c03-c9e8d88b79f1@suse.cz> <ydd4m4g2wgl.fsf@CeBiTec.Uni-Bielefeld.DE>
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