summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-04-03 21:09:37 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2017-04-03 21:09:37 -0700
commit24d1a4562b36ecfcd7a6b3b843921d553332a0f0 (patch)
tree3ce4dbf4c2da158c5232a3306ab09187d90fca26
parent0eb1ddb975e867079e87e2345e59a520890b275a (diff)
Move libFuzzer build to Makefile
Now the only thing fuzz_setup.sh does is installing new clang; if system clang supports -fsanitize-coverage then fuzz_setup.sh is not required.
-rw-r--r--Makefile9
-rwxr-xr-xtests/fuzz_setup.sh3
2 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 75528fe..edc3c42 100644
--- a/Makefile
+++ b/Makefile
@@ -86,9 +86,14 @@ build/pugixml-%: .FORCE | $(RELEASE)
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
-$(BUILD)/fuzz_%: tests/fuzz_%.cpp src/pugixml.cpp
+build/libFuzzer.o:
+ svn co http://llvm.org/svn/llvm-project/llvm/trunk/lib/Fuzzer build/Fuzzer
+ ls build/Fuzzer/*.cpp | xargs printf '#include "%s"\n' >build/libFuzzer.cpp
+ clang++ build/libFuzzer.cpp -c -g -O2 -fno-omit-frame-pointer -std=c++11 -I . -o build/libFuzzer.o
+
+$(BUILD)/fuzz_%: tests/fuzz_%.cpp src/pugixml.cpp build/libFuzzer.o
@mkdir -p $(BUILD)
- clang++ $(CXXFLAGS) -fsanitize=address -fsanitize-coverage=trace-pc-guard $^ libFuzzer.a -o $@
+ clang++ $(CXXFLAGS) -fsanitize=address -fsanitize-coverage=trace-pc-guard $^ -o $@
$(BUILD)/%.o: %
@mkdir -p $(dir $@)
diff --git a/tests/fuzz_setup.sh b/tests/fuzz_setup.sh
index 5ff8be0..b8ba32d 100755
--- a/tests/fuzz_setup.sh
+++ b/tests/fuzz_setup.sh
@@ -9,6 +9,3 @@ cd ..
clang/clang/scripts/update.py
sudo cp -rf third_party/llvm-build/Release+Asserts/lib/* /usr/local/lib/
sudo cp -rf third_party/llvm-build/Release+Asserts/bin/* /usr/local/bin
-
-svn co http://llvm.org/svn/llvm-project/llvm/trunk/lib/Fuzzer
-Fuzzer/build.sh