commit:     850d16b9da0ddd1d3aa834fcba00d1dcfedc84cb
Author:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 29 12:12:23 2025 +0000
Commit:     Arisu Tachibana <alicef <AT> gentoo <DOT> org>
CommitDate: Mon Sep 29 12:12:23 2025 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=850d16b9

Add libbpf suppress adding '-Werror' if WERROR=0

Signed-off-by: Arisu Tachibana <alicef <AT> gentoo.org>

 0000_README                         |  4 ++++
 2991_libbpf_add_WERROR_option.patch | 47 +++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/0000_README b/0000_README
index 7dc67ad1..1e434c3a 100644
--- a/0000_README
+++ b/0000_README
@@ -70,6 +70,10 @@ Patch:  
2990_libbpf-v2-workaround-Wmaybe-uninitialized-false-pos.patch
 From:   https://lore.kernel.org/bpf/
 Desc:   libbpf: workaround -Wmaybe-uninitialized false positive
 
+Patch:  2991_libbpf_add_WERROR_option.patch
+From:   https://lore.kernel.org/bpf/
+Desc:   libbpf: suppress adding -werror is WERROR=0
+
 Patch:  3000_Support-printing-firmware-info.patch
 From:   https://bugs.gentoo.org/732852
 Desc:   Print firmware info (Reqs CONFIG_GENTOO_PRINT_FIRMWARE_INFO). Thanks 
to Georgy Yakovlev

diff --git a/2991_libbpf_add_WERROR_option.patch 
b/2991_libbpf_add_WERROR_option.patch
new file mode 100644
index 00000000..e8649909
--- /dev/null
+++ b/2991_libbpf_add_WERROR_option.patch
@@ -0,0 +1,47 @@
+Subject: [PATCH] tools/libbpf: add WERROR option
+Date: Sat,  5 Jul 2025 11:43:12 +0100
+Message-ID: 
<7e6c41e47c6a8ab73945e6aac319e0dd53337e1b.1751712192.git....@gentoo.org>
+X-Mailer: git-send-email 2.50.0
+Precedence: bulk
+X-Mailing-List: [email protected]
+List-Id: <bpf.vger.kernel.org>
+List-Subscribe: <mailto:[email protected]>
+List-Unsubscribe: <mailto:[email protected]>
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+
+Check the 'WERROR' variable and suppress adding '-Werror' if WERROR=0.
+
+This mirrors what tools/perf and other directories in tools do to handle
+-Werror rather than adding it unconditionally.
+
+Signed-off-by: Sam James <[email protected]>
+---
+ tools/lib/bpf/Makefile | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
+index 168140f8e646..9563d37265da 100644
+--- a/tools/lib/bpf/Makefile
++++ b/tools/lib/bpf/Makefile
+@@ -77,10 +77,15 @@ else
+   CFLAGS := -g -O2
+ endif
+ 
++# Treat warnings as errors unless directed not to
++ifneq ($(WERROR),0)
++  CFLAGS += -Werror
++endif
++
+ # Append required CFLAGS
+ override CFLAGS += -std=gnu89
+ override CFLAGS += $(EXTRA_WARNINGS) -Wno-switch-enum
+-override CFLAGS += -Werror -Wall
++override CFLAGS += -Wall
+ override CFLAGS += $(INCLUDES)
+ override CFLAGS += -fvisibility=hidden
+ override CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+-- 
+2.50.0
+
+

Reply via email to