shithub: dav1d

Download patch

ref: d398da88c0b68e3dbb966256c7ed682b211579e3
parent: 7675eb16b9b2d8c2fc46879f3d28bd095fd03065
author: Janne Grunau <janne-vlc@jannau.net>
date: Sun Feb 16 19:38:54 EST 2020

fuzzing: link the fuzzing binaries as C++

Requires meson 0.51 for oss-fuzz and 0.49 for the fuzzing binaries in
general due to the use of the 'kwargs' keyword argument.

--- a/tests/libfuzzer/meson.build
+++ b/tests/libfuzzer/meson.build
@@ -28,6 +28,7 @@
 
 dav1d_fuzzer_sources =  files('dav1d_fuzzer.c')
 fuzzer_ldflags = []
+fuzzer_link_lang = {}
 
 if get_option('fuzzer_ldflags') != ''
     fuzzer_ldflags += [get_option('fuzzer_ldflags')]
@@ -38,8 +39,9 @@
 elif fuzzing_engine == 'libfuzzer'
     fuzzer_ldflags += ['-fsanitize=fuzzer']
 elif fuzzing_engine == 'oss-fuzz'
-    # libFuzzingEngine needs libc++
-    fuzzer_ldflags += ['-lc++']
+    # libFuzzingEngine needs c++
+    add_languages('cpp')
+    fuzzer_link_lang = {'link_language': 'cpp'}
 endif
 
 dav1d_fuzzer = executable('dav1d_fuzzer',
@@ -50,6 +52,7 @@
     link_with : libdav1d,
     build_by_default: true,
     dependencies : [thread_dependency],
+    kwargs: fuzzer_link_lang
     )
 
 dav1d_fuzzer_mt = executable('dav1d_fuzzer_mt',
@@ -60,6 +63,7 @@
     link_with : libdav1d,
     build_by_default: true,
     dependencies : [thread_dependency],
+    kwargs: fuzzer_link_lang
     )
 
 objcopy = find_program('objcopy',
@@ -89,5 +93,6 @@
         link_depends: libdav1d_af,
         build_by_default: false,
         dependencies : [thread_dependency],
+        kwargs: fuzzer_link_lang
         )
 endif
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -102,7 +102,9 @@
 endif
 
 # fuzzing binaries
-subdir('libfuzzer')
+if meson.version().version_compare('>=0.49')
+    subdir('libfuzzer')
+endif
 
 # Include dav1d test data repository with additional tests
 if get_option('testdata_tests')