[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] meson: specify fuzz linker script as a project arg
From: |
Alexander Bulekov |
Subject: |
[PATCH 1/3] meson: specify fuzz linker script as a project arg |
Date: |
Wed, 2 Sep 2020 10:37:58 -0400 |
With this change, the fuzzer-linker script should be specified outside
any --start-group/--end-group pairs. We need this on oss-fuzz, where
partially applying the linker-script results in a linker failure
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
---
meson.build | 9 ++++++++-
tests/qtest/fuzz/meson.build | 1 -
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 74f8ea0c2e..a0407ce050 100644
--- a/meson.build
+++ b/meson.build
@@ -31,6 +31,14 @@ endforeach
have_tools = 'CONFIG_TOOLS' in config_host
have_block = have_system or have_tools
+# 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
+ config_host += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS'] +
+ ' -Wl,-T,' + (meson.current_source_dir() /
'tests/qtest/fuzz/fork_fuzz.ld')}
+endif
+
+
add_project_arguments(config_host['QEMU_CFLAGS'].split(),
native: false, language: ['c', 'objc'])
add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
@@ -1019,7 +1027,6 @@ foreach target : target_dirs
'gui': false,
'sources': specific_fuzz.sources(),
'dependencies': specific_fuzz.dependencies(),
- 'link_depends': [files('tests/qtest/fuzz/fork_fuzz.ld')],
}]
endif
else
diff --git a/tests/qtest/fuzz/meson.build b/tests/qtest/fuzz/meson.build
index bb0a3f271d..3432c3e7c3 100644
--- a/tests/qtest/fuzz/meson.build
+++ b/tests/qtest/fuzz/meson.build
@@ -10,7 +10,6 @@ specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_SCSI', if_true:
files('virtio_scsi_fuz
# this will be duplicated in meson.build
fork_fuzz = declare_dependency(
link_args: ['-fsanitize=fuzzer',
- '-Wl,-T,' + (meson.current_source_dir() / 'fork_fuzz.ld'),
'-Wl,-wrap,qtest_inb',
'-Wl,-wrap,qtest_inw',
'-Wl,-wrap,qtest_inl',
--
2.28.0