1From 923d25365fbdff17fa4c8c2883960be07c3dad56 Mon Sep 17 00:00:00 2001 2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 3Date: Fri, 5 May 2017 09:07:15 +0200 4Subject: [PATCH] user-exec: fix usage of mcontext structure on ARM/uClibc 5 6user-exec.c has some conditional code to decide how to use the 7mcontext structure. Unfortunately, since uClibc defines __GLIBC__, but 8with old versions of __GLIBC__ and __GLIBC_MINOR__, an old code path 9gets used, which doesn't apply to uClibc. 10 11Fix this by excluding __UCLIBC__, which ensures we fall back to the 12general case of using uc_mcontext.arm_pc, which works fine with 13uClibc. 14 15Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 16--- 17 accel/tcg/user-exec.c | 2 +- 18 1 file changed, 1 insertion(+), 1 deletion(-) 19 20diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c 21index 4ebe25461a..0496674fbd 100644 22--- a/accel/tcg/user-exec.c 23+++ b/accel/tcg/user-exec.c 24@@ -540,7 +540,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, 25 26 #if defined(__NetBSD__) 27 pc = uc->uc_mcontext.__gregs[_REG_R15]; 28-#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) 29+#elif defined(__GLIBC__) && !defined(__UCLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3)) 30 pc = uc->uc_mcontext.gregs[R15]; 31 #else 32 pc = uc->uc_mcontext.arm_pc; 33-- 342.25.3 35 36