diff options
author | David Carlier <devnexen@gmail.com> | 2019-10-30 17:04:43 +0000 |
---|---|---|
committer | David Carlier <devnexen@gmail.com> | 2019-10-30 17:09:01 +0000 |
commit | 16953b5cfa040c886d0edfbf2f4da478c3e6014d (patch) | |
tree | 220e544c0350de072431cdc8363affec5a6b23aa /llvm_mode/afl-clang-fast.c | |
parent | cfccadcdc457ab5ad05c8f7c34c737305a28689f (diff) | |
download | afl++-16953b5cfa040c886d0edfbf2f4da478c3e6014d.tar.gz |
LLVM mode passing the full path of the LLVM config bindir.
On FreeBSD the system compiler does not have llvm-config however system packages provides several version of the LLVM toolchain thus forcing to pass AFL_CC/AFL_CXX to make it work fully.
Diffstat (limited to 'llvm_mode/afl-clang-fast.c')
-rw-r--r-- | llvm_mode/afl-clang-fast.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm_mode/afl-clang-fast.c b/llvm_mode/afl-clang-fast.c index 1acf8856..e92fb76f 100644 --- a/llvm_mode/afl-clang-fast.c +++ b/llvm_mode/afl-clang-fast.c @@ -32,11 +32,13 @@ #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <limits.h> #include <assert.h> 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]; /* Try to find the runtime libraries. If that fails, abort. */ @@ -117,12 +119,14 @@ static void edit_params(u32 argc, char** argv) { if (!strcmp(name, "afl-clang-fast++")) { u8* alt_cxx = getenv("AFL_CXX"); - cc_params[0] = alt_cxx ? alt_cxx : (u8*)"clang++"; + snprintf(llvm_fullpath, sizeof(llvm_fullpath), "%s/clang++", LLVM_BINDIR); + cc_params[0] = alt_cxx ? alt_cxx : (u8*)llvm_fullpath; } else { u8* alt_cc = getenv("AFL_CC"); - cc_params[0] = alt_cc ? alt_cc : (u8*)"clang"; + snprintf(llvm_fullpath, sizeof(llvm_fullpath), "%s/clang", LLVM_BINDIR); + cc_params[0] = alt_cc ? alt_cc : (u8*)llvm_fullpath; } |