On 28/08/20 20:33, Alexander Bulekov wrote: >> Create a fuzz.cmd that includes the correct path to fuzz.ld in the >> source tree (using configure_file) and pass this file to the linker >> using @tests/libqtest/fuzz/fuzz.cmd in link_args (and also >> link_depends). See libblock and block for an example. > I'm not sure whether this solves the problem that the linker-script is > placed in between --start-group and --end-group arguments. It seems > that no matter what I do to specify the linker script with -Wl,-T, and > link_args, the flag ends up placed between --start-group and --end-group > due to some parsing that meson does in > mesonbuild/compilers/mixins/clike.py.
Looks like you need to ensure that the link_args for -T and -wrap come before everything else. For example: -Wl,--whole-archive qom/libqom.fa io/libio.fa crypto/libcrypto.fa authz/libauthz.fa hw/core/libhwcore.fa libblock.fa libqmp.fa chardev/libchardev.fa -Wl,--no-whole-archive -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -m64 -fstack-protector-strong migration/libmigration.fa -Wl,--start-group libqemuutil.a qom/libqom.fa io/libio.fa crypto/libcrypto.fa authz/libauthz.fa hw/core/libhwcore.fa libblock.fa libqmp.fa chardev/libchardev.fa @block.syms @qemu.syms libqemuutil.a is what triggers --start-group. So if you can add them using add_project_link_arguments it should work. Paolo