build: fix check for -fsanitize-coverage-allowlist
PATCH 1/1 build: fix check for -fsanitize-coverage-allowlist
The existing check has two problems:
1. Meson uses a private directory for the get_supported_arguments check. ./instrumentation-filter does not exist in that private directory (it is copied into the root of the build-directory).
2. fsanitize-coverage-allowlist is unused when coverage instrumentation is not configured. No instrumentation are passed for the get_supported_arguments check
Thus the check always fails. To work around this, change the check to an "if cc.compiles" check and provide /dev/null, instead of the real filter.
Meson log:
Working directory: build/meson-private/tmpl6wld2d9 Command line: clang-13 -m64 -mcx16
build/meson-private/tmpl6wld2d9/output.obj -c -O3 -D_FILE_OFFSET_BITS=64 -O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -fsanitize-coverage-allowlist=instrumentation-filter
Error:
error: argument unused during compilation:
'-fsanitize-coverage-allowlist=instrumentation-filter'
--- meson.build | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
meson.build +7 -3
@@ -209,9 +209,13 @@ if get_option('fuzzing') configure_file(output: 'instrumentation-filter', input: 'scripts/oss-fuzz/instrumentation-filter-template', copy: true) - add_global_arguments( - cc.get_supported_arguments('-fsanitize-coverage-allowlist=instrumentation-filter'), - native: false, language: ['c', 'cpp', 'objc']) + + if cc.compiles('int main () { return 0; }', + name: '-fsanitize-coverage-allowlist=/dev/null', + args: ['-fsanitize-coverage-allowlist=/dev/null'] ) + add_global_arguments('-fsanitize-coverage-allowlist=instrumentation-filter', + native: false, language: ['c', 'cpp', 'objc']) + endif if get_option('fuzzing_engine') == '' # Add CFLAGS to tell clang to add fuzzer-related instrumentation to all the
Signature · 1 line
2.27.0
Paolo Bonzini
AppliedQuoted 42 lines · Alexander Bulekov
The existing check has two problems:
1. Meson uses a private directory for theget_supported_argumentscheck. ./instrumentation-filter does not exist in that private directory (it is copied into the root of the build-directory).2. fsanitize-coverage-allowlist is unused when coverage instrumentation is not configured. No instrumentation are passed for the
get_supported_argumentscheckThus the check always fails. To work around this, change the check to an "if cc.compiles" check and provide
/dev/null, instead of the real filter.Meson log:
Working directory: build/meson-private/tmpl6wld2d9 Command line: clang-13 -m64 -mcx16build/meson-private/tmpl6wld2d9/output.obj -c -O3 -D_FILE_OFFSET_BITS=64
(quoted diff) +0
-4-O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -fsanitize-coverage-allowlist=instrumentation-filterError:
error: argument unused during compilation:
'-fsanitize-coverage-allowlist=instrumentation-filter'Signed-off-by Alexander Bulekov <[email protected]>--- meson.build | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)meson.build +0
-3@@ -209,9 +209,13 @@ if get_option('fuzzing') configure_file(output: 'instrumentation-filter', input: 'scripts/oss-fuzz/instrumentation-filter-template', copy: true) - add_global_arguments( - cc.get_supported_arguments('-fsanitize-coverage-allowlist=instrumentation-filter'), - native: false, language: ['c', 'cpp', 'objc'])
meson.build if get_option('fuzzing') · line 221
Quoted 10 lines
meson.build +7
-0+ + if cc.compiles('int main () { return 0; }', + name: '-fsanitize-coverage-allowlist=/dev/null', + args: ['-fsanitize-coverage-allowlist=/dev/null'] ) + add_global_arguments('-fsanitize-coverage-allowlist=instrumentation-filter', + native: false, language: ['c', 'cpp', 'objc']) + endif if get_option('fuzzing_engine') == '' # Add CFLAGS to tell clang to add fuzzer-related instrumentation to all the
Queued, thanks.
Paolo