]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: Work around clang's stack size calculation without optimization
authorPeter Krempa <pkrempa@redhat.com>
Mon, 4 Sep 2023 10:10:25 +0000 (12:10 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 4 Sep 2023 11:32:28 +0000 (13:32 +0200)
When building without optimization on clang, certain big functions trip
the stack size limit despite not actually reaching it. Relax the stack
limit size for clang without optimization.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
meson.build

index 6b6f7ccb7c670e020542f8f69b121d8dfdad96f2..d29761bc719d108c7d40d4b6c483e248837d4fa2 100644 (file)
@@ -247,8 +247,17 @@ alloc_max = run_command(
   check: true,
 )
 
+stack_frame_size = 2048
+
+# clang without optimization enlarges stack frames in certain corner cases
+if cc.get_id() == 'clang' and get_option('optimization') == '0'
+    stack_frame_size = 4096
+endif
+
 # sanitizer instrumentation may enlarge stack frames
-stack_frame_size = get_option('b_sanitize') == 'none' ? 2048 : 32768
+if get_option('b_sanitize') == 'none'
+  stack_frame_size == 32768
+endif
 
 # array_bounds=2 check triggers false positive on some GCC
 # versions when using sanitizers. Seen on Fedora 34 with