commit:     66b5320817d95f73c6dcffd4b2a9a6881d5594a0
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Fri Jan 16 20:50:34 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 18 18:00:29 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=66b53208

dev-debug/scap-driver: fix building against LTO-enabled kernels

Closes: https://bugs.gentoo.org/968857
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Part-of: https://github.com/gentoo/gentoo/pull/45404
Closes: https://github.com/gentoo/gentoo/pull/45404
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...x-driver-and-bpf-makefile-for-kernel-6.13.patch | 39 ++++++++++++++++++++++
 .../files/libs-0.20.0-properly-use-LD.patch        | 24 +++++++++++++
 dev-debug/scap-driver/scap-driver-0.20.0.ebuild    |  7 +++-
 3 files changed, 69 insertions(+), 1 deletion(-)

diff --git 
a/dev-debug/scap-driver/files/libs-0.20.0-fix-driver-and-bpf-makefile-for-kernel-6.13.patch
 
b/dev-debug/scap-driver/files/libs-0.20.0-fix-driver-and-bpf-makefile-for-kernel-6.13.patch
new file mode 100644
index 000000000000..f0c16d176d12
--- /dev/null
+++ 
b/dev-debug/scap-driver/files/libs-0.20.0-fix-driver-and-bpf-makefile-for-kernel-6.13.patch
@@ -0,0 +1,39 @@
+Patch from:
+https://github.com/falcosecurity/libs/commit/7f01ec89c565fcb45ade833b1312ae69637bc4ec
+
+From: Federico Di Pierro <[email protected]>
+Date: Fri, 28 Mar 2025 08:35:23 +0100
+Subject: [PATCH] fix(driver): fix driver and bpf makefile for linux 6.13.
+
+Signed-off-by: Federico Di Pierro <[email protected]>
+---
+ driver/Makefile.in  | 2 +-
+ driver/bpf/Makefile | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/driver/Makefile.in b/driver/Makefile.in
+index 7b1fdc2dba..ec60103d0d 100644
+--- a/driver/Makefile.in
++++ b/driver/Makefile.in
+@@ -29,7 +29,7 @@ install: all
+ 
+ else
+ 
+-KERNELDIR     ?= $(CURDIR)
++KERNELDIR     ?= $(realpath $(objtree))
+ #
+ # Get the path of the module sources
+ #
+diff --git a/driver/bpf/Makefile b/driver/bpf/Makefile
+index 58d1b11165..c94647c608 100644
+--- a/driver/bpf/Makefile
++++ b/driver/bpf/Makefile
+@@ -28,7 +28,7 @@ clean:
+ 
+ else
+ 
+-KERNELDIR     ?= $(CURDIR)
++KERNELDIR     ?= $(realpath $(objtree))
+ #
+ # Get the path of the module sources
+ #

diff --git a/dev-debug/scap-driver/files/libs-0.20.0-properly-use-LD.patch 
b/dev-debug/scap-driver/files/libs-0.20.0-properly-use-LD.patch
new file mode 100644
index 000000000000..79aad2c91cf9
--- /dev/null
+++ b/dev-debug/scap-driver/files/libs-0.20.0-properly-use-LD.patch
@@ -0,0 +1,24 @@
+Properly use an injected LD for linking. This is necessary for kernels
+built with clang & LTO, otherwise the configuration tests fall back to
+using ld.bfd and fail to build with: "ld: unrecognised emulation mode: llvm".
+Bug: https://bugs.gentoo.org/968857
+
+--- libs-0.20.0/driver/configure/Makefile.inc.in
++++ libs-0.20.0/driver/configure/Makefile.inc.in
+@@ -3,7 +3,7 @@ MODULE_MAKEFILE_DIR := $(shell dirname $
+ # Run the module build.sh (wrapper for make) script with an empty environment,
+ # but pass PATH, KERNELDIR and eventually (if set) CC and KBUILD_MODPOST_WARN.
+ # The latter ones are used by driverkit build templates.
+-HAS_@CONFIGURE_MODULE@ := $(shell env -i CC="$(CC)" 
KBUILD_MODPOST_WARN="$(KBUILD_MODPOST_WARN)" PATH="$(PATH)" 
KERNELDIR="$(KERNELDIR)" sh $(MODULE_MAKEFILE_DIR)/build.sh ; echo $$?)
++HAS_@CONFIGURE_MODULE@ := $(shell env -i CC="$(CC)" LD="$(LD)" 
KBUILD_MODPOST_WARN="$(KBUILD_MODPOST_WARN)" PATH="$(PATH)" 
KERNELDIR="$(KERNELDIR)" sh $(MODULE_MAKEFILE_DIR)/build.sh ; echo $$?)
+ 
+ ifeq ($(HAS_@CONFIGURE_MODULE@),0)
+ $(info [configure-kmod] Setting HAS_@CONFIGURE_MODULE@ flag)
+--- libs-0.20.0/driver/configure/build.sh
++++ libs-0.20.0/driver/configure/build.sh
+@@ -10,4 +10,4 @@
+ SCRIPT=$(readlink -f "$0")
+ SCRIPT_DIR=$(dirname ${SCRIPT})
+ 
+-make CC="${CC}" -C ${SCRIPT_DIR} > ${SCRIPT_DIR}/build.log 2>&1
++make CC="${CC}" "${LD}" -C ${SCRIPT_DIR} > ${SCRIPT_DIR}/build.log 2>&1

diff --git a/dev-debug/scap-driver/scap-driver-0.20.0.ebuild 
b/dev-debug/scap-driver/scap-driver-0.20.0.ebuild
index fcaa246007a2..444172b824d1 100644
--- a/dev-debug/scap-driver/scap-driver-0.20.0.ebuild
+++ b/dev-debug/scap-driver/scap-driver-0.20.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -26,6 +26,11 @@ CONFIG_CHECK="HAVE_SYSCALL_TRACEPOINTS ~TRACEPOINTS"
 # This version can be found as git tag on the same commit as the libs version.
 DRIVER_VERSION="8.0.0+driver"
 
+PATCHES=(
+       
"${FILESDIR}"/libs-0.20.0-fix-driver-and-bpf-makefile-for-kernel-6.13.patch
+       "${FILESDIR}"/libs-0.20.0-properly-use-LD.patch
+)
+
 src_configure() {
        local mycmakeargs=(
                # we will use linux-mod, so in order to make it through the 
cmake setup

Reply via email to