ltrace: Upgrade to 0.8.1 and clang build errors

Drop the upstream applied patches
Add patches to fix build with clang-22
Bump PE to account for version going from 7.x to 0.8

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj
2026-04-12 00:50:53 -07:00
parent 9583c6c401
commit a2d9a9be5f
5 changed files with 125 additions and 119 deletions
@@ -1,86 +0,0 @@
From 491b3b153f6b5cbf2d23a9778e5676eb29a6705f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 6 Feb 2023 16:37:19 -0800
Subject: [PATCH] Fix type of single bit bitfields
clang16 warns
trace.c:311:22: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
quash the warning by using an unsigned type to allow
an assignment of 0 or 1 without implicit conversion.
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
library.h | 6 +++---
prototype.h | 2 +-
sysdeps/linux-gnu/trace.h | 10 +++++-----
3 files changed, 9 insertions(+), 9 deletions(-)
--- a/library.h
+++ b/library.h
@@ -71,20 +71,20 @@ struct library_symbol {
* looking up one in LIB->protolib. */
struct prototype *proto;
- int own_name : 1;
+ unsigned int own_name : 1;
/* This is relevant for PLT symbols. Latent PLT symbols are
* those that don't match any of the -e rules, but that might
* potentially become active if a library implementing them
* appears that matches a -l rule. Ltrace core is responsible
* for clearing latent flag. */
- int latent : 1;
+ unsigned latent : 1;
/* Delayed symbols are those for which a breakpoint shouldn't
* be enabled yet. They are similar to latent symbols, but
* backend is responsible for clearing the delayed flag. See
* proc_activate_delayed_symbol. */
- int delayed : 1;
+ unsigned int delayed : 1;
struct arch_library_symbol_data arch;
struct os_library_symbol_data os;
--- a/prototype.h
+++ b/prototype.h
@@ -162,7 +162,7 @@ struct protolib_cache {
/* For tracking uses of cache during cache's own
* initialization. */
- int bootstrap : 1;
+ unsigned int bootstrap : 1;
};
/* Initialize CACHE. Returns 0 on success or a negative value on
--- a/sysdeps/linux-gnu/trace.h
+++ b/sysdeps/linux-gnu/trace.h
@@ -33,11 +33,11 @@
struct pid_task {
pid_t pid; /* This may be 0 for tasks that exited
* mid-handling. */
- int sigstopped : 1;
- int got_event : 1;
- int delivered : 1;
- int vforked : 1;
- int sysret : 1;
+ unsigned int sigstopped : 1;
+ unsigned int got_event : 1;
+ unsigned int delivered : 1;
+ unsigned int vforked : 1;
+ unsigned int sysret : 1;
};
struct pid_set {
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -1043,7 +1043,7 @@ ltrace_exiting_install_handler(struct pr
struct process_vfork_handler
{
struct event_handler super;
- int vfork_bp_refd:1;
+ unsigned int vfork_bp_refd:1;
};
static Event *
@@ -1,27 +0,0 @@
From c1d3aaf5ec810c2594938438c7b4ccd20943f255 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 7 Jul 2017 10:20:52 -0700
Subject: [PATCH] configure: Recognise linux-musl as a host OS
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index 3e8667f..95d6642 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,7 @@ AC_CANONICAL_HOST
case "${host_os}" in
linux-gnu*) HOST_OS="linux-gnu" ;;
linux-uclibc*) HOST_OS="linux-gnu" ;;
+ linux-musl*) HOST_OS="linux-gnu" ;;
*) AC_MSG_ERROR([unkown host-os ${host_os}]) ;;
esac
AC_SUBST(HOST_OS)
--
2.13.2
@@ -0,0 +1,34 @@
From d568c0cbdecf31a7020f2a0574470d014f447a86 Mon Sep 17 00:00:00 2001
From: Khem Raj <khem.raj@oss.qualcomm.com>
Date: Sun, 12 Apr 2026 00:07:06 -0700
Subject: [PATCH] dwarf_prototypes: return NULL from NEXT_SIBLING on error
NEXT_SIBLING is used in functions that return pointers, so returning
false on error is misleading and relies on implicit conversion.
Return (void *)0 instead to make the failure value explicit and match
the surrounding function return type.
This is flagged by clang-22 due to
Replacing return false with return (void *)0
avoids clang's -Wbool-conversion error when the macro expands
inside functions returning a pointer type.
Upstream-Status: Submitted [https://gitlab.com/cespedes/ltrace/-/merge_requests/30]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
dwarf_prototypes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dwarf_prototypes.c b/dwarf_prototypes.c
index bfac177..e7ea1bc 100644
--- a/dwarf_prototypes.c
+++ b/dwarf_prototypes.c
@@ -36,7 +36,7 @@
#define NEXT_SIBLING(die) \
int res = dwarf_siblingof(die, die); \
if (res == 0) continue; /* sibling exists */ \
- if (res < 0) return false; /* error */ \
+ if (res < 0) return (void *)0; /* error */ \
break /* no sibling exists */
static struct arg_type_info *get_type(int *newly_allocated_info,
@@ -0,0 +1,86 @@
From 65c5a621a366a25b8572cd29c01b4aa92c02903a Mon Sep 17 00:00:00 2001
From: Khem Raj <khem.raj@oss.qualcomm.com>
Date: Sun, 12 Apr 2026 00:46:20 -0700
Subject: [PATCH] trace: fix 1-bit bitfield assignments for clang
-Wsingle-bit-bitfield-constant-conversion
Replace '1' with 'true' for all 1-bit signed bitfield assignments.
Assigning integer 1 to a 1-bit signed bitfield truncates to -1; using
'true' which is a bool is well-defined and avoids the clang error.
Upstream-Status: Submitted [https://gitlab.com/cespedes/ltrace/-/merge_requests/30]
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
ltrace-elf.c | 2 +-
sysdeps/linux-gnu/trace.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ltrace-elf.c b/ltrace-elf.c
index beaf69f..2be609c 100644
--- a/ltrace-elf.c
+++ b/ltrace-elf.c
@@ -819,7 +819,7 @@ mark_chain_latent(struct library_symbol *libsym)
{
for (; libsym != NULL; libsym = libsym->next) {
debug(DEBUG_FUNCTION, "marking %s latent", libsym->name);
- libsym->latent = 1;
+ libsym->latent = true;
}
}
diff --git a/sysdeps/linux-gnu/trace.c b/sysdeps/linux-gnu/trace.c
index 12c8747..b7f4c57 100644
--- a/sysdeps/linux-gnu/trace.c
+++ b/sysdeps/linux-gnu/trace.c
@@ -310,13 +310,13 @@ send_sigstop(struct process *task, void *data)
* weed out unnecessary looping. */
if (st == PS_SLEEPING
&& is_vfork_parent(task)) {
- task_info->vforked = 1;
+ task_info->vforked = true;
return CBS_CONT;
}
if (task_kill(task->pid, SIGSTOP) >= 0) {
debug(DEBUG_PROCESS, "send SIGSTOP to %d", task->pid);
- task_info->sigstopped = 1;
+ task_info->sigstopped = true;
} else
fprintf(stderr,
"Warning: couldn't send SIGSTOP to %d\n", task->pid);
@@ -442,7 +442,7 @@ handle_stopping_event(struct pid_task *task_info, Event **eventp)
{
/* Mark all events, so that we know whom to SIGCONT later. */
if (task_info != NULL)
- task_info->got_event = 1;
+ task_info->got_event = true;
Event *event = *eventp;
@@ -454,7 +454,7 @@ handle_stopping_event(struct pid_task *task_info, Event **eventp)
debug(DEBUG_PROCESS, "SIGSTOP delivered to %d", task_info->pid);
if (task_info->sigstopped
&& !task_info->delivered) {
- task_info->delivered = 1;
+ task_info->delivered = true;
*eventp = NULL; // sink the event
} else
fprintf(stderr, "suspicious: %d got SIGSTOP, but "
@@ -748,7 +748,7 @@ process_stopping_on_event(struct event_handler *super, Event *event)
debug(1, "%d LT_EV_SYSRET", event->proc->pid);
event_to_queue = 0;
if (task_info != NULL)
- task_info->sysret = 1;
+ task_info->sysret = true;
}
switch (state) {
@@ -1070,7 +1070,7 @@ process_vfork_on_event(struct event_handler *super, Event *event)
&event->e_un.brk_addr, &sbp);
assert(sbp != NULL);
breakpoint_turn_on(sbp, proc->leader);
- self->vfork_bp_refd = 1;
+ self->vfork_bp_refd = true;
}
break;
@@ -9,25 +9,24 @@ HOMEPAGE = "http://ltrace.org/"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
PE = "1"
PV = "7.91+git"
SRCREV = "8eabf684ba6b11ae7a1a843aca3c0657c6329d73"
PE = "2"
SRCREV = "7ef6e6097586b751cce298c256a919404dab259d"
DEPENDS = "elfutils"
SRC_URI = "git://gitlab.com/cespedes/ltrace.git;protocol=https;branch=main \
SRC_URI = "git://gitlab.com/cespedes/ltrace.git;protocol=https;branch=main;tag=${PV} \
file://configure-allow-to-disable-selinux-support.patch \
file://0001-Use-correct-enum-type.patch \
file://0002-Fix-const-qualifier-error.patch \
file://0001-Add-support-for-mips64-n32-n64.patch \
file://0001-configure-Recognise-linux-musl-as-a-host-OS.patch \
file://0001-mips-plt.c-Delete-include-error.h.patch \
file://0001-move-fprintf-into-same-block-where-modname-and-symna.patch \
file://0001-hook-Do-not-append-int-to-std-string.patch \
file://0001-Bug-fix-for-data-type-length-judgment.patch \
file://0001-ppc-Remove-unused-host_powerpc64-function.patch \
file://0001-mips-Use-hardcodes-values-for-ABI-syscall-bases.patch \
file://0001-Fix-type-of-single-bit-bitfields.patch \
file://0001-proc-Make-PROC_PID_FILE-not-use-variable-length-arra.patch \
file://0001-dwarf_prototypes-return-NULL-from-NEXT_SIBLING-on-er.patch \
file://0001-trace-fix-1-bit-bitfield-assignments-for-clang-Wsing.patch \
"
SRC_URI:append:libc-musl = " file://add_ppc64le.patch"