Skip to contentSkip to conversation

Bump min compiler versions again

PATCH In review Daniel P. Berrangé 3 participants 7 messages Sep 15 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v2 cover Bump min compiler versions again

With the security policy we want to rely on usage of the -ftrivial-auto-var-init=zero flag to declare bugs "not a CVE" if they rely on uninitialized stack variables.

This arg is only supported by CLang 17 or GCC 12 though, both of which are beyond our current min versions.

This series bumps both CLang and GCC to enable this.

The GCC bump is technically something we shouldn't do per our platform support matrix, as the system compiler in our targetted releases of NetBSD, remains GCC 10.4

This series considers it reasonable to bend the rules slightly, as NetBSD does have new enough CLang, and also ships newer GCC as non-system compilers.

Also historically the macOS XCode versions reported by clang did not appear to align with upstream CLang versions so we checked versions separately for macOS.

With this set of patches we happen to end up on 17.0 for both upstream CLang and macOS Clang, and this makes me wonder if we can rely on aligned versions going forward ?

Latest XCode 26.6 apparently reports clang 21.0.0 which appears to be a match for a modern llvm release.

Daniel P. Berrangé (5):
tests/vm: drop redundant ';' at end of each shell command
meson: simplify clang version checks
meson: bump min XCode CLang to 17.0
meson: bump min upstream CLang to 17.0
meson: bump min GCC to 12.0

 meson.build     | 12 ++++++------
 tests/vm/netbsd | 17 +++++++++++------
 2 files changed, 17 insertions(+), 12 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH v2 1/5 tests/vm: drop redundant '; ' at end of each shell command

The newline implicitly separates every command, and the one case where two comamnds were on the same line can trivially be split.

---
 tests/vm/netbsd | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
tests/vm/netbsd +7 -6
index 45afe675e1..a9879f6146 100755
@@ -64,15 +64,16 @@ class NetBSDVM(basevm.BaseVM):
     ]
 
     BUILD_SCRIPT = """
-        set -e;
+        set -e
         rm -rf /home/qemu/qemu-test.*
-        cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
-        mkdir src build; cd src;
-        tar -xf /dev/rld1a;
+        cd $(mktemp -d /home/qemu/qemu-test.XXXXXX)
+        mkdir src build
+        cd src
+        tar -xf /dev/rld1a
         cd ../build
         ../src/configure --disable-opengl --extra-ldflags=-L/usr/pkg/lib \
-                          --extra-cflags=-I/usr/pkg/include {configure_opts};
-        gmake --output-sync -j{jobs} {target} {verbose};
+                         --extra-cflags=-I/usr/pkg/include {configure_opts}
+        gmake --output-sync -j{jobs} {target} {verbose}
     """
     poweroff = "/sbin/poweroff"
 
Signature · 1 line
2.55.0
#2 lore raw

PATCH v2 2/5 meson: simplify clang version checks

In reply to Daniel P. Berrangé

The checks for the clang minor versions are currently redundant since there can never be a minor version less than zero. Going forward it is likely sufficient to always pick a NN.0.0 release as the min CLang version, so drop the minor version checks.

---
 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meson.build +2 -2
index cfac634cf1..cb3eaf3abe 100644
@@ -330,11 +330,11 @@ foreach lang : all_languages
     # ok
   elif compiler.get_id() == 'clang' and compiler.compiles('''
       #ifdef __apple_build_version__
-      # if __clang_major__ < 15 || (__clang_major__ == 15 && __clang_minor__ < 0)
+      # if __clang_major__ < 15
       #  error You need at least XCode Clang v15.0 to compile QEMU
       # endif
       #else
-      # if __clang_major__ < 10 || (__clang_major__ == 10 && __clang_minor__ < 0)
+      # if __clang_major__ < 10
       #  error You need at least Clang v10.0 to compile QEMU
       # endif
       #endif''')
Signature · 1 line
2.55.0
#3 lore raw

PATCH v2 3/5 meson: bump min XCode CLang to 17.0

In reply to Daniel P. Berrangé

The current two latest macOS releases (Tahoe and Sequoia) support XCode 17.x, XCode 26.x and XCode 27.x is in Beta.

XCode 17.x reported CLang 17.0.0, and this continued with XCode 26.0 stream until XCode 26.4 switched to reporting CLang 21.0.0.

A min XCode CLang of 17.0.0 looks appropriate and matches our current CI job matrix.

---
 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meson.build +3 -3
index cb3eaf3abe..ff181e7021 100644
@@ -330,8 +330,8 @@ foreach lang : all_languages
     # ok
   elif compiler.get_id() == 'clang' and compiler.compiles('''
       #ifdef __apple_build_version__
-      # if __clang_major__ < 15
-      #  error You need at least XCode Clang v15.0 to compile QEMU
+      # if __clang_major__ < 17
+      #  error You need at least XCode Clang v17.0 to compile QEMU
       # endif
       #else
       # if __clang_major__ < 10
@@ -342,7 +342,7 @@ foreach lang : all_languages
   elif compiler.get_id() == 'emscripten'
     # ok
   else
-    error('You either need GCC v10.4 or Clang v10.0 (or XCode Clang v15.0) to compile QEMU')
+    error('You either need GCC v10.4 or Clang v10.0 (or XCode Clang v17.0) to compile QEMU')
   endif
 endforeach
 
Signature · 1 line
2.55.0
#4 lore raw

PATCH v2 4/5 meson: bump min upstream CLang to 17.0

In reply to Daniel P. Berrangé

Per our supported platform policy, oldest distros we target have the following CLang available:

          Fedora 43: 21.1.2
    CentOS Stream 9: 22.1.8
          Debian 13: 17.0.6
       Ubuntu 24.04: 20.1.2
            OpenBSD: 22.1.8
            FreeBSD: 23.1.0
             NetBSD: 21.1.8

OpenSUSE Leap 16.0: 19.1.7

Thus Debian is our prime constraint and we can move from 10.0 to 17.0 as our min version.

---
 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meson.build +3 -3
index ff181e7021..fc1bb685ab 100644
@@ -334,15 +334,15 @@ foreach lang : all_languages
       #  error You need at least XCode Clang v17.0 to compile QEMU
       # endif
       #else
-      # if __clang_major__ < 10
-      #  error You need at least Clang v10.0 to compile QEMU
+      # if __clang_major__ < 17
+      #  error You need at least Clang v17.0 to compile QEMU
       # endif
       #endif''')
     # ok
   elif compiler.get_id() == 'emscripten'
     # ok
   else
-    error('You either need GCC v10.4 or Clang v10.0 (or XCode Clang v17.0) to compile QEMU')
+    error('You either need GCC v10.4 or Clang v17.0 (or XCode Clang v17.0) to compile QEMU')
   endif
 endforeach
 
Signature · 1 line
2.55.0
#5 lore raw

PATCH v2 5/5 meson: bump min GCC to 12.0

In reply to Daniel P. Berrangé

This is a slight violation of our platform support policy since current NetBSD only has GCC 10.4 as its system compiler. It does, however, have new enough CLang and newer GCC versions can be opted-in.

---
 meson.build     | 4 ++--
 tests/vm/netbsd | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
meson.build +2 -2
index fc1bb685ab..9845317b73 100644
@@ -326,7 +326,7 @@ endif
 
 foreach lang : all_languages
   compiler = meson.get_compiler(lang)
-  if compiler.get_id() == 'gcc' and compiler.version().version_compare('>=10.4')
+  if compiler.get_id() == 'gcc' and compiler.version().version_compare('>=12.0')
     # ok
   elif compiler.get_id() == 'clang' and compiler.compiles('''
       #ifdef __apple_build_version__
@@ -342,7 +342,7 @@ foreach lang : all_languages
   elif compiler.get_id() == 'emscripten'
     # ok
   else
-    error('You either need GCC v10.4 or Clang v17.0 (or XCode Clang v17.0) to compile QEMU')
+    error('You either need GCC v12.0 or Clang v17.0 (or XCode Clang v17.0) to compile QEMU')
   endif
 endforeach
 
tests/vm/netbsd +5 -1
index a9879f6146..749116d3dc 100755
@@ -61,6 +61,9 @@ class NetBSDVM(basevm.BaseVM):
 
         # libs: networking
         "libslirp",
+
+        # Until system GCC is updated to >= 12.0
+        "clang",
     ]
 
     BUILD_SCRIPT = """
@@ -72,7 +75,8 @@ class NetBSDVM(basevm.BaseVM):
         tar -xf /dev/rld1a
         cd ../build
         ../src/configure --disable-opengl --extra-ldflags=-L/usr/pkg/lib \
-                         --extra-cflags=-I/usr/pkg/include {configure_opts}
+                         --extra-cflags=-I/usr/pkg/include {configure_opts} \
+                         --cc=clang
         gmake --output-sync -j{jobs} {target} {verbose}
     """
     poweroff = "/sbin/poweroff"
Signature · 1 line
2.55.0