[PATCH] Fix build for no-MMU targets

Baruch Siach baruch at tkos.co.il
Tue Jan 8 16:36:20 UTC 2019

Commit 7488ce9e23f1 ("Check whether PTRACE_GET_SYSCALL_INFO is supported
by the kernel") added a fork() call in test_ptrace_get_syscall_info()
which is included in the main strace executable code. Although the
test_ptrace_get_syscall_info() routine is not called on no-MMU targets,
the compiler can't optimize it out because it is a global symbol. So
build for no-MMU targets currently fails:

strace-ptrace_syscall_info.o: In function `test_ptrace_get_syscall_info':
ptrace_syscall_info.c:(.text+0x1c): undefined reference to `fork'

Make the test_ptrace_get_syscall_info() definition depend on HAVE_FORK
to fix that.
 ptrace_syscall_info.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ptrace_syscall_info.c b/ptrace_syscall_info.c
index 55eafddf7f71..cc6ce149649e 100644
--- a/ptrace_syscall_info.c
+++ b/ptrace_syscall_info.c
@@ -40,6 +40,7 @@ static const unsigned int expected_seccomp_size =
  * Test that PTRACE_GET_SYSCALL_INFO API is supported by the kernel, and
  * that the semantics implemented in the kernel matches our expectations.
+#ifdef HAVE_FORK
@@ -255,6 +256,7 @@ done:
 	return ptrace_get_syscall_info_supported;
+#endif /* HAVE_FORK */
 print_ptrace_syscall_info(struct tcb *tcp, kernel_ulong_t addr,

More information about the Strace-devel mailing list