On 201008 0939, Paolo Bonzini wrote: > On 21/09/20 04:24, Alexander Bulekov wrote: > > This patch declares the fuzz_dma_read_cb function and uses the > > preprocessor and linker(weak symbols) to handle these cases: > > > > When we build softmmu/all with --enable-fuzzing, there should be no > > strong symbol defined for fuzz_dma_read_cb, and we link against a weak > > stub function. > > > > When we build softmmu/fuzz with --enable-fuzzing, we link against the > > strong symbol in general_fuzz.c > > > > When we build softmmu/all without --enable-fuzzing, fuzz_dma_read_cb is > > an empty, inlined function. As long as we don't call any other functions > > when building the arguments, there should be no overhead. > > Can you move the weak function somewhere in tests/qtest/fuzz instead? > Then you don't need an #ifdef because you can add it to specific_fuzz_ss. > > Paolo >
If I understand correctly, specific_fuzz_ss is only used to build qemu-fuzz targets. The goal here was to support building qemu-system with --enable-fuzzing (ie CONFIG_FUZZ=y), where specific_fuzz isn't used. If its too ugly, we could make a stub file under tests/qtest/fuzz and add it to specific_ss when: 'CONFIG_FUZZ'. -Alex