commit:     957314a3054fd202618a5a44c076cbcda8c711d5
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 12 19:37:55 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Apr 12 19:39:33 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=957314a3

app-emulation/qemu: Do not rely on DCE for lock type test

Fix CFLAGS=-Og build break. -Og fails because gcc does not enable dead
code elimination (but does set __OPTIMIZE__ define).

The fix avoids DCE reliance downstream entirely.

Reported-by: Luke-Jr
Closes: https://bugs.gentoo.org/782364
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch | 18 ++++++++++++++++++
 app-emulation/qemu/qemu-5.2.0-r50.ebuild            |  1 +
 app-emulation/qemu/qemu-9999.ebuild                 |  1 +
 3 files changed, 20 insertions(+)

diff --git a/app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch 
b/app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch
new file mode 100644
index 00000000000..679a9f391b0
--- /dev/null
+++ b/app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch
@@ -0,0 +1,18 @@
+Fix CFLAGS=-Og build break. -Og fails because gcc does not enable dead
+code elimination (but does set __OPTIMIZE__ define).
+
+The fix avoids DCE reliance downstream entirely.
+
+Reported-by: Luke-Jr
+Bug: https://bugs.gentoo.org/782364
+--- a/include/qemu/lockable.h
++++ b/include/qemu/lockable.h
+@@ -28,7 +28,7 @@ struct QemuLockable {
+  * to QEMU_MAKE_LOCKABLE.  For optimized builds, we can rely on dead-code 
elimination
+  * from the compiler, and give the errors already at link time.
+  */
+-#if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__)
++#if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__) && 
defined(VALIDATE_LOCKS_VIA_DCE)
+ void unknown_lock_type(void *);
+ #else
+ static inline void unknown_lock_type(void *unused)

diff --git a/app-emulation/qemu/qemu-5.2.0-r50.ebuild 
b/app-emulation/qemu/qemu-5.2.0-r50.ebuild
index 6b9bfbec8c9..7a9f08f8539 100644
--- a/app-emulation/qemu/qemu-5.2.0-r50.ebuild
+++ b/app-emulation/qemu/qemu-5.2.0-r50.ebuild
@@ -234,6 +234,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-5.2.0-strings.patch
        "${FILESDIR}"/${PN}-5.2.0-fix-firmware-path.patch
        "${FILESDIR}"/${PN}-5.2.0-no-pie-ld.patch
+       "${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
 )
 
 QA_PREBUILT="

diff --git a/app-emulation/qemu/qemu-9999.ebuild 
b/app-emulation/qemu/qemu-9999.ebuild
index 9e8be4658ae..9970b1a031f 100644
--- a/app-emulation/qemu/qemu-9999.ebuild
+++ b/app-emulation/qemu/qemu-9999.ebuild
@@ -272,6 +272,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-5.2.0-strings.patch
        "${FILESDIR}"/${PN}-5.2.0-cleaner-werror.patch
        "${FILESDIR}"/${PN}-5.2.0-disable-keymap.patch
+       "${FILESDIR}"/${PN}-5.2.0-dce-locks.patch
 )
 
 QA_PREBUILT="

Reply via email to