perlPackages.HashSharedMem: fix build on aarch64-linux

The [(failing-)build log](https://hydra.nixos.org/build/219379873/nixlog/1)
has errors that look like: `undefined symbol: __aarch64_cas8_sync`.

This led me to find out about the newly-introduced `-moutline-atomics`,
which is **on by default** in GCC 10.1 (according to [this blog post](https://community.arm.com/arm-community-blogs/b/tools-software-ides-blog/posts/making-the-most-of-the-arm-architecture-in-gcc-10))
and in Clang 12.0.0 (according to [the release notes](https://releases.llvm.org/12.0.0/tools/clang/docs/ReleaseNotes.html))

Not all ARMv8-A processors support atomic stuff like `__aarch64_cas8_sync`,
it's only those that are ARMv8.1-A or later that do. Examples of
pre-ARMv8.1-A processors include the Cortex-A72 used in the
Raspberry Pi 4 (which is how I discovered this problem (I am running
`hydra` on it, which indirectly depends on `HashSharedMem`)),
and any older ARMv8-A processors.

The problem here is solvable either by linking the compiler runtime library
(which I did not try, since I don't know exactly which one to use)
*or* by simply not generating outlines for atomic operations.

I went with the "easier" path (which was also what was was happening
in older versions of GCC, I think) of disabling atomic outlines with
`-mno-outline-atomics`, and it works!
This commit is contained in:
Francis Couture-Harpin
2023-06-03 17:17:55 -04:00
parent fddbfa2159
commit 01e460d69e
+1
View File
@@ -10912,6 +10912,7 @@ with self; {
url = "mirror://cpan/authors/id/Z/ZE/ZEFRAM/Hash-SharedMem-0.005.tar.gz";
hash = "sha256-Mkd2gIYC973EStqpN4lTZUVAKakm+mEfMhyb9rlAu14=";
};
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isAarch64 "-mno-outline-atomics";
buildInputs = [ ScalarString ];
meta = {
description = "Efficient shared mutable hash";