Lines Matching +full:gcc +full:- +full:8
2 # american fuzzy lop++ - GCC plugin instrumentation
3 # -----------------------------------------------
10 # GCC integration design is based on the LLVM design, which comes
14 # Copyright 2019-2024 AFLplusplus Project. All rights reserved.
20 # https://www.apache.org/licenses/LICENSE-2.0
29 VERSION = $(shell grep '^$(HASH)define VERSION ' ./config.h | cut -d '"' -f2)
31 CFLAGS ?= -O3 -g -funroll-loops
32 # -D_FORTIFY_SOURCE=1
33 CFLAGS_SAFE := -Wall -Iinclude -Wno-pointer-sign \
34 -DAFL_PATH=\"$(HELPER_PATH)\" -DBIN_PATH=\"$(BIN_PATH)\" \
35 -DGCC_VERSION=\"$(GCCVER)\" -DGCC_BINDIR=\"$(GCCBINDIR)\" \
36 -Wno-unused-function
39 CXXFLAGS ?= -O3 -g -funroll-loops
40 # -D_FORTIFY_SOURCE=1
41 CXXEFLAGS := $(CXXFLAGS) $(CPPFLAGS) -Wall -std=c++11
43 CC ?= gcc
46 SYS = $(shell uname -s)
49 CC = gcc
54 CC = gcc
58 ifeq "$(findstring Foundation,$(shell $(CC) --version))" ""
59 CC = gcc
63 PLUGIN_BASE = "$(shell $(CC) -print-file-name=plugin)"
64 PLUGIN_FLAGS = -fPIC -fno-rtti -fno-exceptions -I$(PLUGIN_BASE)/include -I$(PLUGIN_BASE)
67 GCCVER = $(shell $(CC) --version 2>/dev/null | awk 'NR == 1 {print $$NF}')
68 GCCBINDIR = $(shell dirname `command -v $(CC)` 2>/dev/null )
70 …d, IPC_RMID, 0); return 0;}' | tr @ '\n' | $(CC) -x c - -o .test2 2>/dev/null && echo 1 || echo 0 …
74 override CFLAGS_SAFE += -DUSEMMAP=1
79 override CFLAGS_SAFE += -DUSEMMAP=1
84 LDFLAGS += -lrt
87 CFLAGS_SAFE += -DUSEMMAP=1
93 PLUGIN_FLAGS += -I/usr/local/include
97 PLUGIN_FLAGS += -I/usr/local/include
101 PLUGIN_FLAGS += -I/usr/include/gmp
105 PASSES = ./afl-gcc-pass.so ./afl-gcc-cmplog-pass.so ./afl-gcc-cmptrs-pass.so
107 PROGS = $(PASSES) ./afl-compiler-rt.o ./afl-compiler-rt-32.o ./afl-compiler-rt-64.o
116 @rm -f .test2
119 @echo "[-] shmat seems not to be working, switching to mmap implementation"
125 …@command -v $(CC) >/dev/null 2>&1 || ( echo "[-] Oops, can't find '$(CC)'. Make sure that it's in …
126 # @echo "[*] Checking for gcc for plugin support..."
127 # @$(CC) -v 2>&1 | grep -q -- --enable-plugin || ( echo "[-] Oops, this gcc has not been configured…
128 @echo "[*] Checking for gcc plugin development header files..."
129 …@test -d `$(CC) -print-file-name=plugin`/include || ( echo "[-] Oops, can't find gcc header files.…
130 @echo "[*] Checking for './afl-showmap'..."
131 …@test -f ./afl-showmap || ( echo "[-] Oops, can't find './afl-showmap'. Be sure to compile AFL fir…
134 afl-common.o: ./src/afl-common.c
135 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ $(LDFLAGS)
137 ./afl-compiler-rt.o: instrumentation/afl-compiler-rt.o.c
138 $(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -fPIC -c $< -o $@
140 ./afl-compiler-rt-32.o: instrumentation/afl-compiler-rt.o.c
141 @printf "[*] Building 32-bit variant of the runtime (-m32)... "
142 …@$(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m32 -fPIC -c $< -o $@ 2>/dev/null; if [ …
144 ./afl-compiler-rt-64.o: instrumentation/afl-compiler-rt.o.c
145 @printf "[*] Building 64-bit variant of the runtime (-m64)... "
146 …@$(CC) $(CFLAGS_SAFE) $(CPPFLAGS) -O3 -Wno-unused-result -m64 -fPIC -c $< -o $@ 2>/dev/null; if [ …
148 $(PASSES): instrumentation/afl-gcc-common.h
150 ./afl-gcc-pass.so: instrumentation/afl-gcc-pass.so.cc | test_deps
151 $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
152 ln -sf afl-cc afl-gcc-fast
153 ln -sf afl-cc afl-g++-fast
154 ln -sf afl-cc.8 afl-gcc-fast.8
155 ln -sf afl-cc.8 afl-g++-fast.8
157 ./afl-gcc-cmplog-pass.so: instrumentation/afl-gcc-cmplog-pass.so.cc | test_deps
158 $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
160 ./afl-gcc-cmptrs-pass.so: instrumentation/afl-gcc-cmptrs-pass.so.cc | test_deps
161 $(CXX) $(CXXEFLAGS) $(PLUGIN_FLAGS) -shared $< -o $@
166 … AFL_INST_RATIO=100 AFL_PATH=. AFL_CC=$(CC) ./afl-gcc-fast $(CFLAGS) $(CPPFLAGS) ./test-instr.c -o…
167 ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr0 ./test-instr </dev/null
168 echo 1 | ASAN_OPTIONS=detect_leaks=0 ./afl-showmap -m none -q -o .test-instr1 ./test-instr
169 @rm -f test-instr
170 …@cmp -s .test-instr0 .test-instr1; DR="$$?"; rm -f .test-instr0 .test-instr1; if [ "$$DR" = "0" ];…
175 @echo "[+] All done! You can now use './afl-gcc-fast' to compile programs."
179 %.8: %
180 @echo .TH $* 8 `date "+%Y-%m-%d"` "AFL++" > ./$@
185 @./$* -h 2>&1 | head -n 3 | tail -n 1 | sed 's/^\.\///' >> ./$@
189 @./$* -h 2>&1 | tail -n +4 >> ./$@
192 …Hauser\" Heuse <mh@mh-sec.de>, Dominik Maier <[email protected]>, Andrea Fioraldi <andreafioraldi…
197 ln -sf afl-cc.8 ./afl-g++-fast.8
201 ln -sf afl-cc $${DESTDIR}$(BIN_PATH)/afl-gcc-fast
202 ln -sf afl-c++ $${DESTDIR}$(BIN_PATH)/afl-g++-fast
203 ln -sf afl-compiler-rt.o $${DESTDIR}$(HELPER_PATH)/afl-gcc-rt.o
204 install -m 755 ./afl-gcc-pass.so $${DESTDIR}$(HELPER_PATH)
205 install -m 755 ./afl-gcc-cmplog-pass.so $${DESTDIR}$(HELPER_PATH)
206 install -m 755 ./afl-gcc-cmptrs-pass.so $${DESTDIR}$(HELPER_PATH)
207 install -m 644 -T instrumentation/README.gcc_plugin.md $${DESTDIR}$(DOC_PATH)/README.gcc_plugin.md
211 rm -f *.o *.so *~ a.out core core.[1-9][0-9]* test-instr .test-instr0 .test-instr1 .test2
212 rm -f $(PROGS) afl-common.o ./afl-g++-fast ./afl-g*-fast.8 instrumentation/*.o