diff --git a/debian/changelog b/debian/changelog index 7b03d0ca..1acafe22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +llvm-toolchain-4.0 (1:4.0.1~+rc1-2) unstable; urgency=medium + + * Only enable libfuzzer for Linux kernel. + Thanks to Pino Toscano for the patch + + -- Sylvestre Ledru Sat, 06 May 2017 10:03:14 +0200 + llvm-toolchain-4.0 (1:4.0.1~+rc1-1) unstable; urgency=medium * New snapshot release diff --git a/debian/control b/debian/control index a0976267..1c391756 100644 --- a/debian/control +++ b/debian/control @@ -166,7 +166,7 @@ Description: clang library - Common development package Package: libfuzzer-4.0-dev -Architecture: any +Architecture: linux-any Section: libdevel Depends: ${shlibs:Depends}, ${misc:Depends}, clang-4.0 (= ${binary:Version}) Description: Library for coverage-guided fuzz testing diff --git a/debian/rules b/debian/rules index e1e7479e..93b0abbc 100755 --- a/debian/rules +++ b/debian/rules @@ -21,6 +21,7 @@ DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_HOST_ARCH_BITS = $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_HOST_ARCH_OS = $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) LDFLAGS_EXTRA = CXXFLAGS_EXTRA = -std=c++0x @@ -147,6 +148,11 @@ ifneq (,$(filter $(DEB_HOST_ARCH),$(OCAML_ARCHS))) DH_OPTIONS=--with ocaml endif +LIBFUZZER_ENABLE=yes +ifeq (,$(filter $(DEB_HOST_ARCH_OS),linux)) + LIBFUZZER_ENABLE=no +endif + %: dh $@ $(DH_OPTIONS) @@ -266,12 +272,14 @@ override_dh_auto_configure: preconfigure override_dh_auto_build: $(PRE_PROCESS) $(MAKE) $(NJOBS) -C $(TARGET_BUILD) VERBOSE=1 CLANG_VENDOR=$(VENDOR) CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" REQUIRES_RTTI=1 DEBUGMAKE=1 +ifeq (${LIBFUZZER_ENABLE},yes) cd $(TARGET_BUILD) \ CFLAGS=`dpkg-buildflags --get CFLAGS`; \ CFLAGS="$$CFLAGS `dpkg-buildflags --get CPPFLAGS`"; \ echo $$CFLAGS; \ bin/clang++ -c $$CFLAGS -std=c++11 ../lib/Fuzzer/*.cpp -IFuzzer; \ ar ruv libFuzzer.a Fuzzer*.o +endif override_dh_prep: build_doc dh_prep @@ -340,8 +348,10 @@ override_dh_auto_install: mkdir -p $(CURDIR)/debian/clang-$(LLVM_VERSION)/usr/bin/ cp compiler-rt/lib/asan/scripts/asan_symbolize.py $(CURDIR)/debian/clang-$(LLVM_VERSION)/usr/bin/asan_symbolize-$(LLVM_VERSION) +ifeq (${LIBFUZZER_ENABLE},yes) mkdir -p $(CURDIR)/debian/libfuzzer-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/ cp -v $(TARGET_BUILD)/libFuzzer.a $(CURDIR)/debian/libfuzzer-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/ +endif # Create this fake directory to make the install libclang-common-dev happy # under the unsupported archs of compiler-rt