%bcond_with check # Only arches that are supported upstream as multilib and that the distro # has multilib builds for should set build_multilib 1. In practice that # is only x86_64 and ppc64 (but not in fedora 21 and later, and never # for ppc64le). %global build_multilib 0 %ifarch x86_64 ppc64 %global build_multilib 1 %endif # Vine Linux doesn't have openmpi package #ifarch %{ix86} x86_64 ppc ppc64 ppc64le %{arm} aarch64 #global build_openmpi 1 #else %global build_openmpi 0 #endif %global run_full_regtest 0 %global build_tools_devel 0 # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed # DWARF very well and it might read its own vgpreload libraries. Generating # minisymtabs doesn't really work for the staticly linked tools. %define _find_debuginfo_dwz_opts %{nil} %undefine _include_minidebuginfo Name: valgrind Version: 3.14.0 Release: 1%{?_dist_release} Summary: Tool for finding memory management bugs in programs Summary(ja): プログラムのメモリ管理バグを発見するためのツール Vendor: Project Vine Distribution: Vine Linux License: GPLv2+ Group: Development/Debuggers URL: http://valgrind.org/ Source0: http://valgrind.org/downloads/%{name}-%{version}.tar.bz2 # Needs investigation and pushing upstream Patch1: valgrind-3.9.0-cachegrind-improvements.patch # KDE#211352 - helgrind races in helgrind's own mythread_wrapper Patch2: valgrind-3.9.0-helgrind-race-supp.patch # Make ld.so supressions slightly less specific. Patch3: valgrind-3.9.0-ldso-supp.patch # KDE#400490 s390x: Fix register allocation for VRs vs FPRs Patch4: valgrind-3.14.0-s390x-fix-reg-alloc-vr-vs-fpr.patch # KDE#400491 s390x: Sign-extend immediate operand of LOCHI and friends Patch5: valgrind-3.14.0-s390x-sign-extend-lochi.patch # KDE#397187 s390x: Add vector register support for vgdb Patch6: valgrind-3.14.0-s390x-vec-reg-vgdb.patch # KDE#385411 s390x: z13 vector floating-point instructions not implemented Patch7: valgrind-3.14.0-s390x-vec-float-point-code.patch Patch8: valgrind-3.14.0-s390x-vec-float-point-tests.patch # KDE#401277 More bugs in z13 support Patch9: valgrind-3.14.0-s390z-more-z13-fixes.patch # KDE#386945 Bogus memcheck errors on ppc64(le) when using strcmp Patch10: valgrind-3.14.0-get_otrack_shadow_offset_wrk-ppc.patch Patch11: valgrind-3.14.0-new-strlen-IROps.patch Patch12: valgrind-3.14.0-ppc-instr-new-IROps.patch Patch13: valgrind-3.14.0-memcheck-new-IROps.patch Patch14: valgrind-3.14.0-ppc-frontend-new-IROps.patch Patch15: valgrind-3.14.0-transform-popcount64-ctznat64.patch Patch16: valgrind-3.14.0-enable-ppc-Iop_Sar_Shr8.patch # KDE#401627 memcheck errors with glibc avx2 optimized wcsncmp Patch17: valgrind-3.14.0-wcsncmp.patch # KDE#402006 mark helper regs defined in final_tidyup before freeres_wrapper # Prereq for KDE#386945 Patch18: valgrind-3.14.0-final_tidyup.patch # KDE#386945 Bogus memcheck errors on ppc64(le) when using strcmp # See also patches 10 to 16 (yes, there are this many...) Patch19: valgrind-3.14.0-ppc64-ldbrx.patch Patch20: valgrind-3.14.0-ppc64-unaligned-words.patch Patch21: valgrind-3.14.0-ppc64-lxvd2x.patch Patch22: valgrind-3.14.0-ppc64-unaligned-vecs.patch Patch23: valgrind-3.14.0-ppc64-lxvb16x.patch Patch24: valgrind-3.14.0-set_AV_CR6.patch Patch25: valgrind-3.14.0-undef_malloc_args.patch # KDE#401822 none/tests/ppc64/jm-vmx fails and produces assembler warnings Patch26: valgrind-3.14.0-jm-vmx-constraints.patch # commit 0c701ba2a Fix sigkill.stderr.exp for glibc-2.28. Patch27: valgrind-3.14.0-sigkill.patch # KDE#402048 Implement minimal ptrace support for ppc64[le]-linux. Patch28: valgrind-3.14.0-ppc64-ptrace.patch # commit 43fe4bc23 arm64: Fix PTRACE_TRACEME Patch29: valgrind-3.14.0-arm64-ptrace-traceme.patch # KDE#402134 - assert fail mc_translate.c (noteTmpUsesIn) Iex_VECRET on arm64 Patch30: valgrind-3.14.0-mc_translate-vecret.patch # KDE#402481 vbit-test fails on x86 for Iop_CmpEQ64 iselInt64Expr Sar64 Patch31: valgrind-3.14.0-vbit-test-sec.patch Patch32: valgrind-3.14.0-x86-Iop_Sar64.patch # KDE#402519 POWER 3.0 addex instruction incorrectly implemented Patch33: valgrind-3.14.0-power9-addex.patch # KDE#402480 Do not use %rsp in clobber list Patch34: valgrind-3.14.0-rsp-clobber.patch # commit 3528f8 Accept DW_TAG_subrange_type with DW_AT_count Patch35: valgrind-3.14.0-subrange_type-count.patch Buildroot: %{_tmppath}/%{name}-%{version}-root %if %{build_multilib} # Ensure glibc{,-devel} is installed for both multilib arches BuildRequires: compat32-glibc-devel %endif BuildRequires: glibc-devel >= 2.14 %if %{build_openmpi} BuildRequires: openmpi-devel >= 1.3.3 %endif # For %%build and %%check. # In case of a software collection, pick the matching gdb and binutils. BuildRequires: gdb BuildRequires: binutils # gdbserver_tests/filter_make_empty uses ps in test BuildRequires: procps ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 %ifarch %{ix86} %define valarch x86 %define valsecarch %{nil} %endif %ifarch x86_64 %define valarch amd64 %define valsecarch x86 %endif %ifarch ppc %define valarch ppc32 %define valsecarch %{nil} %endif %ifarch ppc64 %define valarch ppc64be %if %{build_multilib} %define valsecarch ppc32 %else %define valsecarch %{nil} %endif %endif %ifarch ppc64le %define valarch ppc64le %define valsecarch %{nil} %endif %ifarch s390x %define valarch s390x %define valsecarch %{nil} %endif %ifarch armv7hl %define valarch arm %define valsecarch %{nil} %endif %ifarch aarch64 %define valarch arm64 %define valsecarch %{nil} %endif # Don't run dwz or generate minisymtab, valgrind doesn't handle compressed # DWARF very well and it might read its own vgpreload libraries. Generating # minisymtabs doesn't really work for the staticly linked tools. %define _find_debuginfo_dwz_opts %{nil} %undefine _include_minidebuginfo %description Valgrind is a tool to help you find memory-management problems in your programs. When a program is run under Valgrind's supervision, all reads and writes of memory are checked, and calls to malloc/new/free/delete are intercepted. As a result, Valgrind can detect a lot of problems that are otherwise very hard to find/diagnose. %package devel Summary: Development files for valgrind Summary(ja): Valgrind の開発用ファイル Group: Development/Libraries Requires: %{name} = %{version}-%{release} Provides: %{name}-static = %{version}-%{release} %description devel Header files and libraries for development of valgrind aware programs or valgrind plugins. %package openmpi Summary: OpenMPI support for valgrind Summary(ja): Valgrind の OpenMPI サポート Group: Development/Debuggers Requires: %{name} = %{version}-%{release} %description openmpi A wrapper library for debugging OpenMPI parallel programs with valgrind. See the section on Debugging MPI Parallel Programs with Valgrind in the Valgrind User Manual for details. %prep %setup -q -n %{name}-%{version} %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 %patch6 -p1 %patch7 -p1 %patch8 -p1 %patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p1 %patch14 -p1 %patch15 -p1 %patch16 -p1 %patch17 -p1 %patch18 -p1 %patch19 -p1 %patch20 -p1 %patch21 -p1 %patch22 -p1 %patch23 -p1 %patch24 -p1 %patch25 -p1 %patch26 -p1 %patch27 -p1 %patch28 -p1 %patch29 -p1 %patch30 -p1 %patch31 -p1 %patch32 -p1 %patch33 -p1 %patch34 -p1 %patch35 -p1 %build CC=gcc %if %{build_multilib} # Ugly hack - libgcc 32-bit package might not be installed mkdir -p shared/libgcc/32 ar r shared/libgcc/32/libgcc_s.a ar r shared/libgcc/libgcc_s_32.a CC="gcc -B `pwd`/shared/libgcc/" %endif # Old openmpi-devel has version depended paths for mpicc. %if %{build_openmpi} %if 0%{?fedora} >= 13 || 0%{?rhel} >= 6 %define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/bin/mpicc %else %define mpiccpath %{!?scl:%{_libdir}}%{?scl:%{_root_libdir}}/openmpi/*/bin/mpicc %endif %else # We explicitly don't want the libmpi wrapper. So make sure that configure # doesn't pick some random mpi compiler that happens to be installed. %define mpiccpath /bin/false %endif # Filter out some flags that cause lots of valgrind test failures. # Also filter away -O2, valgrind adds it wherever suitable, but # not for tests which should be -O0, as they aren't meant to be # compiled with -O2 unless explicitely requested. Same for any -mcpu flag. # Ideally we will change this to only be done for the non-primary build # and the test suite. Also disable strict symbol checks because the # vg_preload library will use hidden/undefined symbols from glibc # like __libc_freeres. %undefine _hardened_build %undefine _strict_symbol_defs_build OPTFLAGS="`echo " %{optflags} " | sed 's/ -m\(64\|3[21]\) / /g;s/ -fexceptions / /g;s/ -fstack-protector\([-a-z]*\) / / g;s/ -Wp,-D_FORTIFY_SOURCE=2 / /g;s/ -O2 / /g;s/ -mcpu=\([a-z0-9]\+\) / /g;s/^ //;s/ $//'`" %configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" \ --with-mpicc=%{mpiccpath} \ GDB=%{_bindir}/gdb make %{?_smp_mflags} # Ensure there are no unexpected file descriptors open, # the testsuite otherwise fails. cat > close_fds.c < #include int main (int argc, char *const argv[]) { int i, j = sysconf (_SC_OPEN_MAX); if (j < 0) exit (1); for (i = 3; i < j; ++i) close (i); execvp (argv[1], argv + 1); exit (1); } EOF gcc $RPM_OPT_FLAGS -o close_fds close_fds.c %install rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install mkdir docs/installed mv $RPM_BUILD_ROOT%{_datadir}/doc/valgrind/* docs/installed/ rm -f docs/installed/*.ps # We want the MPI wrapper installed under the openmpi libdir so the script # generating the MPI library requires picks them up and sets up the right # openmpi libmpi.so requires. Install symlinks in the original/upstream # location for backwards compatibility. %if %{build_openmpi} pushd $RPM_BUILD_ROOT%{_libdir} mkdir -p openmpi/valgrind cd valgrind mv libmpiwrap-%{valarch}-linux.so ../openmpi/valgrind/ ln -s ../openmpi/valgrind/libmpiwrap-%{valarch}-linux.so popd %endif %if "%{valsecarch}" != "" pushd $RPM_BUILD_ROOT%{_libdir}/valgrind/ rm -f *-%{valsecarch}-* || : for i in *-%{valarch}-*; do j=`echo $i | sed 's/-%{valarch}-/-%{valsecarch}-/'` ln -sf ../../lib/valgrind/$j $j done popd %endif # remove unuse files rm -f $RPM_BUILD_ROOT%{_libdir}/valgrind/*.supp.in %if %{build_tools_devel} %ifarch %{ix86} x86_64 # To avoid multilib clashes in between i?86 and x86_64, # tweak installed a little bit. for i in HAVE_PTHREAD_CREATE_GLIBC_2_0 HAVE_PTRACE_GETREGS HAVE_AS_AMD64_FXSAVE64 \ ; do sed -i -e 's,^\(#define '$i' 1\|/\* #undef '$i' \*/\)$,#ifdef __x86_64__\n# define '$i' 1\n#endif,' \ $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h done %endif %else # Remove files we aren't going to package. # See tools-devel files. rm $RPM_BUILD_ROOT%{_includedir}/valgrind/config.h rm $RPM_BUILD_ROOT%{_includedir}/valgrind/libvex*h rm $RPM_BUILD_ROOT%{_includedir}/valgrind/pub_tool_*h rm -rf $RPM_BUILD_ROOT%{_includedir}/valgrind/vki rm $RPM_BUILD_ROOT%{_libdir}/valgrind/*.a %endif # We don't want debuginfo generated for the vgpreload libraries. # Turn off execute bit so they aren't included in the debuginfo.list. # We'll turn the execute bit on again in %%files. chmod 644 $RPM_BUILD_ROOT%{_libdir}/valgrind/vgpreload*-%{valarch}-*so %if %{with check} %check # Make sure a basic binary runs. There should be no errors. ./vg-in-place --error-exitcode=1 /bin/true # Build the test files with the software collection compiler if available. %{?scl:PATH=%{_bindir}${PATH:+:${PATH}}} # Make sure no extra CFLAGS, CXXFLAGS or LDFLAGS leak through, # the testsuite sets all flags necessary. See also configure above. make %{?_smp_mflags} CFLAGS="" CXXFLAGS="" LDFLAGS="" check # Workaround https://bugzilla.redhat.com/show_bug.cgi?id=1434601 # for gdbserver tests. export PYTHONCOERCECLOCALE=0 echo ===============TESTING=================== %if 0%{?run_full_regtest} ./close_fds make regtest || : %else ./close_fds make nonexp-regtest || : %endif # Make sure test failures show up in build.log # Gather up the diffs (at most the first 20 lines for each one) MAX_LINES=20 diff_files=`find */tests -name '*.diff*' | sort` if [ z"$diff_files" = z ] ; then echo "Congratulations, all tests passed!" >> diffs else for i in $diff_files ; do echo "=================================================" >> diffs echo $i >> diffs echo "=================================================" >> diffs if [ `wc -l < $i` -le $MAX_LINES ] ; then cat $i >> diffs else head -n $MAX_LINES $i >> diffs echo "" >> diffs fi done fi cat diffs echo ===============END TESTING=============== %endif %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,root) %license COPYING %doc NEWS README_* %doc docs/installed/html docs/installed/*.pdf %{_bindir}/* %dir %{_libdir}/%{name} %{_libdir}/%{name}/*[^ao] %{_libdir}/%{name}/[^l]*o %{_mandir}/man1/* %files devel %defattr(-,root,root) %dir %{_includedir}/valgrind %{_includedir}/valgrind/valgrind.h %{_includedir}/valgrind/callgrind.h %{_includedir}/valgrind/drd.h %{_includedir}/valgrind/helgrind.h %{_includedir}/valgrind/memcheck.h %{_libdir}/pkgconfig/valgrind.pc %if %{build_tools_devel} %files tools-devel %{_includedir}/valgrind/config.h %{_includedir}/valgrind/libvex*h %{_includedir}/valgrind/pub_tool_*h %{_includedir}/valgrind/vki %dir %{_libdir}/valgrind %{_libdir}/valgrind/*.a %endif %if %{build_openmpi} %files openmpi %defattr(-,root,root) %dir %{_libdir}/valgrind %{_libdir}/openmpi/valgrind/libmpiwrap*.so %{_libdir}/valgrind/libmpiwrap*.so %endif %changelog * Tue Jan 22 2019 Tomohiro "Tomo-p" KATO 3.14.0-1 - dropped Patch4-19. - import Patch4-35 from rawhide. * Fri Dec 22 2017 Tomohiro "Tomo-p" KATO 3.13.0-1 - updated to 3.13.0. - replaced all Patches (from rawhide). * Mon Mar 16 2015 Ryoichi INAGAKI 3.10.1-1 - updated valgrind to 3.10.1 based on fedora 3.10.1-6 - replaced all Patches (from fedora) * Wed Apr 18 2012 Yoji TOYODA 3.7.0-1 - updated valgrind to 3.7.0 - replace all Patches (from fedora) * Thu Nov 11 2010 Shu KONNO 3.6.0-1 - updated valgrind to 3.6.0 - updated BR: glibc-devel <= 2.12 - added BR: gcc <= 4.5 - added RQ: glibc <= 2.12 * Tue Oct 05 2010 Shu KONNO 3.5.0-1 - updated valgrind to 3.5.0 - added BR: glibc-devel >= 2.11 - split %{name}-devel - added patches (from fedora core 12) - valgrind-3.5.0-cachegrind-improvements.patch - valgrind-3.5.0-openat.patch - valgrind-3.5.0-glibc-2.10.1.patch - valgrind-3.5.0-ifunc.patch - valgrind-3.5.0-inotify-init1.patch - valgrind-3.5.0-mmap-mprotect.patch - valgrind-3.5.0-dwarf3.patch - valgrind-3.5.0-pr40659.patch - valgrind-3.5.0-helgrind-race-supp.patch - valgrind-3.5.0-ppc-tests.patch - valgrind-3.5.0-amd64-loopnel.patch - valgrind-3.5.0-ppc-dwarf3.patch - valgrind-3.5.0-amd64-adcsbb.patch - valgrind-3.5.0-syscalls.patch - valgrind-3.5.0-preadv.patch - valgrind-3.5.0-glibc-2.11.patch * Sun Apr 19 2009 Ryoichi INAGAKI 3.4.1-1vl5 - new upstream release - changed Group to Development/Tools * Sun Aug 24 2008 Shu KONNO 3.3.1-1vl5 - packaged new