[PATCH 2/2] test/threaded_execve: fix on metag

James Hogan james.hogan at imgtec.com
Wed May 1 12:16:50 UTC 2013


The metag ABI has stacks growing upwards so clone expects the stack
argument to point at the bottom of the stack instead of the top. Define
clone2 differently for metag to avoid a segfault at runtime.

Signed-off-by: James Hogan <james.hogan at imgtec.com>
---
 test/threaded_execve.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/threaded_execve.c b/test/threaded_execve.c
index 628589a..4c21688 100644
--- a/test/threaded_execve.c
+++ b/test/threaded_execve.c
@@ -54,6 +54,9 @@
 extern int __clone2(int (*fn) (void *), void *child_stack_base,
 		size_t stack_size, int flags, void *arg, ...);
 #define clone2 __clone2
+#elif defined(__metag__)
+#define clone2(func, stack_base, size, flags, arg...) \
+        clone(func, stack_base, flags, arg)
 #else
 #define clone2(func, stack_base, size, flags, arg...) \
         clone(func, (stack_base) + (size), flags, arg)
-- 
1.8.1.2






More information about the Strace-devel mailing list