Skip to contentSkip to conversation

linux-user: fix build with musl on aarch64

PATCH In review Natanael Copa 2 participants 2 messages Dec 15, 2016 – Jan 12, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: fix build with musl on aarch64

Use the standard uint64_t instead of internal __u64.

This fixes compiler error with musl libc on aarch64:
.../qemu-2.7.0/linux-user/host/aarch64/hostdep.h:28:5:
error: unknown type name '__u64'

     __u64 *pcreg = &uc->uc_mcontext.pc;
     ^~~~~
---
 linux-user/host/aarch64/hostdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/host/aarch64/hostdep.h +1 -1
index 64f75cef49..6fd6e36b2a 100644
@@ -25,7 +25,7 @@ extern char safe_syscall_end[];
 static inline void rewind_if_in_safe_syscall(void *puc)
 {
     struct ucontext *uc = puc;
-    __u64 *pcreg = &uc->uc_mcontext.pc;
+    uint64_t *pcreg = &uc->uc_mcontext.pc;
 
     if (*pcreg > (uintptr_t)safe_syscall_start
         && *pcreg < (uintptr_t)safe_syscall_end) {
Signature · 1 line
2.11.0
#1 lore raw
Quoted 18 lines · Natanael Copa

Use the standard uint64_t instead of internal __u64.

This fixes compiler error with musl libc on aarch64:
.../qemu-2.7.0/linux-user/host/aarch64/hostdep.h:28:5:
error: unknown type name '__u64'

     __u64 *pcreg = &uc->uc_mcontext.pc;
     ^~~~~
---
 linux-user/host/aarch64/hostdep.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/host/aarch64/hostdep.h +0 -0
index 64f75cef49..6fd6e36b2a 100644

linux-user/host/aarch64/hostdep.h extern char safe_syscall_end[]; · line 28

Quoted 5 lines
linux-user/host/aarch64/hostdep.h +1 -1
@@ -25,7 +25,7 @@ extern char safe_syscall_end[];
 static inline void rewind_if_in_safe_syscall(void *puc)
 {
     struct ucontext *uc = puc;
-    __u64 *pcreg = &uc->uc_mcontext.pc;
+    uint64_t *pcreg = &uc->uc_mcontext.pc;

Is this type available in all places where this header is being included (apparently these are linux-user/qemu.h and linux-user/safe-syscall.S, with the latter not being interesting. But in linux-user/qemu.h, this is the first file which is included..

Why do we have a mix of __u64 and uint64_t ? :)

Hmm.

/mjt

Quoted 3 lines
linux-user/host/aarch64/hostdep.h +0 -0
     if (*pcreg > (uintptr_t)safe_syscall_start
         && *pcreg < (uintptr_t)safe_syscall_end) {