new file mode 100644
@@ -0,0 +1,34 @@
+From 436163ab845c263312cf3d4717a43727cf5f0747 Mon Sep 17 00:00:00 2001
+From: Matteo Croce <mcroce@microsoft.com>
+Date: Wed, 15 Sep 2021 17:54:01 +0200
+Subject: [PATCH] Use /usr/bin/env python3 instead of just /usr/bin/python3
+
+Upstream-Status: Inappropriate [OE specific]
+---
+ ostra/ostra-cg | 2 +-
+ ostra/python/ostra.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/ostra/ostra-cg b/ostra/ostra-cg
+index 52c902e..8142e67 100755
+--- a/ostra/ostra-cg
++++ b/ostra/ostra-cg
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python3
++#!/usr/bin/env python3
+ # ostra-cg - generate callgraphs from encoded trace
+ #
+ # Arnaldo Carvalho de Melo <acme@redhat.com>
+diff --git a/ostra/python/ostra.py b/ostra/python/ostra.py
+index 86fe079..9bb5ad1 100755
+--- a/ostra/python/ostra.py
++++ b/ostra/python/ostra.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python3
++#!/usr/bin/env python3
+ #
+ # Copyright (C) 2005, 2006, 2007 Arnaldo Carvalho de Melo
+ #
+--
+2.31.1
+
new file mode 100644
@@ -0,0 +1,55 @@
+From 6fa2b7de3e647e64c5d693aea7f3bacbfa964f53 Mon Sep 17 00:00:00 2001
+From: Ihor Solodari <ihor.solodrai@linux.dev>
+Date: Wed, 20 Aug 2025 09:00:03 +0100
+Subject: [PATCH] btf_encoder: Fix elf_functions cleanup on error
+
+When elf_functions__new() errors out and jumps to
+elf_functions__delete(), pahole segfaults on attempt to list_del() the
+elf_functions instance from a list, to which it was never added.
+
+Fix this by moving list_del() call out of elf_functions__delete().
+Remove from the list only on normal cleanup in
+elf_functions_list__clear().
+
+v1:
+https://lore.kernel.org/dwarves/979a1ac4-21d3-4384-8ce4-d10f41887088@linux.dev/
+
+Closes:
+https://lore.kernel.org/dwarves/24bcc853-533c-42ab-bc37-0c13e0baa217@windriver.com/
+Reported-by: Changqing Li <changqing.li@windriver.com>
+Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
+Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Link: https://lore.kernel.org/dwarves/acef4a0e-7d3b-4e05-b3ca-1007580f2754@linux.dev/
+Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
+
+Upstream-Status: Backport [https://git.kernel.org/pub/scm/devel/pahole/pahole.git/commit/?h=next&id=fe6738f4b46b63dcdc5b15b252a014b3eaba16a4]
+
+Signed-off-by: Changqing Li <changqing.li@windriver.com>
+Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com>
+---
+ btf_encoder.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/btf_encoder.c b/btf_encoder.c
+index 511c1ea..2f8c6bb 100644
+--- a/btf_encoder.c
++++ b/btf_encoder.c
+@@ -162,7 +162,6 @@ static inline void elf_functions__delete(struct elf_functions *funcs)
+ free(funcs->entries[i].alias);
+ free(funcs->entries);
+ elf_symtab__delete(funcs->symtab);
+- list_del(&funcs->node);
+ free(funcs);
+ }
+
+@@ -204,6 +203,7 @@ static inline void elf_functions_list__clear(struct list_head *elf_functions_lis
+
+ list_for_each_safe(pos, tmp, elf_functions_list) {
+ funcs = list_entry(pos, struct elf_functions, node);
++ list_del(&funcs->node);
+ elf_functions__delete(funcs);
+ }
+ }
+--
+2.34.1
+
new file mode 100644
@@ -0,0 +1,33 @@
+SUMMARY = "Shows and manipulates data structure layout"
+
+LICENSE = "GPL-2.0-only"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+
+DEPENDS = "elfutils zlib libbpf"
+
+# Depends on MACHINE_ARCH libbpf
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_HOST = "(x86_64|i.86|arm|aarch64|riscv64|powerpc|powerpc64|mips64).*-linux"
+
+SRCREV = "b9cc7963051b2099795129450f9b70c81950d02f"
+SRC_URI = "git://git.kernel.org/pub/scm/devel/pahole/pahole.git;branch=master \
+ file://0001-Use-usr-bin-env-python3-instead-of-just-usr-bin-pyth.patch \
+ file://0001-btf_encoder-Fix-elf_functions-cleanup-on-error.patch"
+
+S = "${WORKDIR}/git"
+
+inherit cmake pkgconfig
+
+PACKAGECONFIG[python3] = ",,python3,python3-core"
+
+EXTRA_OECMAKE = "-D__LIB=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} -DCMAKE_BUILD_TYPE=Release -DLIBBPF_EMBEDDED=OFF"
+
+FILES:${PN} = "${bindir}/pahole \
+ ${libdir}/libdwarves.so* \
+ ${libdir}/libdwarves_reorganize.so*"
+
+PACKAGES += "${PN}-extra"
+FILES:${PN}-extra = "${datadir} ${bindir} ${libdir}/libdwarves_emit.so*"
+RDEPENDS:${PN}-extra += "bash python3-core"
+
+BBCLASSEXTEND = "native nativesdk"
pahole v1.25 in scarthgap non-deterministic BTF type ID ordering when using its parallel mode (-j). The kernel build system (scripts/pahole-flags.sh) automatically passes -j to pahole for versions >= 1.22. This means two builds from identical source produce different vmlinux binaries with different .BTF sections, even though the bitBake task hash is the same. It was fixed in pahole v1.29 (Jan 2025, commit 4c916259) which made reproducible builds always-on by default. Since Scarthgap is a stable release, the current v1.25 is retained to support users who require the older version. Users can revert to it by setting PREFERRED_VERSION_pahole = "1.25". Additionally, the patches: 0001-Use-usr-bin-env-python3-instead-of-just-usr-bin-pyth.patch 0001-btf_encoder-Fix-elf_functions-cleanup-on-error.patch are backported from Walnasacar to resolve specific issues in v1.29. Signed-off-by: Xiangyu Chen <xiangyu.chen@eng.windriver.com> --- ...python3-instead-of-just-usr-bin-pyth.patch | 34 ++++++++++++ ...r-Fix-elf_functions-cleanup-on-error.patch | 55 +++++++++++++++++++ .../recipes-devtools/pahole/pahole_1.29.bb | 33 +++++++++++ 3 files changed, 122 insertions(+) create mode 100644 meta-oe/recipes-devtools/pahole/files/0001-Use-usr-bin-env-python3-instead-of-just-usr-bin-pyth.patch create mode 100644 meta-oe/recipes-devtools/pahole/files/0001-btf_encoder-Fix-elf_functions-cleanup-on-error.patch create mode 100644 meta-oe/recipes-devtools/pahole/pahole_1.29.bb