about summary refs log tree commit diff
path: root/gcc_plugin
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2019-11-12 10:31:49 +0100
committerGitHub <noreply@github.com>2019-11-12 10:31:49 +0100
commitc59e07581dd0008f2fdd5071bbfa874c89226a60 (patch)
tree721f34a77b421ba042b4b1a22b40891f35afee3b /gcc_plugin
parentc15053d1f8904f37aac965b654087ea31a3dacd0 (diff)
parent5939727b6606f5ec0186b7ac2a2766311edf41df (diff)
downloadafl++-c59e07581dd0008f2fdd5071bbfa874c89226a60.tar.gz
Merge pull request #107 from devnexen/gcc_plugin_pass_real_cmp_naming
gcc plugin little update proposal.
Diffstat (limited to 'gcc_plugin')
-rw-r--r--gcc_plugin/Makefile2
-rw-r--r--gcc_plugin/README.gcc.md8
-rw-r--r--gcc_plugin/afl-gcc-fast.c4
3 files changed, 8 insertions, 6 deletions
diff --git a/gcc_plugin/Makefile b/gcc_plugin/Makefile
index 287b6545..be54e553 100644
--- a/gcc_plugin/Makefile
+++ b/gcc_plugin/Makefile
@@ -80,7 +80,7 @@ test_deps:
 	@echo "[+] All set and ready to build."
 
 ../afl-gcc-fast: afl-gcc-fast.c | test_deps
-	$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
+	$(CC) -DAFL_GCC_CC=\"$(CC)\" -DAFL_GCC_CXX=\"$(CXX)\" $(CFLAGS) $< -o $@ $(LDFLAGS)
 	ln -sf afl-gcc-fast ../afl-g++-fast
 
 ../afl-gcc-pass.so: afl-gcc-pass.so.cc | test_deps
diff --git a/gcc_plugin/README.gcc.md b/gcc_plugin/README.gcc.md
index 676ef427..80fccfb6 100644
--- a/gcc_plugin/README.gcc.md
+++ b/gcc_plugin/README.gcc.md
@@ -46,9 +46,11 @@ should be all you need. On Debian machines, these headers can be acquired by
 installing the `gcc-<VERSION>-plugin-dev` packages.
 
 To build the instrumentation itself, type 'make'. This will generate binaries
-called afl-gcc-fast and afl-g++-fast in the parent directory. Once this
-is done, you can instrument third-party code in a way similar to the standard
-operating mode of AFL, e.g.:
+called afl-gcc-fast and afl-g++-fast in the parent directory. 
+If the CC/CXX have been overridden, those compilers will be used from
+those wrappers without using AFL_CXX/AFL_CC settings.
+Once this is done, you can instrument third-party code in a way similar to the
+standard operating mode of AFL, e.g.:
 
   CC=/path/to/afl/afl-gcc-fast ./configure [...options...]
   make
diff --git a/gcc_plugin/afl-gcc-fast.c b/gcc_plugin/afl-gcc-fast.c
index 057b44cc..68035944 100644
--- a/gcc_plugin/afl-gcc-fast.c
+++ b/gcc_plugin/afl-gcc-fast.c
@@ -119,12 +119,12 @@ static void edit_params(u32 argc, char** argv) {
   if (!strcmp(name, "afl-g++-fast")) {
 
     u8* alt_cxx = getenv("AFL_CXX");
-    cc_params[0] = alt_cxx ? alt_cxx : (u8*)"g++";
+    cc_params[0] = alt_cxx ? alt_cxx : (u8*)AFL_GCC_CXX;
 
   } else {
 
     u8* alt_cc = getenv("AFL_CC");
-    cc_params[0] = alt_cc ? alt_cc : (u8*)"gcc";
+    cc_params[0] = alt_cc ? alt_cc : (u8*)AFL_GCC_CC;
 
   }