Skip to contentSkip to conversation

package/ltrace: fix build with uClibc-ng

PATCH New Yegor Yefremov 1 participant 1 message Nov 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/ltrace: fix build with uClibc-ng

ltrace 0.8.1 includes upstream commit eb9eebc ("PowerPC ltrace-elf handle LEP/GEP offset"), which uses the PowerPC-specific PPC64_LOCAL_ENTRY_OFFSET() macro in generic code, for all architectures. uClibc-ng's <elf.h> does not define it, so the build fails:

ltrace-elf.c:1019:25: error: implicit declaration of function 'PPC64_LOCAL_ENTRY_OFFSET' [-Wimplicit-function-declaration]

Add a patch, submitted upstream, that only applies the offset on powerpc64.

This issue has been present since commit d4a505b17565 ("package/ltrace: bump version to 0.8.1"), which pulled in the upstream change. It therefore affects 2025.11 and later, including the 2025.11.x, 2026.02.x, 2026.05.x and 2026.08.x branches (2025.02.x is not affected).

Fixes:
https://autobuild.buildroot.org/results/c66189f0fbf5df777f747b72d97d2e4af178c736

Fixes d4a505b17565641e7655e8b992da5bb6029b0ee7 ("package/ltrace: bump version to 0.8.1")
Assisted-by Claude:claude-opus-5-5
---
 ...apply-the-PPC64-local-entry-offset-o.patch | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 package/ltrace/0003-ltrace-elf-only-apply-the-PPC64-local-entry-offset-o.patch
package/ltrace/0003-ltrace-elf-only-apply-the-PPC64-local-entry-offset-o.patch new file +44 -0
new file mode 100644
index 0000000000..004d8f6a5c
@@ -0,0 +1,44 @@
+From 2ea021aa0bc58fd56df6af37c8e7bc8b27e35f29 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Mon, 16 Nov 2026 11:58:32 +0100
+Subject: [PATCH] ltrace-elf: only apply the PPC64 local entry offset on
+ powerpc64
+
+Commit eb9eebc ("PowerPC ltrace-elf handle LEP/GEP offset") added the
+PPC64_LOCAL_ENTRY_OFFSET() adjustment to the generic symbol table code,
+so it is used on all architectures. This breaks the build with C
+libraries whose <elf.h> does not provide this PowerPC-specific macro,
+like uClibc-ng:
+
+  ltrace-elf.c:1019:25: error: implicit declaration of function 'PPC64_LOCAL_ENTRY_OFFSET' [-Wimplicit-function-declaration]
+
+It is also wrong on other architectures that use the upper bits of
+st_other: e.g. on AArch64, STO_AARCH64_VARIANT_PCS (0x80) makes the
+macro return 16, moving the address of such functions.
+
+Only apply the offset when building for powerpc64 and the macro is
+available, like sysdeps/linux-gnu/ppc/plt.c already checks for it.
+
+Assisted-by: Claude:claude-opus-5-5
+Upstream: https://gitlab.com/cespedes/ltrace/-/merge_requests/113
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ ltrace-elf.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/ltrace-elf.c b/ltrace-elf.c
+index beaf69f..1091483 100644
+--- a/ltrace-elf.c
++++ b/ltrace-elf.c
+@@ -1016,7 +1016,11 @@ populate_this_symtab(struct process *proc, const char *filename,
+ 			(uintptr_t)(sym.st_value + lte->bias);
+ 		arch_addr_t naddr;
+ 
++#if defined(__powerpc64__) && defined(PPC64_LOCAL_ENTRY_OFFSET)
++		/* With ELFv2 ABI, the st_other field holds the offset
++		 * of the local entry point.  */
+ 		addr += PPC64_LOCAL_ENTRY_OFFSET(sym.st_other);
++#endif
+ 
+ 		/* On arches that support OPD, the value of typical
+ 		 * function symbol will be a pointer to .opd, but some
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot