Re: [PATCH 1/4] gcov: clang: move common gcc code into gcc_base.c

From: Peter Oberparleiter
Date: Wed Jan 16 2019 - 10:33:09 EST


On 14.01.2019 22:04, Tri Vo wrote:
> From: Greg Hackmann <ghackmann@xxxxxxxxxx>
>
> base.c contains a few callbacks specific to GCC's gcov implementation.
> Move these into their own module in preparation for clang support.

Minor nitpick: at least in commit messages, a consistent capitalization
of "Clang" would be preferable.

> diff --git a/kernel/gcov/Makefile b/kernel/gcov/Makefile
> index ff06d64df397..45431ed679d1 100644
> --- a/kernel/gcov/Makefile
> +++ b/kernel/gcov/Makefile

[...]

> -void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
> -{
> - /* Unused. */
> -}
> -EXPORT_SYMBOL(__gcov_merge_icall_topn);
> +int gcov_events_enabled;
> +DEFINE_MUTEX(gcov_lock);
>
> void __gcov_exit(void)
> {

Unless __gcov_exit() is required by Clang, it should also be moved.

> diff --git a/kernel/gcov/gcc_base.c b/kernel/gcov/gcc_base.c
> new file mode 100644
> index 000000000000..823565bcf9bf
> --- /dev/null
> +++ b/kernel/gcov/gcc_base.c
> @@ -0,0 +1,79 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/kernel.h>
> +#include <linux/mutex.h>

linux/export.h should be included for the EXPORT_SYMBOL() macro.


--
Peter Oberparleiter
Linux on Z Development - IBM Germany