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

From: Namhyung Kim

Date: Thu Dec 04 2025 - 03:41:53 EST


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?

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 {