Skip to contentSkip to conversation

qemu: disable Qemu user-land emulation for uClibc toolchains

PATCH New Francois Perrad 3 participants 4 messages Mar 4, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: disable Qemu user-land emulation for uClibc toolchains

fixes:
http://autobuild.buildroot.org/results/69c/69c66f1876f0d8dba1bd71ee109df371577d8dda

---
 package/qemu/Config.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
package/qemu/Config.in +4 -2
index f4a75fc..3036743 100644
@@ -72,13 +72,15 @@ config BR2_PACKAGE_QEMU_LINUX_USER
 	bool "Enable all Linux user-land emulation"
 	# Incompatible "struct sigevent" definition on musl
 	depends on !BR2_TOOLCHAIN_USES_MUSL
+	# Incompatible "struct sigcontext" definition on uClibc
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC
 	help
 	  Say 'y' to build all Linux user-land emulators that QEMU supports.
 
 # Note: bsd-user can not be build on Linux
 
-comment "Linux user-land emulation needs a glibc or uClibc toolchain"
-	depends on BR2_TOOLCHAIN_USES_MUSL
+comment "Linux user-land emulation needs a glibc toolchain"
+	depends on BR2_TOOLCHAIN_USES_MUSL ||?BR2_TOOLCHAIN_USES_UCLIBC
 
 endif # BR2_PACKAGE_QEMU_CUSTOM_TARGETS == ""
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 qemu: disable Qemu user-land emulation for uClibc toolchains

Hello,

Quoted 2 lines · Francois Perrad

fixes:
http://autobuild.buildroot.org/results/69c/69c66f1876f0d8dba1bd71ee109df371577d8dda

This error happens in ARM only code, so I believe disabling it on all architectures is probably a bit too much. In addition, the fix is most likely trivial, and probably looks like this:

user-exec.c +1 -1
index 6db0758..2b3d116 100644
@@ -409,7 +409,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
 
 #if defined(__NetBSD__)
     pc = uc->uc_mcontext.__gregs[_REG_R15];
-#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
+#elif defined(__GLIBC__) && !defined(__UCLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
     pc = uc->uc_mcontext.gregs[R15];
 #else
     pc = uc->uc_mcontext.arm_pc;

Could you have a try with this?

Adding Waldemar in Cc: since it's a uClibc related issue.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 qemu: disable Qemu user-land emulation for uClibc toolchains

2017-03-04 11:54 GMT+01:00 Thomas Petazzoni
<[email protected]>:

Quoted 24 lines

Hello,

Quoted 2 lines · Francois Perrad

fixes:
http://autobuild.buildroot.org/results/69c/69c66f1876f0d8dba1bd71ee109df371577d8dda

This error happens in ARM only code, so I believe disabling it on all architectures is probably a bit too much. In addition, the fix is most likely trivial, and probably looks like this:

user-exec.c +1 -1
index 6db0758..2b3d116 100644
@@ -409,7 +409,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
 
 #if defined(__NetBSD__)
     pc = uc->uc_mcontext.__gregs[_REG_R15];
-#elif defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
+#elif defined(__GLIBC__) && !defined(__UCLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
     pc = uc->uc_mcontext.gregs[R15];
 #else
     pc = uc->uc_mcontext.arm_pc;
Quoted 4 lines

Could you have a try with this?

Adding Waldemar in Cc: since it's a uClibc related issue.

When the issue with 'struct sigcontext' is fixed, another one occurs:
build/qemu-2.8.0/linux-user/syscall.c:6865:23: error: 'struct timex' has no member named 'tai'

     __put_user(host_tx->tai, &target_tx->tai);
                       ^

The member 'tai' exists in linux/timex.h but not in sys/timex.h with the toolchain from
http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-static-2017.02-rc1-70-g7612a7d.tar.bz2

Fran?ois

Quoted 11 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/1 qemu: disable Qemu user-land emulation for uClibc toolchains

Hello,

Quoted 8 lines · Fran?ois Perrad

When the issue with 'struct sigcontext' is fixed, another one occurs:
build/qemu-2.8.0/linux-user/syscall.c:6865:23: error: 'struct timex' has no member named 'tai'

     __put_user(host_tx->tai, &target_tx->tai);
                       ^

The member 'tai' exists in linux/timex.h but not in sys/timex.h with the toolchain from
http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-static-2017.02-rc1-70-g7612a7d.tar.bz2

Thanks for testing. This one is indeed a uClibc issue, where the 'struct timex' in uClibc-ng is not completely in sync with the one from the kernel.

I'm sure this is something that Waldemar can fix up :)

Thanks for testing!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com