[PATCH] Detect whether target can use -fprofile-update=atomic

Martin Liška mliska@suse.cz
Tue Sep 6 10:57:00 GMT 2016


On 08/16/2016 04:30 PM, Nathan Sidwell wrote:
> On 08/16/16 08:55, Martin Liška wrote:
>> Hello.
>>
>> As reported in [1], m68k has been broken since I installed the patch. Reason is that the target
>> does not support atomic operations (add, or) for a mode of gcov_type. Because of that, we see
>> an undefined symbols.
>>
>> Proper fix contains of 2 parts:
>> a) compiler emission must verify that -fprofile-update=atomic is doable for a given target; it's done
>> via a new function can_generate_atomic_builtin
>> b) libgcc must detect whether __atomic_fetch_add_x can be expanded on the target; that requires configure
>> support and if the target is not capable to expand these, we must conditionally remove all gcov_.*profiler_atomic
>> functions from libgcov.a.
> 
> I'm fine with the coverage-pecific changes, but the new hooks etc are not something I can approve.
> 
> gcc/ChangeLog:
> 
> 2016-08-12  Martin Liska  <mliska@suse.cz>
> 
>     * optabs.c (can_generate_atomic_builtin): New function.
>     * optabs.h (can_generate_atomic_builtin): Declare the function.
> Need GWM or similar review
> 
>     * tree-profile.c (tree_profiling):  Detect whether target can use
>     -fprofile-update=atomic.
> ok
> 
> gcc/testsuite/ChangeLog:
> 
> 2016-08-12  Martin Liska  <mliska@suse.cz>
> 
>     * gcc.dg/profile-update-warning.c: New test.
> ok
> 
> libgcc/ChangeLog:
> 
> 2016-08-16  Martin Liska  <mliska@suse.cz>
> 
>     * acinclude.m4: New file.
>     * config.in: New macro defines.
>     * configure: Regenerated.
>     * configure.ac: Detect atomic operations.
> need GWM or similar review
> 
>     * libgcov-profiler.c: Detect GCOV_SUPPORTS_ATOMIC and
>     conditionaly enable/disable *_atomic functions.
> OK.
> 
> nathan

Hi Nathan.

Thanks for review, I'm CCing Jakub and Richard for the review.
The patch should fix very similar issue spotted on AIX target by David.

Thanks,
Martin



More information about the Gcc-patches mailing list