diff options
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/configure.diff | 115 | ||||
-rw-r--r-- | debian/patches/cpu-frequency.diff | 54 | ||||
-rw-r--r-- | debian/patches/fix-hppa.diff | 26 | ||||
-rw-r--r-- | debian/patches/latomic.diff | 20 | ||||
-rw-r--r-- | debian/patches/nan-narrowing.diff | 25 | ||||
-rw-r--r-- | debian/patches/series | 6 | ||||
-rw-r--r-- | debian/patches/std-hash.diff | 46 |
7 files changed, 292 insertions, 0 deletions
diff --git a/debian/patches/configure.diff b/debian/patches/configure.diff new file mode 100644 index 00000000..5c47b152 --- /dev/null +++ b/debian/patches/configure.diff @@ -0,0 +1,115 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Set package configuration options +Forwarded: not-needed + +Configure Abseil for Debian. + + - Set the SONAME appropriately. + + - To minimize the possibility of future ABI breakage, treat absl::any, + absl::optional, absl::string_view, and absl::variant as their own types + (rather than aliases for the std:: versions), and compile everything in an + inline namespace. + + - Enable upstream's hardened build mode. + + - Disable Intel SSE2 on i386, since Debian supports some i386 processors + without that extension. Keep it enabled on amd64, since all amd64 processors + have it. + + - Disable Intel SSSE3 entirely, since no i386 processor supports it and Debian + supports amd64 processors without it. + +--- a/CMake/AbseilHelpers.cmake ++++ b/CMake/AbseilHelpers.cmake +@@ -217,6 +217,9 @@ + OUTPUT_NAME "absl_${_NAME}" + ) + endif() ++ ++ set_property(TARGET ${_NAME} PROPERTY SOVERSION 20200923) ++ set_property(TARGET ${_NAME} PROPERTY VERSION "20200923.0.1") + else() + # Generating header-only library + add_library(${_NAME} INTERFACE) +--- a/absl/base/options.h ++++ b/absl/base/options.h +@@ -100,7 +100,7 @@ + // User code should not inspect this macro. To check in the preprocessor if + // absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY. + +-#define ABSL_OPTION_USE_STD_ANY 2 ++#define ABSL_OPTION_USE_STD_ANY 0 + + + // ABSL_OPTION_USE_STD_OPTIONAL +@@ -127,7 +127,7 @@ + // absl::optional is a typedef of std::optional, use the feature macro + // ABSL_USES_STD_OPTIONAL. + +-#define ABSL_OPTION_USE_STD_OPTIONAL 2 ++#define ABSL_OPTION_USE_STD_OPTIONAL 0 + + + // ABSL_OPTION_USE_STD_STRING_VIEW +@@ -154,7 +154,7 @@ + // absl::string_view is a typedef of std::string_view, use the feature macro + // ABSL_USES_STD_STRING_VIEW. + +-#define ABSL_OPTION_USE_STD_STRING_VIEW 2 ++#define ABSL_OPTION_USE_STD_STRING_VIEW 0 + + // ABSL_OPTION_USE_STD_VARIANT + // +@@ -180,7 +180,7 @@ + // absl::variant is a typedef of std::variant, use the feature macro + // ABSL_USES_STD_VARIANT. + +-#define ABSL_OPTION_USE_STD_VARIANT 2 ++#define ABSL_OPTION_USE_STD_VARIANT 0 + + + // ABSL_OPTION_USE_INLINE_NAMESPACE +@@ -206,7 +206,7 @@ + // allowed. + + #define ABSL_OPTION_USE_INLINE_NAMESPACE 1 +-#define ABSL_OPTION_INLINE_NAMESPACE_NAME lts_2020_09_23 ++#define ABSL_OPTION_INLINE_NAMESPACE_NAME debian1 + + // ABSL_OPTION_HARDENED + // +@@ -233,6 +233,6 @@ + // checks enabled by this option may abort the program in a different way and + // log additional information when `NDEBUG` is not defined. + +-#define ABSL_OPTION_HARDENED 0 ++#define ABSL_OPTION_HARDENED 1 + + #endif // ABSL_BASE_OPTIONS_H_ +--- a/absl/container/internal/have_sse.h ++++ b/absl/container/internal/have_sse.h +@@ -17,22 +17,14 @@ + #define ABSL_CONTAINER_INTERNAL_HAVE_SSE_H_ + + #ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 +-#if defined(__SSE2__) || \ +- (defined(_MSC_VER) && \ +- (defined(_M_X64) || (defined(_M_IX86) && _M_IX86_FP >= 2))) ++#if defined(__x86_64__) || (defined(_MSC_VER) && defined(_M_X64)) + #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 1 + #else + #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 0 + #endif + #endif + +-#ifndef ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 +-#ifdef __SSSE3__ +-#define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 1 +-#else + #define ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 0 +-#endif +-#endif + + #if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSSE3 && \ + !ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2 diff --git a/debian/patches/cpu-frequency.diff b/debian/patches/cpu-frequency.diff new file mode 100644 index 00000000..adfba7e0 --- /dev/null +++ b/debian/patches/cpu-frequency.diff @@ -0,0 +1,54 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Ignore missing CPU frequency on more architectures +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1918ad2ae38aa32c74b558b322479a8efdd76363 + +Linux on MIPS, PA-RISC, RISC-V, and SystemZ doesn’t expose the nominal CPU +frequency via /sys, so don’t worry if `NominalCPUFrequency` returns 1.0 on those +platforms. + +Some POWER machines expose the CPU frequency; others do not. Since we can’t +predict which type of machine the tests will run on, simply disable testing for +`NominalCPUFrequency` on POWER. + +The author works at Google. Upstream applied this patch as Piper revision +347079873 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/absl/base/internal/sysinfo_test.cc ++++ b/absl/base/internal/sysinfo_test.cc +@@ -37,17 +37,28 @@ TEST(SysinfoTest, NumCPUs) { + << "NumCPUs() should not have the default value of 0"; + } + ++// Ensure that NominalCPUFrequency returns a reasonable value, or 1.00 on ++// platforms where the CPU frequency is not available through sysfs. ++// ++// POWER is particularly problematic here; some Linux kernels expose the CPU ++// frequency, while others do not. Since we can't predict a priori what a given ++// machine is going to do, just disable this test on POWER on Linux. ++#if !(defined(__linux) && (defined(__ppc64__) || defined(__PPC64__))) + TEST(SysinfoTest, NominalCPUFrequency) { +-#if !(defined(__aarch64__) && defined(__linux__)) && !defined(__EMSCRIPTEN__) +- EXPECT_GE(NominalCPUFrequency(), 1000.0) +- << "NominalCPUFrequency() did not return a reasonable value"; +-#else +- // Aarch64 cannot read the CPU frequency from sysfs, so we get back 1.0. +- // Emscripten does not have a sysfs to read from at all. ++ // Linux only exposes the CPU frequency on certain architectures, and ++ // Emscripten doesn't expose it at all. ++#if defined(__linux__) && \ ++ (defined(__aarch64__) || defined(__hppa__) || defined(__mips__) || \ ++ defined(__riscv) || defined(__s390x__)) || \ ++ defined(__EMSCRIPTEN__) + EXPECT_EQ(NominalCPUFrequency(), 1.0) + << "CPU frequency detection was fixed! Please update unittest."; ++#else ++ EXPECT_GE(NominalCPUFrequency(), 1000.0) ++ << "NominalCPUFrequency() did not return a reasonable value"; + #endif + } ++#endif + + TEST(SysinfoTest, GetTID) { + EXPECT_EQ(GetTID(), GetTID()); // Basic compile and equality test. diff --git a/debian/patches/fix-hppa.diff b/debian/patches/fix-hppa.diff new file mode 100644 index 00000000..915efff4 --- /dev/null +++ b/debian/patches/fix-hppa.diff @@ -0,0 +1,26 @@ +From: John David Anglin <dave.anglin@bell.net> +Subject: Fix build on hppa +Bug-Debian: https://bugs.debian.org/971768 +Reviewed-by: Benjamin Barenblat <bbaren@debian.org> + +--- a/absl/base/internal/direct_mmap.h ++++ b/absl/base/internal/direct_mmap.h +@@ -74,6 +74,7 @@ + inline void* DirectMmap(void* start, size_t length, int prot, int flags, int fd, + off64_t offset) noexcept { + #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || \ ++ (defined(__hppa__) && !defined(__LP64__)) || \ + (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) || \ + (defined(__PPC__) && !defined(__PPC64__)) || \ + (defined(__riscv) && __riscv_xlen == 32) || \ +--- a/absl/debugging/internal/examine_stack.cc ++++ b/absl/debugging/internal/examine_stack.cc +@@ -48,6 +48,8 @@ + return reinterpret_cast<void*>(context->uc_mcontext.pc); + #elif defined(__arm__) + return reinterpret_cast<void*>(context->uc_mcontext.arm_pc); ++#elif defined(__hppa__) ++ return reinterpret_cast<void*>(context->uc_mcontext.sc_iaoq[0]); + #elif defined(__i386__) + if (14 < ABSL_ARRAYSIZE(context->uc_mcontext.gregs)) + return reinterpret_cast<void*>(context->uc_mcontext.gregs[14]); diff --git a/debian/patches/latomic.diff b/debian/patches/latomic.diff new file mode 100644 index 00000000..d78c7469 --- /dev/null +++ b/debian/patches/latomic.diff @@ -0,0 +1,20 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Use libatomic if necessary +Bug-Debian: https://bugs.debian.org/973492 + +On some architectures, notably armel, Abseil needs symbols defined in +libatomic. Abseil does not currently have a well-developed system to +declare external library dependencies, so just have the linker determine +if anything needs libatomic and add the DT_NEEDED entry where necessary. + +--- a/absl/copts/AbseilConfigureCopts.cmake ++++ b/absl/copts/AbseilConfigureCopts.cmake +@@ -64,4 +64,8 @@ + set(ABSL_TEST_COPTS "") + endif() + ++list(APPEND ABSL_DEFAULT_LINKOPTS ++ "-Wl,--as-needed" "-latomic" "-Wl,--no-as-needed" ++) ++ + set(ABSL_CXX_STANDARD "${CMAKE_CXX_STANDARD}") diff --git a/debian/patches/nan-narrowing.diff b/debian/patches/nan-narrowing.diff new file mode 100644 index 00000000..c7ec9325 --- /dev/null +++ b/debian/patches/nan-narrowing.diff @@ -0,0 +1,25 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Avoid libgcc -NaN narrowing bug +Forwarded: yes +Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1bae23e32ba1f1af7c7d1488a69a351ec96dc98d + +When testing -NaN parsing, avoid narrowing -NaN from double to float. This +avoids a bug in libgcc (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98251). + +The author works at Google. Upstream applied this patch as Piper revision +347654751 and exported it to GitHub; the Applied-Upstream URL above points to +the exported commit. + +--- a/absl/strings/charconv_test.cc ++++ b/absl/strings/charconv_test.cc +@@ -653,7 +653,9 @@ TEST(FromChars, NaNFloats) { + negative_from_chars_float); + EXPECT_TRUE(std::signbit(negative_from_chars_float)); + EXPECT_FALSE(Identical(negative_from_chars_float, from_chars_float)); +- from_chars_float = std::copysign(from_chars_float, -1.0); ++ // Use the (float, float) overload of std::copysign to prevent narrowing; ++ // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98251. ++ from_chars_float = std::copysign(from_chars_float, -1.0f); + EXPECT_TRUE(Identical(negative_from_chars_float, from_chars_float)); + } + } diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..9c73d904 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,6 @@ +configure.diff +fix-hppa.diff +std-hash.diff +latomic.diff +cpu-frequency.diff +nan-narrowing.diff diff --git a/debian/patches/std-hash.diff b/debian/patches/std-hash.diff new file mode 100644 index 00000000..52096742 --- /dev/null +++ b/debian/patches/std-hash.diff @@ -0,0 +1,46 @@ +From: Benjamin Barenblat <bbaren@google.com> +Subject: Work around broken std::hash on s390x +Forwarded: no +Bug-Debian: https://bugs.debian.org/977638 + +On s390x, std::hash hashes large classes of data to the same value, which +violates assumptions made by the Abseil tests. #ifdef out the test code that +depends on those assumptions. + +--- a/absl/hash/hash_test.cc ++++ b/absl/hash/hash_test.cc +@@ -358,6 +358,8 @@ + TEST(HashValueTest, StdBitset) { + EXPECT_TRUE((is_hashable<std::bitset<257>>::value)); + ++ // The following assertions fail on s390x (https://bugs.debian.org/977638). ++#ifndef __s390x__ + EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly( + {std::bitset<2>("00"), std::bitset<2>("01"), std::bitset<2>("10"), + std::bitset<2>("11")})); +@@ -379,6 +381,7 @@ + std::bitset<kNumBits>(bit_strings[3].c_str()), + std::bitset<kNumBits>(bit_strings[4].c_str()), + std::bitset<kNumBits>(bit_strings[5].c_str())})); ++#endif + } // namespace + + template <typename T> +@@ -400,10 +403,15 @@ + } + + REGISTER_TYPED_TEST_CASE_P(HashValueSequenceTest, BasicUsage); ++// std::vector<bool> tests fail on s390x, so exclude them. See ++// https://bugs.debian.org/977638. + using IntSequenceTypes = + testing::Types<std::deque<int>, std::forward_list<int>, std::list<int>, +- std::vector<int>, std::vector<bool>, std::set<int>, +- std::multiset<int>>; ++ std::vector<int>, ++#ifndef __s390x__ ++ std::vector<bool>, ++#endif ++ std::set<int>, std::multiset<int>>; + INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueSequenceTest, IntSequenceTypes); + + // Private type that only supports AbslHashValue to make sure our chosen hash |