summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Swiecki <robert@swiecki.net>2019-03-01 16:17:34 +0100
committerRobert Swiecki <robert@swiecki.net>2019-03-01 16:17:34 +0100
commitf19d5b75a57839e9b0a700243e0aa43b7a333719 (patch)
treea83b4edc8157567893b8abaef25f934a4de232de
parent863f88a0a4af300cd014b4860adc8354eb0e15ed (diff)
downloadhonggfuzz-f19d5b75a57839e9b0a700243e0aa43b7a333719.tar.gz
hfuzz-cc: simplify the HFND_FUZZING_ENTRY_FUNCTION macro
-rw-r--r--hfuzz_cc/hfuzz-cc.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/hfuzz_cc/hfuzz-cc.c b/hfuzz_cc/hfuzz-cc.c
index 1e280cc7..79bf2e6b 100644
--- a/hfuzz_cc/hfuzz-cc.c
+++ b/hfuzz_cc/hfuzz-cc.c
@@ -307,13 +307,11 @@ static void commonOpts(int* j, char** args) {
/* Make it possible to use the libhfnetdriver */
args[(*j)++] = "-DHFND_FUZZING_ENTRY_FUNCTION_CXX(x,y)="
"extern \"C\" int HonggfuzzNetDriver_main(x,y);"
- "extern const char* LIBHFNETDRIVER_module_netdriver;"
- "const char** LIBHFNETDRIVER_module_main = &LIBHFNETDRIVER_module_netdriver;"
+ "extern const char* LIBHFNETDRIVER_module_netdriver __attribute__((used));"
"int HonggfuzzNetDriver_main(x,y)";
args[(*j)++] = "-DHFND_FUZZING_ENTRY_FUNCTION(x,y)="
"int HonggfuzzNetDriver_main(x,y);"
- "extern const char* LIBHFNETDRIVER_module_netdriver;"
- "const char** LIBHFNETDRIVER_module_main = &LIBHFNETDRIVER_module_netdriver;"
+ "extern const char* LIBHFNETDRIVER_module_netdriver __attribute__((used));"
"int HonggfuzzNetDriver_main(x,y)";
if (useM32()) {
@@ -395,26 +393,26 @@ static int ldMode(int argc, char** argv) {
args[j++] = "-Wl,--wrap=strcsequal";
#endif /* _HF_ARCH_DARWIN */
- for (int i = 1; i < argc; i++) {
- args[j++] = argv[i];
- }
-
- /* Reference standard honggfuzz libraries (libhfuzz and libhfnetdriver) */
- args[j++] = getLibHFNetDriverPath();
- args[j++] = getLibHFuzzPath();
- args[j++] = getLibHFNetDriverPath();
-
/* Pull modules defining the following symbols (if they exist) */
#ifdef _HF_ARCH_DARWIN
- args[j++] = "-Wl,-U,_LIBHFNETDRIVER_module_main",
+ args[j++] = "-Wl,-U,_HonggfuzzNetDriver_main";
args[j++] = "-Wl,-U,_LIBHFUZZ_module_instrument";
args[j++] = "-Wl,-U,_LIBHFUZZ_module_memorycmp";
#else /* _HF_ARCH_DARWIN */
- args[j++] = "-Wl,-u,LIBHFNETDRIVER_module_main",
+ args[j++] = "-Wl,-u,HonggfuzzNetDriver_main";
args[j++] = "-Wl,-u,LIBHFUZZ_module_instrument";
args[j++] = "-Wl,-u,LIBHFUZZ_module_memorycmp";
#endif /* _HF_ARCH_DARWIN */
+ for (int i = 1; i < argc; i++) {
+ args[j++] = argv[i];
+ }
+
+ /* Reference standard honggfuzz libraries (libhfuzz and libhfnetdriver) */
+ args[j++] = getLibHFNetDriverPath();
+ args[j++] = getLibHFuzzPath();
+ args[j++] = getLibHFNetDriverPath();
+
/* Needed by the libhfcommon */
args[j++] = "-pthread";