0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 12:33:14 +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:
Arseny Kapoulkine 2017-10-29 19:50:42 -07:00
parent a569e6a737
commit ba9504325e

View File

@ -86,14 +86,9 @@ build/pugixml-%: .FORCE | $(RELEASE)
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
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
$(BUILD)/fuzz_%: tests/fuzz_%.cpp src/pugixml.cpp
@mkdir -p $(BUILD)
clang++ $(CXXFLAGS) -fsanitize=address -fsanitize-coverage=trace-pc-guard $^ -o $@
$(CXX) $(CXXFLAGS) -fsanitize=address,fuzzer $^ -o $@
$(BUILD)/%.o: %
@mkdir -p $(dir $@)