diff options
| author | Paul Spooren | 2026-10-11 15:49:45 +0000 |
|---|---|---|
| committer | Paul Spooren | 2026-10-13 19:12:54 +0000 |
| commit | beda530aac29ba17384fe964e482dc64f02e9856 (patch) | |
| tree | 8f2ffd58b30f8ed4110037b6ecefb651d8c11926 | |
| parent | 0364bc256fdc16665ddbab3e518f4d3e67e6fe39 (diff) | |
kernel: map the directory of external modules out of __FILE__ on 6.12
Kernel modules from the packages feed still differ between builds on
targets with Linux 6.12, e.g. kmod-jool-netfilter on tegra:
/builder/shared-workdir/build/build_dir/.../jool-4.1.15/src/mod/common/xlator.c
These packages build through make -C $(LINUX_DIR) M=... without the
OpenWrt prefix maps. On 6.12, kbuild compiles external modules from the
absolute M= path and maps only the kernel tree, so __FILE__ keeps the
absolute path of the module sources. Linux 6.13 maps the module
directory itself, which is why 6.18 only needed the kernel tree mapped
(206-kbuild-map-the-kernel-tree-for-external-modules.patch).
Add a pending patch for 6.12 that maps the directory of external
modules. It comes after the map of the kernel tree and before KCFLAGS,
so modules built through KERNEL_MAKE keep their current output.
On a 6.12 tree, __FILE__ of an external module changes from its
absolute path to the path relative to the module directory.
Link: https://github.com/openwrt/openwrt/pull/25875
Signed-off-by: Paul Spooren <mail@aparcar.org>
| -rw-r--r-- | target/linux/generic/pending-6.12/206-kbuild-map-the-external-module-directory.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/target/linux/generic/pending-6.12/206-kbuild-map-the-external-module-directory.patch b/target/linux/generic/pending-6.12/206-kbuild-map-the-external-module-directory.patch new file mode 100644 index 0000000000..77a6fe81b8 --- /dev/null +++ b/target/linux/generic/pending-6.12/206-kbuild-map-the-external-module-directory.patch @@ -0,0 +1,35 @@ +From a352553356d2670933a9f4dc973372c57a2708fc Mon Sep 17 00:00:00 2001 +From: Paul Spooren <mail@aparcar.org> +Date: Sun, 11 Oct 2026 17:48:27 +0200 +Subject: [PATCH] kbuild: map the directory of external modules out of __FILE__ + +External modules are built from the absolute path given with M=, and +only the kernel tree is mapped with -fmacro-prefix-map, so every +__FILE__ of an external module, e.g. in WARN_ON() or pr_debug(), holds +the absolute path of the module: + + /builder/shared-workdir/build/build_dir/.../jool-4.1.15/src/mod/common/xlator.c + +Linux 6.13 maps the module directory itself, as srcroot. Map it here as +well when building an external module. The map comes after the one of +the kernel tree and before KCFLAGS, as GCC uses the last matching map. + +Signed-off-by: Paul Spooren <mail@aparcar.org> +--- + Makefile | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/Makefile ++++ b/Makefile +@@ -1029,6 +1029,11 @@ KBUILD_CFLAGS += -fno-builtin-wcslen + + # change __FILE__ to the relative path from the srctree + KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) ++# External modules are built from the absolute path of their directory, so ++# map it as well, like Linux 6.13 and later do ++ifdef KBUILD_EXTMOD ++KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(abspath $(KBUILD_EXTMOD))/=) ++endif + + # include additional Makefiles when needed + include-y := scripts/Makefile.extrawarn |