From 05e75a20ba329145ea4aa4ac0fb5d6317c0af8fe Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 5 Jan 2025 13:11:32 +0100 Subject: [PATCH] Fix some compilation issues --- src/fuzzer/main.cpp | 6 +++--- src/fuzzing-engine/fuzzer.cpp | 6 +++--- src/fuzzing-engine/fuzzer.hpp | 6 +++--- src/fuzzing-engine/random_generator.cpp | 1 + src/unicorn-emulator/unicorn_x64_emulator.hpp | 8 ++++++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/fuzzer/main.cpp b/src/fuzzer/main.cpp index e936dda4..f075001f 100644 --- a/src/fuzzer/main.cpp +++ b/src/fuzzer/main.cpp @@ -109,12 +109,12 @@ namespace } }; - struct my_fuzzer_handler : fuzzer::handler + struct my_fuzzing_handler : fuzzer::fuzzing_handler { std::vector emulator_state{}; std::atomic_bool stop_fuzzing{false}; - my_fuzzer_handler(std::vector emulator_state) + my_fuzzing_handler(std::vector emulator_state) : emulator_state(std::move(emulator_state)) { } @@ -137,7 +137,7 @@ namespace utils::buffer_serializer serializer{}; base_emulator.serialize(serializer); - my_fuzzer_handler handler{serializer.move_buffer()}; + my_fuzzing_handler handler{serializer.move_buffer()}; fuzzer::run(handler, concurrency); } diff --git a/src/fuzzing-engine/fuzzer.cpp b/src/fuzzing-engine/fuzzer.cpp index 78ab64f4..e08e39d5 100644 --- a/src/fuzzing-engine/fuzzer.cpp +++ b/src/fuzzing-engine/fuzzer.cpp @@ -8,7 +8,7 @@ namespace fuzzer class fuzzing_context { public: - fuzzing_context(input_generator& generator, handler& handler) + fuzzing_context(input_generator& generator, fuzzing_handler& handler) : generator(generator) , handler(handler) { @@ -36,7 +36,7 @@ namespace fuzzer } input_generator& generator; - handler& handler; + fuzzing_handler& handler; std::atomic_uint64_t executions{0}; private: @@ -110,7 +110,7 @@ namespace fuzzer }; } - void run(handler& handler, const size_t concurrency) + void run(fuzzing_handler& handler, const size_t concurrency) { input_generator generator{}; fuzzing_context context{generator, handler}; diff --git a/src/fuzzing-engine/fuzzer.hpp b/src/fuzzing-engine/fuzzer.hpp index bebfb4f8..b62240c8 100644 --- a/src/fuzzing-engine/fuzzer.hpp +++ b/src/fuzzing-engine/fuzzer.hpp @@ -23,9 +23,9 @@ namespace fuzzer const std::function& coverage_handler) = 0; }; - struct handler + struct fuzzing_handler { - virtual ~handler() = default; + virtual ~fuzzing_handler() = default; virtual std::unique_ptr make_executer() = 0; @@ -35,5 +35,5 @@ namespace fuzzer } }; - void run(handler& handler, size_t concurrency = std::thread::hardware_concurrency()); + void run(fuzzing_handler& handler, size_t concurrency = std::thread::hardware_concurrency()); } diff --git a/src/fuzzing-engine/random_generator.cpp b/src/fuzzing-engine/random_generator.cpp index 985f052e..9985840b 100644 --- a/src/fuzzing-engine/random_generator.cpp +++ b/src/fuzzing-engine/random_generator.cpp @@ -1,4 +1,5 @@ #include "random_generator.hpp" +#include namespace fuzzer { diff --git a/src/unicorn-emulator/unicorn_x64_emulator.hpp b/src/unicorn-emulator/unicorn_x64_emulator.hpp index ca57015b..4d26b48a 100644 --- a/src/unicorn-emulator/unicorn_x64_emulator.hpp +++ b/src/unicorn-emulator/unicorn_x64_emulator.hpp @@ -4,11 +4,19 @@ #include #include "platform/platform.hpp" +#ifdef WIN32 #ifdef UNICORN_EMULATOR_IMPL #define UNICORN_EMULATOR_DLL_STORAGE EXPORT_SYMBOL #else #define UNICORN_EMULATOR_DLL_STORAGE IMPORT_SYMBOL #endif +#else +#ifdef UNICORN_EMULATOR_IMPL +#define UNICORN_EMULATOR_DLL_STORAGE __attribute__((visibility("default"))) +#else +#define UNICORN_EMULATOR_DLL_STORAGE +#endif +#endif namespace unicorn {