diff mbox

[2/4] fix build error on ARM due to wrong glibc check

Message ID 50C57DE4.5050304@barfooze.de
State New
Headers show

Commit Message

John Spencer Dec. 10, 2012, 6:15 a.m. UTC

diff mbox

Patch

From ae02bfc600bf8c4c8502e70bdf8dfcd332ebef02 Mon Sep 17 00:00:00 2001
From: John Spencer <maillist-qemu@barfooze.de>
Date: Mon, 10 Dec 2012 06:54:03 +0100
Subject: [PATCH 2/4] fix build error on ARM due to wrong glibc check

the test for glibc < 2 "succeeds" wrongly for any non-glibc C library,
and breaks the build on musl libc.
we must first test if __GLIBC__ is defined at all, before using it
unconditionally.

Signed-off-by: John Spencer <maillist-qemu@barfooze.de>

---
 user-exec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/user-exec.c b/user-exec.c
index ef9b172..cccc145 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -442,7 +442,7 @@  int cpu_signal_handler(int host_signum, void *pinfo,
     unsigned long pc;
     int is_write;
 
-#if (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
+#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
     pc = uc->uc_mcontext.gregs[R15];
 #else
     pc = uc->uc_mcontext.arm_pc;
-- 
1.7.3.4