* [PATCH] perf build: build BPF skeletons with fPIC
@ 2025-12-03 3:55 Jon Kohler
2025-12-03 16:43 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Jon Kohler @ 2025-12-03 3:55 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark, Tomas Glozar,
linux-perf-users, linux-kernel, bpf
Cc: Jon Kohler, stable
Fix Makefile.perf to ensure that bpf skeletons are built with fPIC.
When building with BUILD_BPF_SKEL=1, bpf_skel's was not getting built
with fPIC, seeing compilation failures like:
/usr/bin/ld: /builddir/.../tools/perf/util/bpf_skel/.tmp/bootstrap/main.o:
relocation R_X86_64_32 against `.rodata.str1.8' can not be used when
making a PIE object; recompile with -fPIE
Bisected down to 6.18 commit a39516805992 ("tools build: Don't assume
libtracefs-devel is always available").
Fixes: a39516805992 ("tools build: Don't assume libtracefs-devel is always available")
Cc: stable@vger.kernel.org
Signed-off-by: Jon Kohler <jon@nutanix.com>
---
tools/perf/Makefile.perf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 02f87c49801f..4557c2e89e88 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1211,7 +1211,7 @@ endif
$(BPFTOOL): | $(SKEL_TMP_OUT)
$(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
- OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
+ EXTRA_CFLAGS="-fPIC" OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
# Paths to search for a kernel to generate vmlinux.h from.
VMLINUX_BTF_ELF_PATHS ?= $(if $(O),$(O)/vmlinux) \
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf build: build BPF skeletons with fPIC
2025-12-03 3:55 [PATCH] perf build: build BPF skeletons with fPIC Jon Kohler
@ 2025-12-03 16:43 ` Arnaldo Carvalho de Melo
2025-12-03 16:48 ` Jon Kohler
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-12-03 16:43 UTC (permalink / raw)
To: Jon Kohler
Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Tomas Glozar, linux-perf-users, linux-kernel, bpf,
stable
On Tue, Dec 02, 2025 at 08:55:26PM -0700, Jon Kohler wrote:
> Fix Makefile.perf to ensure that bpf skeletons are built with fPIC.
>
> When building with BUILD_BPF_SKEL=1, bpf_skel's was not getting built
> with fPIC, seeing compilation failures like:
>
> /usr/bin/ld: /builddir/.../tools/perf/util/bpf_skel/.tmp/bootstrap/main.o:
> relocation R_X86_64_32 against `.rodata.str1.8' can not be used when
> making a PIE object; recompile with -fPIE
>
> Bisected down to 6.18 commit a39516805992 ("tools build: Don't assume
> libtracefs-devel is always available").
>
> Fixes: a39516805992 ("tools build: Don't assume libtracefs-devel is always available")
How come, this patch is just:
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 9c1a69d26f5121fd..531f8fc4f7df9943 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -83,7 +83,6 @@ FEATURE_TESTS_BASIC := \
libpython \
libslang \
libtraceevent \
- libtracefs \
libcpupower \
pthread-attr-setaffinity-np \
pthread-barrier \
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index e1847db6f8e63750..2df593593b6ec15e 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -150,10 +150,6 @@
# include "test-libtraceevent.c"
#undef main
-#define main main_test_libtracefs
-# include "test-libtracefs.c"
-#undef main
-
int main(int argc, char *argv[])
{
main_test_libpython();
@@ -187,7 +183,6 @@ int main(int argc, char *argv[])
main_test_reallocarray();
main_test_libzstd();
main_test_libtraceevent();
- main_test_libtracefs();
return 0;
}
----
And your patch is touching building bpftool? Seems very unrelated :-\
- Arnaldo
> Cc: stable@vger.kernel.org
> Signed-off-by: Jon Kohler <jon@nutanix.com>
> ---
> tools/perf/Makefile.perf | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 02f87c49801f..4557c2e89e88 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -1211,7 +1211,7 @@ endif
>
> $(BPFTOOL): | $(SKEL_TMP_OUT)
> $(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
> - OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
> + EXTRA_CFLAGS="-fPIC" OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
>
> # Paths to search for a kernel to generate vmlinux.h from.
> VMLINUX_BTF_ELF_PATHS ?= $(if $(O),$(O)/vmlinux) \
> --
> 2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf build: build BPF skeletons with fPIC
2025-12-03 16:43 ` Arnaldo Carvalho de Melo
@ 2025-12-03 16:48 ` Jon Kohler
0 siblings, 0 replies; 3+ messages in thread
From: Jon Kohler @ 2025-12-03 16:48 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Tomas Glozar, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
stable@vger.kernel.org
> On Dec 3, 2025, at 11:43 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> On Tue, Dec 02, 2025 at 08:55:26PM -0700, Jon Kohler wrote:
>> Fix Makefile.perf to ensure that bpf skeletons are built with fPIC.
>>
>> When building with BUILD_BPF_SKEL=1, bpf_skel's was not getting built
>> with fPIC, seeing compilation failures like:
>>
>> /usr/bin/ld: /builddir/.../tools/perf/util/bpf_skel/.tmp/bootstrap/main.o:
>> relocation R_X86_64_32 against `.rodata.str1.8' can not be used when
>> making a PIE object; recompile with -fPIE
>>
>> Bisected down to 6.18 commit a39516805992 ("tools build: Don't assume
>> libtracefs-devel is always available").
>>
>> Fixes: a39516805992 ("tools build: Don't assume libtracefs-devel is always available")
>
> How come, this patch is just:
It doesn’t make sense to me, but I checked the results of
the bisection by hand and, hand-to-god, reverting commit
a39516805992 unbreaks our build every single time.
Putting a39516805992 back breaks our build 100% of the time.
>
> diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
> index 9c1a69d26f5121fd..531f8fc4f7df9943 100644
> --- a/tools/build/Makefile.feature
> +++ b/tools/build/Makefile.feature
> @@ -83,7 +83,6 @@ FEATURE_TESTS_BASIC := \
> libpython \
> libslang \
> libtraceevent \
> - libtracefs \
> libcpupower \
> pthread-attr-setaffinity-np \
> pthread-barrier \
> diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
> index e1847db6f8e63750..2df593593b6ec15e 100644
> --- a/tools/build/feature/test-all.c
> +++ b/tools/build/feature/test-all.c
> @@ -150,10 +150,6 @@
> # include "test-libtraceevent.c"
> #undef main
>
> -#define main main_test_libtracefs
> -# include "test-libtracefs.c"
> -#undef main
> -
> int main(int argc, char *argv[])
> {
> main_test_libpython();
> @@ -187,7 +183,6 @@ int main(int argc, char *argv[])
> main_test_reallocarray();
> main_test_libzstd();
> main_test_libtraceevent();
> - main_test_libtracefs();
>
> return 0;
> }
>
>
> ----
>
> And your patch is touching building bpftool? Seems very unrelated :-\
>
> - Arnaldo
>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Jon Kohler <jon@nutanix.com>
>> ---
>> tools/perf/Makefile.perf | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>> index 02f87c49801f..4557c2e89e88 100644
>> --- a/tools/perf/Makefile.perf
>> +++ b/tools/perf/Makefile.perf
>> @@ -1211,7 +1211,7 @@ endif
>>
>> $(BPFTOOL): | $(SKEL_TMP_OUT)
>> $(Q)CFLAGS= $(MAKE) -C ../bpf/bpftool \
>> - OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
>> + EXTRA_CFLAGS="-fPIC" OUTPUT=$(SKEL_TMP_OUT)/ bootstrap
>>
>> # Paths to search for a kernel to generate vmlinux.h from.
>> VMLINUX_BTF_ELF_PATHS ?= $(if $(O),$(O)/vmlinux) \
>> --
>> 2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-03 16:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-03 3:55 [PATCH] perf build: build BPF skeletons with fPIC Jon Kohler
2025-12-03 16:43 ` Arnaldo Carvalho de Melo
2025-12-03 16:48 ` Jon Kohler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox