abseil.git
3 years agoFix hashing on big endian platforms (#1028)
Milad Fa [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Fix hashing on big endian platforms (#1028)

Forwarded: https://github.com/abseil/abseil-cpp/pull/1028
Origin: backport, https://github.com/abseil/abseil-cpp/commit/ae0f4c266095c9003786cd571bc1fb72544104a1
Bug-Debian: https://bugs.debian.org/977638

Avoid using libstdc++'s implementation of std::hash<std::bitset> and
std::hash<std::vector> on big endian platforms in the implementation
of absl::Hash.

This is a workaround for a buggy implementation that results in many
collisions.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102531
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98731

Gbp-Pq: Name big-endian-hash2.diff

3 years agoRestructure wyhash_test.cc to separate golden values
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Restructure wyhash_test.cc to separate golden values

Forwarded: yes
Origin: backport, https://github.com/abseil/abseil-cpp/commit/a05366d851c5cb88065272f951e03955197e7c11

This patch is a subset of the referenced commit, which originally also changed
the mix function on arm64. The original message is as follows:

    Alternative bit mixer for LowLevelHash on ARM

    LowLevelHash's bit-mixer is inefficient on ARM because it calculates
    a 128-bit product of two 64-bit numbers. On ARM, this requires a
    sequence of two instructions with a high combined latency and poor
    throughput. This change provides alternative bit-mixing code for ARM
    that uses only 64-bit arithmetic (multiplication, xor, and
    left-shifts) and speeds things up considerably.

    The bit-mixing code for ARM was inspired by by Woothash[1] and
    xxh3[1]. Once I landed on a sequence of operations that provided
    good mixing, I used a test harness to search for the combination of
    shift / rotate factors that provided the best mixing, as indicated
    by SMHasher hash quality tests. The new mixing code passes 13 out of
    15 of the hash quality test suites in SMHasher, with the two
    failures being in the noise range: e.g. 1 collision vs. zero
    expected in a keyset of ~8m keys.

          [1]: https://github.com/tommyettinger/waterhash/blob/49f5cf0b63b9/woothash.h#L16-L20
          [2]: https://github.com/Cyan4973/xxHash/blob/6853ddc36e46/xxhash.h#L3240-L3265

    PiperOrigin-RevId: 391833008

This restructuring is a prerequisite for big-endian-hash2.diff.

Gbp-Pq: Name big-endian-hash.diff

3 years agoRound a double multiplication before casting it to integer
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Round a double multiplication before casting it to integer

Forwarded: yes
Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/60be12ed9822078970f05f3c560324184302df6b

The code

    static_cast<int>(x * y)

(for double x and y) performs a double multiplication into a temporary
that, by standard, may have excess precision. The subsequent cast to int
discards the excess precision. However, the cast may examine the excess
precision during conversion, producing surprising results like

    static_cast<int>(1.7 * 10) == 16

on certain systems. Correct this case by explicitly rounding 1.7 * 10
before casting it.

The author works at Google. Upstream applied this patch as Piper
revision 378922064 and exported it to GitHub; the Applied-Upstream URL
above points to the exported commit.

Gbp-Pq: Name missing-rint.diff

3 years agoSkip floating-point edge-case tests when using an x87
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Skip floating-point edge-case tests when using an x87

Forwarded: yes
Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/311bbd2e50ea35e921a08186840d3b6ca279e880

32-bit Intel CPUs use 80-bit floats for intermediate values, which can
change the results of floating point computations from what we normally
expect. Identify tests that are sensitive to the x87, and skip them when
we’re on 32-bit Intel.

The author works at Google. Upstream applied this patch as Piper
revision 378722613 and exported it to GitHub; the Applied-Upstream URL
above points to the exported commit.

Gbp-Pq: Name float-tests-disable-i386.diff

3 years agoDon’t examine irrelevant destination buckets in DiscreteDistributionTest
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Don’t examine irrelevant destination buckets in DiscreteDistributionTest

Forwarded: yes
Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/7ba826e50dff1878e6ecc6b9af44097c040c8968

Abseil generates discrete distributions using Walker’s aliasing
algorithm. This creates uniformly distributed buckets, each with a
probability of sending traffic to a different bucket. Abseil represents
a bucket as a pair

    (probability of retaining traffic ×
     alternate bucket if traffic is passed)

and a distribution as a vector of such pairs. For example, {(0.3, 1),
(1.0, 1)} represents a distribution with two buckets, the zeroth of
which passes 70% of its traffic to bucket 1 and the first of which holds
on to all its traffic.

This representation is not unique: When a bucket retains traffic with
probability 1, the alternate bucket is irrelevant. Continuing the
example above, {(0.3, 1), (1.0, 0)} _also_ represents a two-bucket
distribution where the zeroth bucket passes 70% of its traffic to the
first and the first hangs on to all traffic. Exactly what representation
Abseil generates for a given input is related to how much precision is
used in intermediate floating-point operations, which is an
architectural implementation detail. Remove sensitivity to that detail
by not examining the alternate bucket when the retention probability is
1.0.

The author works at Google. Upstream applied this patch as Piper
revision 372993410 and exported it to GitHub; the Applied-Upstream URL
above points to the exported commit.

Gbp-Pq: Name DiscreteDistributionTest-irrelevant-destination-buckets.diff

3 years agoRound floats using round(x), not static_cast<int>(x + 0.5)
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Round floats using round(x), not static_cast<int>(x + 0.5)

Forwarded: yes
Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/d96e287417766deddbff2d01b96321288c59491e

Adding 0.5 to an IEEE float may cause one bit of precision loss, which
is enough to change the result in certain cases. For example,

    static_cast<int>(std::round(0.49999999999999994)) == 0
    static_cast<int>(0.49999999999999994 + 0.5) == 1

The author works at Google. Upstream applied this patch as Piper
revision 369926519 and exported it to GitHub; the Applied-Upstream URL
above points to the exported commit.

Gbp-Pq: Name float-rounding.diff

3 years agoCorrect Thumb function bound computation in the symbolizer
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Correct Thumb function bound computation in the symbolizer

Forwarded: yes
Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/1ae9b71c474628d60eb251a3f62967fe64151bb2

On 32-bit ARM, all functions are aligned to multiples of two bytes, and
the lowest-order bit in a function’s address is ignored by the CPU when
computing branch targets. That bit is still present in instructions and
ELF symbol tables, though; it’s repurposed to indicate whether the
function contains ARM or Thumb code. If the symbolizer doesn’t ignore
that bit, it will believe Thumb functions have boundaries that are off
by one byte, so instruct the symbolizer to null out the lowest-order bit
after retrieving it from the symbol table.

The author works at Google. Upstream applied this patch as Piper
revision 369254082 and exported it to GitHub; the Applied-Upstream URL
above points to the exported commit.

Gbp-Pq: Name thumb-function-bounds.diff

3 years agoFix typo in CordRepRing error message
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Fix typo in CordRepRing error message

Forwarded: yes
Applied-Upstream: https://github.com/abseil/abseil-cpp/commit/b97a1ecda869ca8754d467a56c50275cebfeb328

The author works at Google. Upstream applied this patch as Piper
revision 367481280 and exported it to GitHub; the Applied-Upstream URL
above points to the exported commit.

Gbp-Pq: Name cordrepring-typo.diff

3 years agoEliminate libabsl_flags.so and libabsl_flags.a
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Eliminate libabsl_flags.so and libabsl_flags.a

Forwarded: not-needed

The libabsl_flags library only contains code when compiling with MSVC, which
Debian doesn't use. Skip compiling absl/flags/flag.cc, and make the Abseil flags
library header-only.

Gbp-Pq: Name empty-flags-library.diff

3 years agoDisable SysinfoTest.NominalCPUFrequency on armel/armhf
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Disable SysinfoTest.NominalCPUFrequency on armel/armhf

NominalCPUFrequency has different behavior on 32-bit and 64-bit ARM
kernels. The Debian arm64 buildds assume they can build 32-bit ARM
packages, but if they do, the NominalCPUFrequency test will fail.
Disable the test when building for 32-bit ARM.

Gbp-Pq: Name arm-multiarch.diff

3 years agoUse libatomic if necessary
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
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.

Gbp-Pq: Name latomic.diff

3 years agoSet package configuration options
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
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.

Gbp-Pq: Name configure.diff

3 years agoabseil (0~20210324.2-2) unstable; urgency=medium
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
abseil (0~20210324.2-2) unstable; urgency=medium

  * Disable a test that doesn’t play well with multiarch on armel and
    armhf.

[dgit import unpatched abseil 0~20210324.2-2]

3 years agoImport abseil_0~20210324.2-2.debian.tar.xz
Benjamin Barenblat [Mon, 7 Feb 2022 16:54:21 +0000 (16:54 +0000)]
Import abseil_0~20210324.2-2.debian.tar.xz

[dgit import tarball abseil 0~20210324.2-2 abseil_0~20210324.2-2.debian.tar.xz]

3 years agoImport abseil_0~20210324.2.orig.tar.gz
Benjamin Barenblat [Fri, 4 Feb 2022 18:11:32 +0000 (18:11 +0000)]
Import abseil_0~20210324.2.orig.tar.gz

[dgit import orig abseil_0~20210324.2.orig.tar.gz]