mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-27 13:33:17 +08:00
build: Switch fuzz builds to use Clang 5.0 sanitize=fuzzer
The old fuzzer location is deprecated; this also makes it almost trivial to fuzz, provided that the clang is set up correctly... on Ubuntu 17.10, a command sequence like this works now: sudo apt install clang-5.0 sudo apt install libfuzzer-5.0 sudo cp /usr/lib/llvm-5.0/lib/libFuzzer.a /usr/lib/libLLVMFuzzer.a CXX=clang++-5.0 make fuzz_parse
This commit is contained in:
parent
a569e6a737
commit
ba9504325e
9
Makefile
9
Makefile
@ -86,14 +86,9 @@ build/pugixml-%: .FORCE | $(RELEASE)
|
|||||||
$(EXECUTABLE): $(OBJECTS)
|
$(EXECUTABLE): $(OBJECTS)
|
||||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
build/libFuzzer.o:
|
$(BUILD)/fuzz_%: tests/fuzz_%.cpp src/pugixml.cpp
|
||||||
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)
|
@mkdir -p $(BUILD)
|
||||||
clang++ $(CXXFLAGS) -fsanitize=address -fsanitize-coverage=trace-pc-guard $^ -o $@
|
$(CXX) $(CXXFLAGS) -fsanitize=address,fuzzer $^ -o $@
|
||||||
|
|
||||||
$(BUILD)/%.o: %
|
$(BUILD)/%.o: %
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user