* [PATCH v6.19-rc1 1/1] libperf: Compile using -std=gnu17 to deal with visibility attribute issues
@ 2025-12-03 21:20 Arnaldo Carvalho de Melo
2025-12-04 8:41 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-12-03 21:20 UTC (permalink / raw)
To: Namhyung Kim
Cc: Adrian Hunter, Ian Rogers, James Clark, Jiri Olsa,
Linux Kernel Mailing List, linux-perf-users
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).
But to make progress and avoid this on Ubuntu 25.10/gcc 15, lets to with
the easy workaround:
evlist.c: In function 'perf_evlist__purge':
evlist.c:202:17: error: implicit declaration of function 'perf_evsel__delete'; did you mean 'perf_evsel__exit'? [-Wimplicit-function-declaration]
202 | perf_evsel__delete(pos);
| ^~~~~~~~~~~~~~~~~~
| perf_evsel__exit
evlist.c:202:17: error: nested extern declaration of 'perf_evsel__delete' [-Werror=nested-externs]
evlist.c: In function 'perf_evlist__open':
evlist.c:261:23: error: implicit declaration of function 'perf_evsel__open'; did you mean 'perf_evsel__exit'? [-Wimplicit-function-declaration]
261 | err = perf_evsel__open(evsel, evsel->cpus, evsel->threads);
| ^~~~~~~~~~~~~~~~
| perf_evsel__exit
evlist.c:261:23: error: nested extern declaration of 'perf_evsel__open' [-Werror=nested-externs]
libbpf doesn't experience this because for some other reason it already
has this line:
override CFLAGS += -std=gnu89
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/perf/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile
index 7fbb50b74c00b3b9..5e12fd97f50c1efb 100644
--- a/tools/lib/perf/Makefile
+++ b/tools/lib/perf/Makefile
@@ -51,6 +51,7 @@ INCLUDES = \
-I$(srctree)/tools/include/uapi
# Append required CFLAGS
+override CFLAGS += -std=gnu17
override CFLAGS += -g -Werror -Wall
override CFLAGS += -fPIC
override CFLAGS += $(INCLUDES)
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v6.19-rc1 1/1] libperf: Compile using -std=gnu17 to deal with visibility attribute issues
2025-12-03 21:20 [PATCH v6.19-rc1 1/1] libperf: Compile using -std=gnu17 to deal with visibility attribute issues Arnaldo Carvalho de Melo
@ 2025-12-04 8:41 ` Namhyung Kim
2025-12-04 14:32 ` Arnaldo Melo
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2025-12-04 8:41 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Adrian Hunter, Ian Rogers, James Clark, Jiri Olsa,
Linux Kernel Mailing List, linux-perf-users
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 {
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v6.19-rc1 1/1] libperf: Compile using -std=gnu17 to deal with visibility attribute issues
2025-12-04 8:41 ` Namhyung Kim
@ 2025-12-04 14:32 ` Arnaldo Melo
0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Melo @ 2025-12-04 14:32 UTC (permalink / raw)
To: Namhyung Kim, Arnaldo Carvalho de Melo
Cc: Adrian Hunter, Ian Rogers, James Clark, Jiri Olsa,
Linux Kernel Mailing List, linux-perf-users
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-04 14:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-03 21:20 [PATCH v6.19-rc1 1/1] libperf: Compile using -std=gnu17 to deal with visibility attribute issues Arnaldo Carvalho de Melo
2025-12-04 8:41 ` Namhyung Kim
2025-12-04 14:32 ` Arnaldo Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).