Re: [PATCH v6.19-rc1 1/1] libperf: Compile using -std=gnu17 to deal with visibility attribute issues

Arnaldo Melo
2025-12-04T14:32:53Z

On December 4, 2025 5:41:51 AM GMT-03:00, Namhyung Kim <namhyung@kernel.org> wrote:
>On Wed, Dec 03, 2025 at 06:20:08PM -0300, Arnaldo Carvalho de Melo wrote:
>> We seem to need a more invasive patch using 'extern' on all LIBPERF_API
>> prefixed functions to be future proof, so use -std=gnu17 which is the
>> one in gcc 14, present in the distro generation before ubuntu 25.10 (gcc
>> 15).
>
>Something like this?

Yeah, I probably got carried away with libbpf's accidental way of "dealing" with it.

Will test build it, or have you already?

- Arnaldo

>
>Thanks,
>Namhyung
>
>
>diff --git a/tools/lib/perf/include/perf/core.h b/tools/lib/perf/include/perf/core.h
>index a3f6d68edad76240..06cc132d88cf3436 100644
>--- a/tools/lib/perf/include/perf/core.h
>+++ b/tools/lib/perf/include/perf/core.h
>@@ -5,7 +5,7 @@
> #include <stdarg.h>
>
> #ifndef LIBPERF_API
>-#define LIBPERF_API __attribute__((visibility("default")))
>+#define LIBPERF_API extern __attribute__((visibility("default")))
> #endif
>
> enum libperf_print_level {

- Arnaldo