From edd746704de34558b0b18c247af8d310a71dda3e Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sep 12 2017 20:48:49 +0000 Subject: Package libFuzzer The libFuzzer source code is included in the llvm sources for llvm 4.0 and 5.0, but is moved into compiler-rt for LLVM 6.0, so we are packaging it as a part of compiler-rt-4.0.* to keep it consistent with future versions of LLVM. --- diff --git a/.gitignore b/.gitignore index 5710d5c..4519caf 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /compiler-rt-3.9.1.src.tar.xz /compiler-rt-4.0.0.src.tar.xz /compiler-rt-4.0.1.src.tar.xz +/libFuzzer.tar.xz diff --git a/compiler-rt.spec b/compiler-rt.spec index e48cd36..d5e5917 100644 --- a/compiler-rt.spec +++ b/compiler-rt.spec @@ -5,12 +5,21 @@ Name: compiler-rt Version: 4.0.1 -Release: 4%{?dist} +Release: 5%{?dist} Summary: LLVM "compiler-rt" runtime libraries License: NCSA or MIT URL: http://llvm.org Source0: http://llvm.org/releases/%{version}/%{name}-%{version}.src.tar.xz +# Extract libFuzzer sources from the llvm tarball. We are packaging it as part +# of compiler-rt, because upstream moved the code into the compiler-rt project +# for LLVM 6.0.0, and we also don't want to add clang as a build dependency for +# llvm. +# wget http://llvm.org/releases/4.0.1/llvm-4.0.1.src.tar.xz +# tar -xJf llvm-4.0.1.src.tar.xz +# cd llvm-4.0.1.src/lib/Fuzzer/ +# tar -cJf Fuzzer.tar.xz Fuzzer/ +Source1: Fuzzer.tar.xz Patch0: 0001-Build-fixes-for-newer-glibc.patch BuildRequires: cmake @@ -18,6 +27,9 @@ BuildRequires: python BuildRequires: llvm-devel = %{version} BuildRequires: llvm-static = %{version} +# libFuzzer must be built by clang. +BuildRequires: clang + %description The compiler-rt project is a part of the LLVM project. It provides implementation of the low-level target-specific hooks required by @@ -25,6 +37,8 @@ code generation, sanitizer runtimes and profiling library for code instrumentation, and Blocks C language extension. %prep +%setup -T -q -b 1 -n Fuzzer + %autosetup -n %{name}-%{version}.src -p1 %build @@ -43,18 +57,26 @@ cd _build make %{?_smp_mflags} +pushd ../../Fuzzer +./build.sh +popd + %install cd _build make install DESTDIR=%{buildroot} +mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib + +pushd ../../Fuzzer +install -m0644 libFuzzer.a %{buildroot}%{_libdir}/clang/%{version}/lib +popd + # move sanitizer lists to better place -mkdir -p %{buildroot}%{_libdir}/clang/%{version} for file in asan_blacklist.txt msan_blacklist.txt dfsan_blacklist.txt cfi_blacklist.txt dfsan_abilist.txt; do mv -v %{buildroot}%{_prefix}/${file} %{buildroot}%{_libdir}/clang/%{version}/ || : done # move sanitizer libs to better place -mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib mv -v %{buildroot}%{_prefix}/lib/linux/libclang_rt* %{buildroot}%{_libdir}/clang/%{version}/lib mkdir -p %{buildroot}%{_libdir}/clang/%{version}/lib/linux/ pushd %{buildroot}%{_libdir}/clang/%{version}/lib @@ -71,6 +93,9 @@ cd _build %{_libdir}/clang/%{version} %changelog +* Tue Sep 12 2017 Tom Stellard - 4.0.1-5 +- Package libFuzzer + * Wed Aug 02 2017 Fedora Release Engineering - 4.0.1-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild diff --git a/sources b/sources index eb00615..6d4156c 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ SHA512 (compiler-rt-4.0.0.src.tar.xz) = ed52436a2399ca82c1af46a523e89e88c23367f74cd110f0267af49a72aa4912ae8f48c6093e6b01c9ea68c48354a12201d26baf721d254fb017ddb98af2e3dd SHA512 (compiler-rt-4.0.1.src.tar.xz) = cfeb625884b273f7c0e6767b81a8d3e5f24e0b96a510d5764d9d47a0e215fc841b4cb9d1843c8fb428cd21def720cfbfe8d3593ff5bb390548ebc8c32a902649 +SHA512 (libFuzzer.tar.xz) = cc69abdea6c509521904f0011427cf30ea5aa4d1cda8059d9ff329d8eccf6dffc77945b3edd905cb0e799bb36710c6c36e095b52276ddb5af447818f4ed4de52