[PATCH 1/3] perf build: Preserve EXTRA_CFLAGS when building in-tree libbpf
From: Trevor Allison
Date: Wed Jul 08 2026 - 00:57:00 EST
The libbpf sub-make passes EXTRA_CFLAGS="-fPIC", replacing the
parent EXTRA_CFLAGS. Append -fPIC instead, since libbpf.a is linked
whole-archive into perf.
Signed-off-by: Trevor Allison <tallison@xxxxxxxxxx>
---
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 2b53d9e0c73b..a59ed1d70ecc 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -706,7 +706,7 @@ $(LIBAPI)-clean:
$(LIBBPF): FORCE | $(LIBBPF_OUTPUT)
$(Q)$(MAKE) -C $(LIBBPF_DIR) FEATURES_DUMP=$(FEATURE_DUMP_EXPORT) \
O= OUTPUT=$(LIBBPF_OUTPUT)/ DESTDIR=$(LIBBPF_DESTDIR) prefix= subdir= \
- EXTRA_CFLAGS="-fPIC" $@ install_headers
+ EXTRA_CFLAGS="$(EXTRA_CFLAGS) -fPIC" $@ install_headers
$(LIBBPF)-clean:
$(call QUIET_CLEAN, libbpf)
--
2.50.1 (Apple Git-155)