As far as I understand, the goal is to have only one file for afl_driver and make it self contained, even if we are repeating code from libFuzzer.
Taking that into account, I include the following modifications using macros inside afl_driver, to support different platforms.
As this code is the same than for libFuzzer, I would strongly prefer to develop a common static library: "FuzzerSupport", including all the IO and Utils functionalities. Then we could link against that library for libFuzzer and for the afl_driver.
I would like to know your opinion on this.
It would be very simple to add a cmake dependency: "target_link(AFLDriver FuzzerSupport)"
Also, I would like to update the code to remove the flags: LIBFUZZER_POSIX, LIBFUZZER_WINDOWS, etc. and move that logic to the cmake files.
Thanks