summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlexander Bulekov <alxndr@bu.edu>2020-09-09 18:05:16 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-30 19:11:36 +0200
commitff9ed62b90c3cc337c9e6317d65cc9a9c84f07ce (patch)
tree1c53ea7758d177abeebe6b21d2f31609833a9bea
parent6e01884c3694807fd39fe0aab9e5f7d5e6c06969 (diff)
downloadfocaccia-qemu-ff9ed62b90c3cc337c9e6317d65cc9a9c84f07ce.tar.gz
focaccia-qemu-ff9ed62b90c3cc337c9e6317d65cc9a9c84f07ce.zip
oss-fuzz: move linker arg to fix coverage-build
The order of the add_project_link_arguments calls impacts which
arguments are placed between --start-group and --end-group.
OSS-Fuzz coverage builds seem to just add these to CFLAGS:
-fprofile-instr-generate -fcoverage-mapping pthread -Wl,--no-as-needed
-Wl,-ldl -Wl,-lm Wno-unused-command-line-argument

The -Wl,-ldl flag that is enough to shift the fork_fuzz.ld linker-script
back into the linker group. Move the linker-script meson call before the
other calls to make sure the flag is placed correctly.

Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20200909220516.614222-1-alxndr@bu.edu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--meson.build15
1 files changed, 8 insertions, 7 deletions
diff --git a/meson.build b/meson.build
index b3133cf39d..3161c1f037 100644
--- a/meson.build
+++ b/meson.build
@@ -54,6 +54,14 @@ configure_file(input: files('scripts/ninjatool.py'),
 # Compiler flags #
 ##################
 
+# Specify linker-script with add_project_link_arguments so that it is not placed
+# within a linker --start-group/--end-group pair
+if 'CONFIG_FUZZ' in config_host
+   add_project_link_arguments(['-Wl,-T,',
+                               (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
+                              native: false, language: ['c', 'cpp', 'objc'])
+endif
+
 add_project_arguments(config_host['QEMU_CFLAGS'].split(),
                       native: false, language: ['c', 'objc'])
 add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
@@ -63,13 +71,6 @@ add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
 add_project_arguments(config_host['QEMU_INCLUDES'].split(),
                       language: ['c', 'cpp', 'objc'])
 
-# Specify linker-script with add_project_link_arguments so that it is not placed
-# within a linker --start-group/--end-group pair
-if 'CONFIG_FUZZ' in config_host
-   add_project_link_arguments(['-Wl,-T,',
-                               (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
-                              native: false, language: ['c', 'cpp', 'objc'])
-endif
 
 link_language = meson.get_external_property('link_language', 'cpp')
 if link_language == 'cpp'