From afaa35c98c4a6c46cd3970ebda7843002ba2b5f1 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 27 Jun 2023 22:37:31 +0100 Subject: [PATCH] Patch for oneTBB (#2036372) Update FindTBB.cmake to look in the new version.h header. Fix the incorrect allocator used with tbb::concurrent_hash_map. Define a tbb_hash_compare specialization for std::pair to cope with the deprecated tbb_hasher function being removed. Adjust tbb_hash_compare specialization to account for TBB 2021.x defining it in a different namespace. --- dyninst.spec | 7 ++++- onetbb.patch | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 onetbb.patch diff --git a/dyninst.spec b/dyninst.spec index fc24e7f..72f03c7 100644 --- a/dyninst.spec +++ b/dyninst.spec @@ -2,7 +2,7 @@ Summary: An API for Run-time Code Generation License: LGPLv2+ Name: dyninst Group: Development/Libraries -Release: 4%{?dist} +Release: 5%{?dist} URL: http://www.dyninst.org Version: 12.2.0 ExclusiveArch: %{ix86} x86_64 ppc64le aarch64 @@ -14,6 +14,7 @@ Source1: https://github.com/dyninst/testsuite/archive/%{__testsuite_version}/tes Patch1: dwarf-error.patch Patch2: cmdline.patch Patch3: rhbz2173030.patch +Patch4: onetbb.patch %global dyninst_base dyninst-%{version} %global testsuite_base testsuite-%{__testsuite_version} @@ -91,6 +92,7 @@ popd pushd %{dyninst_base} %patch3 -p1 +%patch4 -p1 popd # cotire seems to cause non-deterministic gcc errors @@ -193,6 +195,9 @@ find %{buildroot}%{_libdir}/dyninst/testsuite/ \ %attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a %changelog +* Tue Jun 27 2023 Jonathan Wakely - 12.2.0-5 +- Patch for oneTBB (#2036372) + * Thu Feb 23 2023 Frank Ch. Eigler - 12.2.0-4 - rhbz2173030: ftbfs with gcc 13 diff --git a/onetbb.patch b/onetbb.patch new file mode 100644 index 0000000..87b72d0 --- /dev/null +++ b/onetbb.patch @@ -0,0 +1,89 @@ +--- dyninst-12.2.0/cmake/Modules/FindTBB.cmake~ 2023-06-27 22:52:25.396598265 +0100 ++++ dyninst-12.2.0/cmake/Modules/FindTBB.cmake 2023-06-27 22:52:27.776601825 +0100 +@@ -154,7 +154,8 @@ + if(TBB_INCLUDE_DIRS) + # Starting in 2020.1.1, tbb_stddef.h is replaced by version.h + set(_version_files "${TBB_INCLUDE_DIRS}/tbb/tbb_stddef.h" +- "${TBB_INCLUDE_DIRS}/tbb/version.h") ++ "${TBB_INCLUDE_DIRS}/tbb/version.h" ++ "${TBB_INCLUDE_DIRS}/oneapi/tbb/version.h") + foreach(f IN ITEMS ${_version_files}) + if(EXISTS ${f}) + set(_version_file ${f}) +--- dyninst-12.2.0/common/h/concurrent.h~ 2023-06-27 23:31:35.971166585 +0100 ++++ dyninst-12.2.0/common/h/concurrent.h 2023-06-27 23:32:31.889253848 +0100 +@@ -41,6 +41,22 @@ + #include + #include + ++#if __has_include() ++#include ++#if TBB_INTERFACE_VERSION_MAJOR >= 12 ++// oneTBB version of tbb_hash_compare doesn't work for std::pair. ++template ++struct tbb::tbb_hash_compare> { ++ static size_t hash(const std::pair& p) { ++ return tbb_hash_compare().hash(p.first) ^ tbb_hash_compare().hash(p.second); ++ } ++ static bool equal(const std::pair& p1, const std::pair& p2) { ++ return p1 == p2; ++ } ++}; ++#endif ++#endif ++ + namespace Dyninst { + + namespace dyn_c_annotations { +@@ -54,10 +70,10 @@ + + template + class dyn_c_hash_map : protected tbb::concurrent_hash_map, std::allocator>> { ++ tbb::tbb_hash_compare, std::allocator>> { + + typedef tbb::concurrent_hash_map, std::allocator>> base; ++ tbb::tbb_hash_compare, std::allocator>> base; + public: + using typename base::value_type; + using typename base::mapped_type; +--- dyninst-12.2.0/symtabAPI/src/dwarfWalker.h~ 2023-06-27 23:49:03.290956830 +0100 ++++ dyninst-12.2.0/symtabAPI/src/dwarfWalker.h 2023-06-28 09:12:36.672398326 +0100 +@@ -35,22 +35,20 @@ + } + } + +-namespace tbb { +- using namespace Dyninst::SymtabAPI; +- template<> +- struct tbb_hash_compare { +- static size_t hash(const type_key& k) { +- size_t seed = 0; +- boost::hash_combine(seed, k.off); +- boost::hash_combine(seed, k.file); +- boost::hash_combine(seed, static_cast(k.m)); +- return seed; +- } +- static bool equal(const type_key& k1, const type_key& k2) { +- return (k1.off==k2.off && k1.file==k2.file && k1.m==k2.m); +- } +- }; +-} ++template<> ++struct tbb::tbb_hash_compare { ++ using type_key = Dyninst::SymtabAPI::type_key; ++ static size_t hash(const type_key& k) { ++ size_t seed = 0; ++ boost::hash_combine(seed, k.off); ++ boost::hash_combine(seed, k.file); ++ boost::hash_combine(seed, static_cast(k.m)); ++ return seed; ++ } ++ static bool equal(const type_key& k1, const type_key& k2) { ++ return (k1.off==k2.off && k1.file==k2.file && k1.m==k2.m); ++ } ++}; + + namespace Dyninst { + namespace SymtabAPI {