about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-01-05 22:13:55 +0100
committervan Hauser <vh@thc.org>2021-01-05 22:13:55 +0100
commit4c78bb70802a85ffad6aee0f234f26901cd563f9 (patch)
tree8ce3389286a37bb2494d1b9bcfb12ba7932a1e4a /src
parent59b86b0db0c856bc659eb81a1bd3c414865ab1e4 (diff)
downloadafl++-4c78bb70802a85ffad6aee0f234f26901cd563f9.tar.gz
cpp fix
Diffstat (limited to 'src')
-rw-r--r--src/afl-cc.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index 27bf8cf0..e61dc6d2 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -829,12 +829,25 @@ static void edit_params(u32 argc, char **argv, char **envp) {
       "extern unsigned char *__afl_fuzz_ptr;"
       "unsigned char __afl_fuzz_alt[1048576];"
       "unsigned char *__afl_fuzz_alt_ptr = __afl_fuzz_alt;";
-  cc_params[cc_par_cnt++] =
-      "-D__AFL_COVERAGE()=int __afl_selective_coverage = 1;"
-      "void __afl_coverage_discard();"
-      "void __afl_coverage_abort();"
-      "void __afl_coverage_on();"
-      "void __afl_coverage_off();";
+  if (plusplus_mode) {
+
+    "-D__AFL_COVERAGE()=int __afl_selective_coverage = 1;"
+    "extern \"C\" void __afl_coverage_discard();"
+    "extern \"C\" void __afl_coverage_abort();"
+    "extern \"C\" void __afl_coverage_on();"
+    "extern \"C\" void __afl_coverage_off();";
+
+  } else {
+
+    cc_params[cc_par_cnt++] =
+        "-D__AFL_COVERAGE()=int __afl_selective_coverage = 1;"
+        "void __afl_coverage_discard();"
+        "void __afl_coverage_abort();"
+        "void __afl_coverage_on();"
+        "void __afl_coverage_off();";
+
+  }
+
   cc_params[cc_par_cnt++] =
       "-D__AFL_COVERAGE_START_OFF()=int __afl_selective_coverage_start_off = "
       "1;";