From 69dec1de33272bb94b7a81fe39b9c152aba3560f Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 4 Sep 2019 22:48:03 +0200 Subject: [PATCH] add new meson build option -Dfuzzer-link-language=cpp for oss-fuzz --- meson.build | 6 +++++- meson_options.txt | 1 + src/fe-fuzz/fe-common/core/meson.build | 1 + src/fe-fuzz/irc/core/meson.build | 1 + src/fe-fuzz/meson.build | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 63f6c125..d19e5735 100644 --- a/meson.build +++ b/meson.build @@ -24,6 +24,7 @@ want_textui = get_option('without-textui') != 'yes' want_bot = get_option('with-bot') == 'yes' want_fuzzer = get_option('with-fuzzer') == 'yes' fuzzer_lib = get_option('with-fuzzer-lib') +fuzzer_link_language = get_option('fuzzer-link-language') want_proxy = get_option('with-proxy') == 'yes' want_truecolor = get_option('enable-true-color') == 'yes' want_gregex = get_option('disable-gregex') != 'yes' @@ -459,7 +460,10 @@ if want_fuzzer error('compiler does not support -fsanitize=fuzzer-no-link, try clang?') endif add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c') - add_project_link_arguments('-fsanitize=fuzzer-no-link', language : 'c') + if (fuzzer_link_language != 'c') + add_languages(fuzzer_link_language) + endif + add_project_link_arguments('-fsanitize=fuzzer-no-link', language : fuzzer_link_language) endif ############## diff --git a/meson_options.txt b/meson_options.txt index 141e3fba..c975db3a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,6 +2,7 @@ option('without-textui', type : 'combo', description : 'Build without text f option('with-bot', type : 'combo', description : 'Build irssi-bot', choices : ['no', 'yes']) option('with-fuzzer', type : 'combo', description : 'Build irssi-fuzzer', choices : ['no', 'yes']) option('with-fuzzer-lib', type : 'string', description : 'Specify path to fuzzer library', value : '-fsanitize=fuzzer') +option('fuzzer-link-language', type : 'string', description : 'The linker to use for the fuzz targets [c, cpp]', value : 'c') option('with-proxy', type : 'combo', description : 'Build irssi-proxy', choices : ['no', 'yes']) option('with-perl-lib', type : 'string', description : 'Specify where to install the Perl libraries for Irssi') option('with-perl', type : 'combo', description : 'Build with Perl support', choices : ['auto', 'yes', 'no']) diff --git a/src/fe-fuzz/fe-common/core/meson.build b/src/fe-fuzz/fe-common/core/meson.build index 679c19ce..8e321e8b 100644 --- a/src/fe-fuzz/fe-common/core/meson.build +++ b/src/fe-fuzz/fe-common/core/meson.build @@ -10,6 +10,7 @@ executable('theme-load-fuzz', libfuzzer_fe_common_core_a, ], link_args : [fuzzer_lib], + link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true, diff --git a/src/fe-fuzz/irc/core/meson.build b/src/fe-fuzz/irc/core/meson.build index 23d1271f..1656523c 100644 --- a/src/fe-fuzz/irc/core/meson.build +++ b/src/fe-fuzz/irc/core/meson.build @@ -12,6 +12,7 @@ executable('event-get-params-fuzz', libfuzzer_fe_common_core_a, ], link_args : [fuzzer_lib], + link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true, diff --git a/src/fe-fuzz/meson.build b/src/fe-fuzz/meson.build index 5dccd38d..1f6427db 100644 --- a/src/fe-fuzz/meson.build +++ b/src/fe-fuzz/meson.build @@ -14,6 +14,7 @@ executable('irssi-fuzz', libfuzzer_fe_common_core_a, ], link_args : [fuzzer_lib], + link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true, @@ -35,6 +36,7 @@ executable('server-fuzz', libfe_irc_notifylist_a, ], link_args : [fuzzer_lib], + link_language : fuzzer_link_language, include_directories : rootinc, implicit_include_directories : false, install : true,