From 47722ebc01e26167faa844124f4159e66f833ec0 Mon Sep 17 00:00:00 2001 From: cwen Date: Thu, 23 Apr 2020 04:30:35 +0000 Subject: [PATCH] qemu: fix the build with clang on powerpc Workaround the lack the of _CALL_SYSV and build with -O0; -O1 causes linking errors and -O2 segfaults. Input by Brad (maintainer) --- emulators/qemu/Makefile | 7 ++++++- .../patches/patch-tcg_ppc_tcg-target_inc_c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 emulators/qemu/patches/patch-tcg_ppc_tcg-target_inc_c diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index 357bfc8564f..186b6c809d8 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.194 2020/04/04 08:36:55 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.195 2020/04/23 04:30:35 cwen Exp $ ONLY_FOR_ARCHS= aarch64 amd64 arm i386 powerpc sparc64 @@ -106,6 +106,11 @@ CONFIGURE_ARGS+=--disable-debug-info TEST_TARGET= check +# XXX Optimizer bug, using -O2 causes segfaults, -O1 linking errors +.if ${MACHINE_ARCH:Mpowerpc} +CFLAGS += -O0 +.endif + post-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/qemu ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup \ diff --git a/emulators/qemu/patches/patch-tcg_ppc_tcg-target_inc_c b/emulators/qemu/patches/patch-tcg_ppc_tcg-target_inc_c new file mode 100644 index 00000000000..1ac6f2fcca9 --- /dev/null +++ b/emulators/qemu/patches/patch-tcg_ppc_tcg-target_inc_c @@ -0,0 +1,19 @@ +$OpenBSD: patch-tcg_ppc_tcg-target_inc_c,v 1.6 2020/04/23 04:30:35 cwen Exp $ + +Workaround the lack of _CALL_SYSV with clang on powerpc + +Index: tcg/ppc/tcg-target.inc.c +--- tcg/ppc/tcg-target.inc.c.orig ++++ tcg/ppc/tcg-target.inc.c +@@ -25,6 +25,11 @@ + #include "elf.h" + #include "tcg-pool.inc.c" + ++/* clang does not define _CALL_* */ ++#if defined __clang__ && defined __ELF__ ++#define _CALL_SYSV 1 ++#endif ++ + #if defined _CALL_DARWIN || defined __APPLE__ + #define TCG_TARGET_CALL_DARWIN + #endif