ltrace: fix build on ppc*-musl

This commit is contained in:
q66 2019-12-19 17:06:25 +01:00
parent 4fa9af7561
commit 206bdb63e7
2 changed files with 38 additions and 3 deletions

View File

@ -0,0 +1,36 @@
--- sysdeps/linux-gnu/ppc/regs.c
+++ sysdeps/linux-gnu/ppc/regs.c
@@ -27,7 +27,9 @@
#include <sys/ptrace.h>
#include <asm/ptrace.h>
#include <errno.h>
+#ifdef __GLIBC__
#include <error.h>
+#endif
#include "proc.h"
#include "common.h"
@@ -50,7 +52,13 @@ void
set_instruction_pointer(struct process *proc, void *addr)
{
if (ptrace(PTRACE_POKEUSER, proc->pid, sizeof(long)*PT_NIP, addr) != 0)
+ {
+#ifdef __GLIBC__
error(0, errno, "set_instruction_pointer");
+#else
+ fprintf(stderr, "set_instruction_pointer: %s\n", strerror(errno));
+#endif
+ }
}
void *
--- sysdeps/linux-gnu/ppc/trace.c
+++ sysdeps/linux-gnu/ppc/trace.c
@@ -24,6 +24,7 @@
#include "config.h"
+#include <asm/ptrace.h>
#include <assert.h>
#include <elf.h>
#include <errno.h>

View File

@ -17,14 +17,13 @@ checksum=4aecf69e4a33331aed1e50ce4907e73a98cbccc4835febc3473863474304d547
CFLAGS="-Wno-error -D_GNU_SOURCE"
pre_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl)
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
sed -i '/HOST_OS/s/linux-uclibc/linux-musl/g' configure.ac
sed -i -e '/error.h/d' -e 's/error(1, errno/err(1/' \
read_config_file.c expr.c zero.c
sed -i '1i#include <sys/types.h>' proc.h
sed -i 's/#ifndef __mips__/#if 0/' proc.c
esac
fi
autoreconf -fi
}