From 607fbaf0713a409be96305ac12f73da62bff92477563b557497530aa5575db62 Mon Sep 17 00:00:00 2001 From: Bruce Rogers Date: Tue, 18 Aug 2020 20:41:08 +0000 Subject: [PATCH] Accepting request 827680 from home:bfrogers:branches:Virtualization - Fix compilation errors seen with pre-release gcc 11 atomic.h-change-method-for-removing-C-qu.patch help-compiler-out-by-initializing-array.patch s390x-Fix-stringop-truncation-issue-repo.patch (also tweak needed to previous submission) (also minor tweak to update_git.sh, which is needed to correctly handle the state of git repo sitting on actual release commit. OBS-URL: https://build.opensuse.org/request/show/827680 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=560 --- ...ic.h-change-method-for-removing-C-qu.patch | 107 ++++++++++++++++++ bundles.tar.xz | 4 +- help-compiler-out-by-initializing-array.patch | 27 +++++ qemu.changes | 8 ++ qemu.spec | 6 + qemu.spec.in | 4 +- ...x-Fix-stringop-truncation-issue-repo.patch | 22 ++++ update_git.sh | 10 +- 8 files changed, 181 insertions(+), 7 deletions(-) create mode 100644 atomic.h-change-method-for-removing-C-qu.patch create mode 100644 help-compiler-out-by-initializing-array.patch create mode 100644 s390x-Fix-stringop-truncation-issue-repo.patch diff --git a/atomic.h-change-method-for-removing-C-qu.patch b/atomic.h-change-method-for-removing-C-qu.patch new file mode 100644 index 00000000..210408a5 --- /dev/null +++ b/atomic.h-change-method-for-removing-C-qu.patch @@ -0,0 +1,107 @@ +From: Bruce Rogers +Date: Tue, 18 Aug 2020 11:12:28 -0600 +Subject: atomic.h: change method for removing C qualifier + +gcc 11 is reporting warnings with the current method used to strip +qualifiers (eg const) from the variables used in some atomic functions. +In this case it's for calls from util/qht.c. Switch to using __auto_type +initialization from a 0 cast to the intended type. It appears that a const +qualifier is automatically stripped from the type when done this way, +which is what we're aiming for here. + +Signed-off-by: Bruce Rogers +--- + include/qemu/atomic.h | 52 +++++-------------------------------------- + 1 file changed, 6 insertions(+), 46 deletions(-) + +diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h +index ff72db51154ca9aeab8e46cfb548..fa01ac85eb4d82e2e6432559ab2e 100644 +--- a/include/qemu/atomic.h ++++ b/include/qemu/atomic.h +@@ -18,48 +18,6 @@ + /* Compiler barrier */ + #define barrier() ({ asm volatile("" ::: "memory"); (void)0; }) + +-/* The variable that receives the old value of an atomically-accessed +- * variable must be non-qualified, because atomic builtins return values +- * through a pointer-type argument as in __atomic_load(&var, &old, MODEL). +- * +- * This macro has to handle types smaller than int manually, because of +- * implicit promotion. int and larger types, as well as pointers, can be +- * converted to a non-qualified type just by applying a binary operator. +- */ +-#define typeof_strip_qual(expr) \ +- typeof( \ +- __builtin_choose_expr( \ +- __builtin_types_compatible_p(typeof(expr), bool) || \ +- __builtin_types_compatible_p(typeof(expr), const bool) || \ +- __builtin_types_compatible_p(typeof(expr), volatile bool) || \ +- __builtin_types_compatible_p(typeof(expr), const volatile bool), \ +- (bool)1, \ +- __builtin_choose_expr( \ +- __builtin_types_compatible_p(typeof(expr), signed char) || \ +- __builtin_types_compatible_p(typeof(expr), const signed char) || \ +- __builtin_types_compatible_p(typeof(expr), volatile signed char) || \ +- __builtin_types_compatible_p(typeof(expr), const volatile signed char), \ +- (signed char)1, \ +- __builtin_choose_expr( \ +- __builtin_types_compatible_p(typeof(expr), unsigned char) || \ +- __builtin_types_compatible_p(typeof(expr), const unsigned char) || \ +- __builtin_types_compatible_p(typeof(expr), volatile unsigned char) || \ +- __builtin_types_compatible_p(typeof(expr), const volatile unsigned char), \ +- (unsigned char)1, \ +- __builtin_choose_expr( \ +- __builtin_types_compatible_p(typeof(expr), signed short) || \ +- __builtin_types_compatible_p(typeof(expr), const signed short) || \ +- __builtin_types_compatible_p(typeof(expr), volatile signed short) || \ +- __builtin_types_compatible_p(typeof(expr), const volatile signed short), \ +- (signed short)1, \ +- __builtin_choose_expr( \ +- __builtin_types_compatible_p(typeof(expr), unsigned short) || \ +- __builtin_types_compatible_p(typeof(expr), const unsigned short) || \ +- __builtin_types_compatible_p(typeof(expr), volatile unsigned short) || \ +- __builtin_types_compatible_p(typeof(expr), const volatile unsigned short), \ +- (unsigned short)1, \ +- (expr)+0)))))) +- + #ifdef __ATOMIC_RELAXED + /* For C11 atomic ops */ + +@@ -157,7 +115,7 @@ + #define atomic_rcu_read(ptr) \ + ({ \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ +- typeof_strip_qual(*ptr) _val; \ ++ __auto_type _val = (typeof(*ptr))0; \ + atomic_rcu_read__nocheck(ptr, &_val); \ + _val; \ + }) +@@ -170,7 +128,7 @@ + #define atomic_load_acquire(ptr) \ + ({ \ + QEMU_BUILD_BUG_ON(sizeof(*ptr) > ATOMIC_REG_SIZE); \ +- typeof_strip_qual(*ptr) _val; \ ++ __auto_type _val = (typeof(*ptr))0; \ + __atomic_load(ptr, &_val, __ATOMIC_ACQUIRE); \ + _val; \ + }) +@@ -194,7 +152,8 @@ + + /* Returns the eventual value, failed or not */ + #define atomic_cmpxchg__nocheck(ptr, old, new) ({ \ +- typeof_strip_qual(*ptr) _old = (old); \ ++ __auto_type _old = (typeof(*ptr))0; \ ++ _old = (old); \ + (void)__atomic_compare_exchange_n(ptr, &_old, new, false, \ + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); \ + _old; \ +@@ -461,7 +420,8 @@ + #endif + + #define atomic_fetch_inc_nonzero(ptr) ({ \ +- typeof_strip_qual(*ptr) _oldn = atomic_read(ptr); \ ++ __auto_type _oldn = (typeof(*ptr))0; \ ++ _oldn = atomic_read(ptr); \ + while (_oldn && atomic_cmpxchg(ptr, _oldn, _oldn + 1) != _oldn) { \ + _oldn = atomic_read(ptr); \ + } \ diff --git a/bundles.tar.xz b/bundles.tar.xz index 5a431145..79696c10 100644 --- a/bundles.tar.xz +++ b/bundles.tar.xz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:538acceeee5a8882a1bacc0a4601a05e402922c18bec4609c6491796073f8556 -size 44000 +oid sha256:2b76e56ef2c95a006d8deed85abf08d323980a872b4102ea42f12f5de6ef006e +size 34892 diff --git a/help-compiler-out-by-initializing-array.patch b/help-compiler-out-by-initializing-array.patch new file mode 100644 index 00000000..6973aff7 --- /dev/null +++ b/help-compiler-out-by-initializing-array.patch @@ -0,0 +1,27 @@ +From: Bruce Rogers +Date: Thu, 13 Aug 2020 18:23:35 -0600 +Subject: help compiler out by initializing array + +The pre-release gcc 11 compiler is complaining that result_raw in +bigint_test_exec is flagged as possibly being uninitialized when used +(-Werror=maybe-uninitialized). Help the compiler by initializing the +array. + +Signed-off-by: Bruce Rogers +--- + src/tests/bigint_test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/roms/ipxe/src/tests/bigint_test.c b/roms/ipxe/src/tests/bigint_test.c +index 8d40c3188784a693e83a2a9d3217..dfcd393c413b1c66ab2e9988c472 100644 +--- a/roms/ipxe/src/tests/bigint_test.c ++++ b/roms/ipxe/src/tests/bigint_test.c +@@ -210,7 +210,7 @@ void bigint_mod_exp_sample ( const bigint_element_t *base0, + static const uint8_t addend_raw[] = addend; \ + static const uint8_t value_raw[] = value; \ + static const uint8_t expected_raw[] = expected; \ +- uint8_t result_raw[ sizeof ( expected_raw ) ]; \ ++ uint8_t result_raw[ sizeof ( expected_raw ) ] = {0}; \ + unsigned int size = \ + bigint_required_size ( sizeof ( value_raw ) ); \ + bigint_t ( size ) addend_temp; \ diff --git a/qemu.changes b/qemu.changes index 4658fc92..2eda2746 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Aug 18 20:28:18 UTC 2020 - Bruce Rogers + +- Fix compilation errors seen with pre-release gcc 11 + atomic.h-change-method-for-removing-C-qu.patch + help-compiler-out-by-initializing-array.patch + s390x-Fix-stringop-truncation-issue-repo.patch + ------------------------------------------------------------------- Tue Aug 18 15:29:41 UTC 2020 - Dominique Leuenberger diff --git a/qemu.spec b/qemu.spec index 6dadc337..b8825b71 100644 --- a/qemu.spec +++ b/qemu.spec @@ -176,6 +176,8 @@ Patch00039: test-add-mapping-from-arch-of-i686-to-qe.patch Patch00040: roms-Makefile-enable-cross-compile-for-b.patch Patch00041: configure-remove-pkgversion-from-CONFIG_.patch Patch00042: docs-add-SUSE-support-statements-to-html.patch +Patch00043: s390x-Fix-stringop-truncation-issue-repo.patch +Patch00044: atomic.h-change-method-for-removing-C-qu.patch # Patches applied in roms/seabios/: Patch01000: seabios-use-python2-explicitly-as-needed.patch Patch01001: seabios-switch-to-python3-as-needed.patch @@ -189,6 +191,7 @@ Patch02004: golan-Add-explicit-type-casts-for-nodnic.patch Patch02005: stub-out-the-SAN-req-s-in-int13.patch Patch02006: ipxe-Makefile-fix-issues-of-build-reprod.patch Patch02007: Do-not-apply-WORKAROUND_CFLAGS-for-host-.patch +Patch02008: help-compiler-out-by-initializing-array.patch # Patches applied in roms/sgabios/: Patch03000: sgabios-Makefile-fix-issues-of-build-rep.patch Patch03001: roms-sgabios-Fix-csum8-to-be-built-by-ho.patch @@ -989,6 +992,8 @@ This package provides a service file for starting and stopping KSM. %if %{legacy_qemu_kvm} && 0%{?is_opensuse} == 0 %patch00042 -p1 %endif +%patch00043 -p1 +%patch00044 -p1 %patch01000 -p1 %patch01001 -p1 %patch01002 -p1 @@ -1006,6 +1011,7 @@ This package provides a service file for starting and stopping KSM. %ifarch aarch64 %patch02007 -p1 %endif +%patch02008 -p1 %patch03000 -p1 %patch03001 -p1 %patch08000 -p1 diff --git a/qemu.spec.in b/qemu.spec.in index b3a3289e..56832369 100644 --- a/qemu.spec.in +++ b/qemu.spec.in @@ -1535,7 +1535,7 @@ install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-ga@.service install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service %endif %ifarch s390x -install -D -m 0644 %{SOURCE2} %{buildroot}%_libexecdir/modules-load.d/kvm.conf +install -D -m 0644 %{SOURCE2} %{buildroot}%{_prefix}/lib/modules-load.d/kvm.conf %endif %fdupes -s %{buildroot} @@ -1780,7 +1780,7 @@ fi %dir %_sysconfdir/%name/firmware %if %{kvm_available} %ifarch s390x -%_libexecdir/modules-load.d/kvm.conf +%{_prefix}/lib/modules-load.d/kvm.conf %endif /usr/lib/udev/rules.d/80-kvm.rules %endif diff --git a/s390x-Fix-stringop-truncation-issue-repo.patch b/s390x-Fix-stringop-truncation-issue-repo.patch new file mode 100644 index 00000000..ab9d979e --- /dev/null +++ b/s390x-Fix-stringop-truncation-issue-repo.patch @@ -0,0 +1,22 @@ +From: Bruce Rogers +Date: Thu, 13 Aug 2020 14:03:29 -0600 +Subject: s390x: Fix stringop-truncation issue reported by gcc 11 + +Signed-off-by: Bruce Rogers +--- + target/s390x/misc_helper.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c +index 58dbc023eb5495ec5da0321651ad..d8e18c0d4617c333fcd4cc1c5c8c 100644 +--- a/target/s390x/misc_helper.c ++++ b/target/s390x/misc_helper.c +@@ -370,7 +370,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1) + MIN(sizeof(sysib.sysib_322.vm[0].name), + strlen(qemu_name))); + strncpy((char *)sysib.sysib_322.ext_names[0], qemu_name, +- sizeof(sysib.sysib_322.ext_names[0])); ++ sizeof(sysib.sysib_322.ext_names[0] - 1)); + } else { + ebcdic_put(sysib.sysib_322.vm[0].name, "TCGguest", 8); + strcpy((char *)sysib.sysib_322.ext_names[0], "TCGguest"); diff --git a/update_git.sh b/update_git.sh index 00493195..daa99f50 100644 --- a/update_git.sh +++ b/update_git.sh @@ -706,10 +706,14 @@ if [ "$GIT_UPSTREAM_COMMIT_ISH" = "LATEST" ]; then fi else SOURCE_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$X - if [ "$NEXT_RELEASE_IS_MAJOR" = "0" ]; then - GIT_BRANCH=opensuse-$MAJOR_VERSION.$[$MINOR_VERSION+1] + if [ "$X" = "0" ]; then + GIT_BRANCH=opensuse-$MAJOR_VERSION.$[$MINOR_VERSION] else - GIT_BRANCH=opensuse-$[MAJOR_VERSION+1].0 + if [ "$NEXT_RELEASE_IS_MAJOR" = "0" ]; then + GIT_BRANCH=opensuse-$MAJOR_VERSION.$[$MINOR_VERSION+1] + else + GIT_BRANCH=opensuse-$[MAJOR_VERSION+1].0 + fi fi fi WRITE_LOG=0