aboutsummaryrefslogtreecommitdiff
path: root/llvm_mode
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2019-10-31 09:25:43 +0000
committerDavid Carlier <devnexen@gmail.com>2019-10-31 09:25:43 +0000
commit070ccae4dd04c5315bf1daba8ee35202b4f30264 (patch)
tree7e0aeb3c32719f7f3a2bdd5b7a4e4cd1748e05ea /llvm_mode
parent16953b5cfa040c886d0edfbf2f4da478c3e6014d (diff)
downloadafl++-070ccae4dd04c5315bf1daba8ee35202b4f30264.tar.gz
Little tweaks
Diffstat (limited to 'llvm_mode')
-rw-r--r--llvm_mode/afl-clang-fast.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c
index e92fb76f..b2243492 100644
--- a/llvm_mode/afl-clang-fast.c
+++ b/llvm_mode/afl-clang-fast.c
@@ -38,7 +38,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 llvm_fullpath[PATH_MAX];
+static u8 llvm_fullpath[PATH_MAX];
/* Try to find the runtime libraries. If that fails, abort. */
@@ -106,6 +106,7 @@ static void find_obj(u8* argv0) {
static void edit_params(u32 argc, char** argv) {
u8 fortify_set = 0, asan_set = 0, x_set = 0, maybe_linking = 1, bit_mode = 0;
+ u8 has_llvm_config = 0;
u8* name;
cc_params = ck_alloc((argc + 128) * sizeof(u8*));
@@ -116,16 +117,20 @@ static void edit_params(u32 argc, char** argv) {
else
++name;
+ has_llvm_config = (strlen(LLVM_BINDIR) > 0);
+
if (!strcmp(name, "afl-clang-fast++")) {
u8* alt_cxx = getenv("AFL_CXX");
- snprintf(llvm_fullpath, sizeof(llvm_fullpath), "%s/clang++", LLVM_BINDIR);
+ if (has_llvm_config) snprintf(llvm_fullpath, sizeof(llvm_fullpath), "%s/clang++", LLVM_BINDIR);
+ else sprintf(llvm_fullpath, "clang++");
cc_params[0] = alt_cxx ? alt_cxx : (u8*)llvm_fullpath;
} else {
u8* alt_cc = getenv("AFL_CC");
- snprintf(llvm_fullpath, sizeof(llvm_fullpath), "%s/clang", LLVM_BINDIR);
+ if (has_llvm_config) snprintf(llvm_fullpath, sizeof(llvm_fullpath), "%s/clang", LLVM_BINDIR);
+ else sprintf(llvm_fullpath, "clang");
cc_params[0] = alt_cc ? alt_cc : (u8*)llvm_fullpath;
}