`armv7l` ABI is incorrect when building with GCC ≥9
You can observe this with `julia build_tarballs.jl armv7l-linux-gnueabihf --debug=begin` with `preferred_gcc_version=v"8"`:
```console
sandbox:${WORKSPACE}/srcdir # printf '#include <ext/concurrence.h>\nint lp = __gnu_cxx::__default_lock_policy;\n' | c++ -x c++ -S -o - - | grep -A1 -E '^lp:'
.word 1
sandbox:${WORKSPACE}/srcdir # echo '#include <ext/concurrence.h>
static_assert(!__atomic_always_lock_free(2,0) || __gnu_cxx::__default_lock_policy==__gnu_cxx::_S_atomic,
"shared_ptr __default_lock_policy should be _S_atomic");' | c++ -std=c++17 -fsyntax-only -xc++ -
<stdin>:2:47: error: static assertion failed: shared_ptr __default_lock_policy should be _S_atomic
```
On GCC 8 and below, this shows `.word 2` and the assert passes, but on GCC 9 / 10 (probably higher, I did not test) it fails. Anyway the `__default_lock_policy` is mis-configured as `_S_mutex`, which makes `std::shared_ptr` (and probably many other things) ABI incompatible.
Claude 🤖 explains that we are missing `_GLIBCXX_HAVE_ATOMIC_LOCK_POLICY` in our libc++:
```console
sandbox:${WORKSPACE}/srcdir # for cfg in $(find /opt -name c++config.h 2>/dev/null); do echo "== $cfg =="; grep ATOMIC_LOCK_POLICY "$cfg" || echo "(undef)"; done
== /opt/arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/9.1.0/arm-linux-gnueabihf/bits/c++config.h ==
/* #undef _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY */
== /opt/x86_64-linux-musl/x86_64-linux-musl/include/c++/9.1.0/x86_64-linux-musl/bits/c++config.h ==
#define _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY 1
```
Apparently `armv7l` is being [built with `--with-arch=armv6`](https://github.com/JuliaPackaging/Yggdrasil/blob/62039c9e91b105d1fa20f13d3a8f78670cfb0250/0_RootFS/gcc_common.jl#L103-L105) which probably needs to be fixed.
This is one likely cause for https://github.com/JuliaLang/julia/issues/47345
3 条评论