On Mon, May 03, 2021 at 12:01:41PM +0200, Tim Wiederhake wrote: > When enabling sanitizers, gcc adds some instrumentation to the code > that may enlarge stack frames. Some function's stack frames are already > close to the limit of 4096 and are enlarged past that threshold, > e.g. virLXCProcessStart which reaches a frame size of 4624 bytes. > > Signed-off-by: Tim Wiederhake <[email protected]> > --- > meson.build | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/meson.build b/meson.build > index 618cbd6b1d..bbdbe4afd8 100644 > --- a/meson.build > +++ b/meson.build > @@ -278,7 +278,8 @@ cc_flags += [ > '-Wformat-y2k', > '-Wformat-zero-length', > '-Wframe-address', > - '-Wframe-larger-than=4096', > + # sanitizer instrumentation may enlarge stack frames > + '-Wframe-larger-than=@0@'.format(get_option('b_sanitize') in ['', 'none'] > ? 4096 : 8192), > '-Wfree-nonheap-object', > '-Whsa', > '-Wif-not-aligned',
Looks good but needs some polishing. I would do something similar to
what we do with -Walloc-size-larger-than:
# sanitizer instrumentation may enlarge stack frames
stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 8192
cc_flags += [
...
'-Wframe-larger-than=@0@'.format(stack_frame_size),
...
]
In addition there is no need to check for empty string as meson will
handle that while parsing the command argument. All of the following
commands:
meson build -Db_sanitize=
meson build -Db_sanitize=""
meson build -Db_sanitize=" "
meson build -Db_sanitize="asdf"
result in this error (the value in the error message reflects the one
actually used):
meson.build:1:0: ERROR: Value "" (of type "string") for combo option "Code
sanitizer to use" is not one of the choices. Possible choices are (as string):
"none", "address", "thread", "undefined", "memory", "address,undefined".
Pavel
signature.asc
Description: PGP signature
