aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2020-11-01 06:22:18 +0100
committerhexcoder- <heiko@hexco.de>2020-11-01 06:22:18 +0100
commitded80870a933b83d8186a160f7717641ce441a81 (patch)
treebae12b2fb810f7072c939110e1f2167ee0d2c6fc /src
parent5a84db7c67fb10f772d4538c10b217b816ada6d6 (diff)
downloadafl++-ded80870a933b83d8186a160f7717641ce441a81.tar.gz
reenable afl-clang(++)
Diffstat (limited to 'src')
-rw-r--r--src/afl-cc.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c
index 1ad43c43..25ed923a 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -48,6 +48,7 @@
static u8 * obj_path; /* Path to runtime libraries */
static u8 **cc_params; /* Parameters passed to the real CC */
static u32 cc_par_cnt = 1; /* Param count, including argv0 */
+static u8 clang_mode; /* Invoked as afl-clang*? */
static u8 llvm_fullpath[PATH_MAX];
static u8 instrument_mode, instrument_opt_mode, ngram_size, lto_mode;
static u8 compiler_mode, plusplus_mode, have_instr_env = 0;
@@ -288,7 +289,15 @@ static void edit_params(u32 argc, char **argv, char **envp) {
if (compiler_mode >= GCC_PLUGIN) {
- alt_cxx = "g++";
+ if (compiler_mode == GCC) {
+
+ alt_cxx = clang_mode ? "clang++" : "g++";
+
+ } else {
+
+ alt_cxx = "g++";
+
+ }
} else {
@@ -313,7 +322,15 @@ static void edit_params(u32 argc, char **argv, char **envp) {
if (compiler_mode >= GCC_PLUGIN) {
- alt_cc = "gcc";
+ if (compiler_mode == GCC) {
+
+ alt_cc = clang_mode ? "clang" : "gcc";
+
+ } else {
+
+ alt_cc = "gcc";
+
+ }
} else {
@@ -337,6 +354,11 @@ static void edit_params(u32 argc, char **argv, char **envp) {
cc_params[cc_par_cnt++] = "-B";
cc_params[cc_par_cnt++] = obj_path;
+ if (clang_mode) {
+
+ cc_params[cc_par_cnt++] = "-no-integrated-as";
+
+ }
}
if (compiler_mode == GCC_PLUGIN) {
@@ -934,7 +956,9 @@ int main(int argc, char **argv, char **envp) {
} else if (strncmp(callname, "afl-gcc", 7) == 0 ||
- strncmp(callname, "afl-g++", 7) == 0) {
+ strncmp(callname, "afl-g++", 7) == 0 ||
+
+ strncmp(callname, "afl-clang", 9) == 0) {
compiler_mode = GCC;
@@ -978,6 +1002,19 @@ int main(int argc, char **argv, char **envp) {
}
+
+ if (strncmp(callname, "afl-clang", 9) == 0) {
+
+ clang_mode = 1;
+
+ if (strncmp(callname, "afl-clang++", 11) == 0) {
+
+ plusplus_mode = 1;
+
+ }
+
+ }
+
for (i = 1; i < argc; i++) {
if (strncmp(argv[i], "--afl", 5) == 0) {