From a08b66ecf3a7df7da2c92f41b220fbce4f73d5f4 Mon Sep 17 00:00:00 2001 From: Funda Wang Date: Mon, 14 Oct 2024 08:47:02 +0800 Subject: [PATCH] Use package's own lto option instead of hardcode LTO flags --- Add-AArch64-clang-longjmp-support.patch | 3 +-- Add-LOONGARCH64-Linux-support.patch | 4 ++-- valgrind.spec | 25 +++++++++++++++++-------- valgrind.yaml | 4 ++-- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Add-AArch64-clang-longjmp-support.patch b/Add-AArch64-clang-longjmp-support.patch index c39f9c1..3627aa6 100644 --- a/Add-AArch64-clang-longjmp-support.patch +++ b/Add-AArch64-clang-longjmp-support.patch @@ -2,7 +2,7 @@ diff --git a/include/pub_tool_libcsetjmp.h b/include/pub_tool_libcsetjmp.h index 681450cef..ccdf295df 100644 --- a/include/pub_tool_libcsetjmp.h +++ b/include/pub_tool_libcsetjmp.h -@@ -126,6 +126,111 @@ UWord VG_MINIMAL_SETJMP(VG_MINIMAL_JMP_BUF(_env)); +@@ -134,6 +134,111 @@ __attribute__((noreturn)) void VG_MINIMAL_LONGJMP(VG_MINIMAL_JMP_BUF(_env)); @@ -114,4 +114,3 @@ index 681450cef..ccdf295df 100644 #else /* The default implementation. */ - -- \ No newline at end of file diff --git a/Add-LOONGARCH64-Linux-support.patch b/Add-LOONGARCH64-Linux-support.patch index 9c30267..506aa58 100644 --- a/Add-LOONGARCH64-Linux-support.patch +++ b/Add-LOONGARCH64-Linux-support.patch @@ -30637,8 +30637,8 @@ index a3a386f..69bed7c 100644 --- a/include/pub_tool_libcsetjmp.h +++ b/include/pub_tool_libcsetjmp.h @@ -134,6 +134,14 @@ UWord VG_MINIMAL_SETJMP(VG_MINIMAL_JMP_BUF(_env)); - __attribute__((noreturn)) - void VG_MINIMAL_LONGJMP(VG_MINIMAL_JMP_BUF(_env)); + __builtin_unreachable(); + } +#elif defined(VGP_loongarch64_linux) + diff --git a/valgrind.spec b/valgrind.spec index a125871..2cddfb0 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -1,3 +1,7 @@ +# LTO triggers undefined symbols in valgrind. But valgrind has a +# --enable-lto configure time option that we will use instead. +%define _lto_cflags %{nil} + %ifarch %{ix86} %define arch_val x86 %define arch_old_val %{nil} @@ -21,18 +25,16 @@ Name: valgrind Version: 3.22.0 -Release: 2 +Release: 3 Epoch: 1 Summary: An instrumentation framework for building dynamic analysis tools -License: GPLv2+ -URL: http://www.valgrind.org/ +License: GPL-2.0-or-later +URL: https://www.valgrind.org/ Source0: https://sourceware.org/pub/%{name}/%{name}-%{version}.tar.bz2 Patch1: valgrind-3.9.0-cachegrind-improvements.patch Patch2: valgrind-3.9.0-ldso-supp.patch -%if "%{toolchain}" == "clang" Patch3: Add-AArch64-clang-longjmp-support.patch -%endif # Add LOONGARCH64 support Patch4: Add-LOONGARCH64-Linux-support.patch # valgrind-monitor.py regular expressions should use raw strings @@ -47,6 +49,7 @@ Patch7: valgrind-3.22.0-fchmodat2.patch BuildRequires: glibc glibc-devel gdb procps gcc-c++ perl(Getopt::Long) BuildRequires: automake autoconf +ExclusiveArch: %{ix86} x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64 loongarch64 %description Valgrind is an instrumentation framework for building dynamic analysis tools. There are @@ -79,10 +82,12 @@ CC="%{__cc} -B `pwd`/shared/libgcc/" %undefine _hardened_build %undefine _strict_symbol_defs_build -optflags="`echo " %{optflags} -Wl,-z,now -fPIE -fPIC"`" +optflags="`echo " %{optflags} -fPIE -fPIC"`" 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=/bin/false GDB=%{_bindir}/gdb +LDFLAGS="`echo " %{build_ldflags} " | sed 's/ -Wl,-z,now / / g;'`" + +%configure CC="$CC" CFLAGS="$OPTFLAGS" CXXFLAGS="$OPTFLAGS" LDFLAGS="$LDFLAGS" --with-mpicc=/bin/false GDB=%{_bindir}/gdb --enable-lto %make_build %install @@ -104,7 +109,8 @@ rm -rf config.h libvex*h pub_tool_*h vki/ popd %files -%license COPYING AUTHORS +%license COPYING +%doc AUTHORS %doc %{_datadir}/doc/%{name}/{html,*.pdf} %exclude %{_datadir}/doc/%{name}/*.ps %{_bindir}/* @@ -124,6 +130,9 @@ popd %{_mandir}/man1/* %changelog +* Sun Oct 06 2024 Funda Wang - 1:3.22.0-3 +- Use package's own lto option instead of hardcode LTO flags + * Mon Jan 22 2024 peng.zou - 1:3.22.0-2 - Add ppc64le support diff --git a/valgrind.yaml b/valgrind.yaml index 37e54de..0884add 100644 --- a/valgrind.yaml +++ b/valgrind.yaml @@ -1,4 +1,4 @@ version_control: git -src_repo: https://sourceware.org/git/?p=valgrind.git +src_repo: https://sourceware.org/git/valgrind.git tag_prefix: ^VALGRIND_ -seperator: _ +separator: _ -- Gitee