pmaports/cross/gcc-armv7/0041-configure-fix-detection-of-atomic-builtins-in-libato.patch
Newbyte 5024719ca9
cross/gcc-*: upgrade to 11.2.1_git20211125 (MR 2706)
Upstream commit: c29fc97653

[ci:skip-build]: already built successfully in CI
2021-11-25 22:01:17 +01:00

57 lines
2.1 KiB
Diff

From abe5e7af0cb74a10adad65122f8a0c75c3f15615 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sun, 29 Aug 2021 09:45:27 +0200
Subject: [PATCH] configure: fix detection of atomic builtins in libatomic
configure script
Alpine's --enable-autolink-libatomic (which is enabled for riscv64 by
default) causes the libatomic configure script to incorrectly detect
which builtins are available on riscv64. This then causes incorrect code
generation for libatomic since it assumes compiler builtins to be
available which are not actually available on riscv64.
This commit fixes this issue by disabling linking of libatomic configure
test code entirely, thereby preventing linking against libatomic.
See:
* https://gitlab.alpinelinux.org/alpine/aports/-/issues/12948
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c6
---
libatomic/configure.tgt | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index 670b0d72cfe..38c2cd9345f 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -30,6 +30,26 @@
# on ${target_cpu}. For example to allow proper use of multilibs.
configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}"
+# The libatomic configure script performs several checks to determine
+# whether builtins for atomic operations are available. When compiling
+# with --enable-autolink-libatomic the test code compiled by the
+# configure script is also linked against libatomic. This causes it
+# to think that builtins are available, even if there are not, since
+# the tested symbols are provided by libatomic.
+#
+# This is a hack to ensure that we don't link against libatomic by not
+# linking any configure test code at all when --enable-autolink-libatomic
+# is given.
+#
+# See:
+#
+# * https://gitlab.alpinelinux.org/alpine/aports/-/issues/12817
+# * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101996#c4
+#
+if test x$enable_autolink_libatomic = xyes; then
+ gcc_no_link=yes
+fi
+
case "${target_cpu}" in
alpha*)
# fenv.c needs this option to generate inexact exceptions.
--
2.33.1