commit:     c8f11597776947df15d2fdb3338237b29622c72b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 31 04:23:23 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jul 31 04:26:26 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8f11597

dev-debug/dtrace: fix build w/ nomultilib

This fixes a possible correctness issue on other profiles as well.

Bug: https://gcc.gnu.org/PR121259
Closes: https://bugs.gentoo.org/959876
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../{dtrace-9999.ebuild => dtrace-2.0.3-r2.ebuild} |  4 +++
 dev-debug/dtrace/dtrace-9999.ebuild                |  4 +++
 ...-BPF-library-functions-with-ffreestanding.patch | 34 ++++++++++++++++++++++
 3 files changed, 42 insertions(+)

diff --git a/dev-debug/dtrace/dtrace-9999.ebuild 
b/dev-debug/dtrace/dtrace-2.0.3-r2.ebuild
similarity index 98%
copy from dev-debug/dtrace/dtrace-9999.ebuild
copy to dev-debug/dtrace/dtrace-2.0.3-r2.ebuild
index adf19369b700..e55953fb7d41 100644
--- a/dev-debug/dtrace/dtrace-9999.ebuild
+++ b/dev-debug/dtrace/dtrace-2.0.3-r2.ebuild
@@ -73,6 +73,10 @@ QA_EXECSTACK="
        usr/*/dtrace/bpf_dlib.*
 "
 
+PATCHES=(
+       
"${FILESDIR}"/0001-bpf-compile-BPF-library-functions-with-ffreestanding.patch
+)
+
 pkg_pretend() {
        # TODO: optional kernel patches
 

diff --git a/dev-debug/dtrace/dtrace-9999.ebuild 
b/dev-debug/dtrace/dtrace-9999.ebuild
index adf19369b700..e55953fb7d41 100644
--- a/dev-debug/dtrace/dtrace-9999.ebuild
+++ b/dev-debug/dtrace/dtrace-9999.ebuild
@@ -73,6 +73,10 @@ QA_EXECSTACK="
        usr/*/dtrace/bpf_dlib.*
 "
 
+PATCHES=(
+       
"${FILESDIR}"/0001-bpf-compile-BPF-library-functions-with-ffreestanding.patch
+)
+
 pkg_pretend() {
        # TODO: optional kernel patches
 

diff --git 
a/dev-debug/dtrace/files/0001-bpf-compile-BPF-library-functions-with-ffreestanding.patch
 
b/dev-debug/dtrace/files/0001-bpf-compile-BPF-library-functions-with-ffreestanding.patch
new file mode 100644
index 000000000000..67111d6ab740
--- /dev/null
+++ 
b/dev-debug/dtrace/files/0001-bpf-compile-BPF-library-functions-with-ffreestanding.patch
@@ -0,0 +1,34 @@
+https://lore.kernel.org/dtrace/sj0pr10mb567217e9df1f38898f33711bc2...@sj0pr10mb5672.namprd10.prod.outlook.com/
+https://gcc.gnu.org/PR121259
+https://bugs.gentoo.org/959876
+
+From 2e027482c1bb19597a5f6ed51fac76f621b0163c Mon Sep 17 00:00:00 2001
+Message-ID: 
<2e027482c1bb19597a5f6ed51fac76f621b0163c.1753935317.git....@gentoo.org>
+From: Kris Van Hees <[email protected]>
+Date: Wed, 30 Jul 2025 23:09:03 -0400
+Subject: [PATCH] bpf: compile BPF library functions with -ffreestanding
+
+Per Jose, we should be compiling our BPF code with -ffreestanding to
+ensure that BPF-specific standard header files are used instead of
+host-specific ones.
+
+Signed-off-by: Kris Van Hees <[email protected]>
+Tested-by: Sam James <[email protected]>
+Reviewed-by: Sam James <[email protected]>
+Reviewed-by: Eugene Loh <[email protected]>
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -127,7 +127,7 @@ PREPROCESS = $(CC) -E
+ export BPFC ?= bpf-unknown-none-gcc
+ 
+ BPFCPPFLAGS += -D$(subst sparc64,__sparc,$(subst aarch64,__aarch64__,$(subst 
x86_64,__amd64,$(ARCH))))
+-BPFCFLAGS ?= -O2 -Wall -Wno-unknown-pragmas $(if $(HAVE_BPFV3),-mcpu=v3) $(if 
$(HAVE_BPFMASM),-masm=normal)
++BPFCFLAGS ?= -O2 -Wall -Wno-unknown-pragmas $(if $(HAVE_BPFV3),-mcpu=v3) $(if 
$(HAVE_BPFMASM),-masm=normal) -ffreestanding
+ export BPFLD ?= bpf-unknown-none-ld
+ 
+ all::
+
+base-commit: 6642cf0c84de770b93a235581183a644664513a5
+-- 
+2.50.1
+

Reply via email to