diff --git a/cross/gcc-aarch64/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch b/cross/gcc-aarch64/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch new file mode 100644 index 000000000..2063f441a --- /dev/null +++ b/cross/gcc-aarch64/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch @@ -0,0 +1,54 @@ +From d046a3d12daeada0fb0f44beb201057d85af4a2c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +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 5dd0926d207..0b57a801e23 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. diff --git a/cross/gcc-aarch64/APKBUILD b/cross/gcc-aarch64/APKBUILD index 963da6dfc..ed5f19f21 100644 --- a/cross/gcc-aarch64/APKBUILD +++ b/cross/gcc-aarch64/APKBUILD @@ -31,7 +31,7 @@ pkgver=10.3.1_git20210625 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname=gcc-aarch64 -pkgrel=0 +pkgrel=1 pkgdesc="Stage2 cross-compiler for aarch64" url="https://gcc.gnu.org" arch="x86_64" @@ -235,6 +235,7 @@ source="https://dev.alpinelinux.org/~nenolod/gcc-${pkgver}.tar.xz 0039-CRuntime_Musl-Support-v1.2.0-for-32-bits.patch 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 0041-Use-generic-errstr.go-implementation-on-musl.patch + 0042-configure-fix-detection-of-atomic-builtins-in-libato.patch " # we build out-of-tree @@ -722,4 +723,5 @@ b92ea62f8ffc7471dabbc8a6f770fc141702d4900f6eb4808a8b0c46042434617185366d93b49122 1f54ea2ed780964da3238bd98b63719d68585ac97bd312211797dabec3fc7c54b60af9f7ffc490355c898ed42c0a2745e6486bfc0577b9adee88ee1fb35bf2d1 0039-CRuntime_Musl-Support-v1.2.0-for-32-bits.patch 7e02eaf9e0261a2942cbc4db626cc6d67955bdfdc9036d505f1e3a4b3fa03993de403b58173137ca98db3365df28db234bf70ae76a74a463c39887a40780c2a7 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 99ecfd0beeb8dfcd95ef84b3ad8fb43402edb87ac6b0591c7a8bd986b9e163e1b8ce2c5773ee3cbf1264dc40912b7312f450e6dde4ab8a6cf28b02541de7ce84 0041-Use-generic-errstr.go-implementation-on-musl.patch +b02237276f70e09c56d3826232076c1b5a7b23e47fb8f896edf50c85b9dae7dde6800b2bd7d153777c60845bef2390c6a99526fd86167b156a69a71e61c5d133 0042-configure-fix-detection-of-atomic-builtins-in-libato.patch " diff --git a/cross/gcc-armhf/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch b/cross/gcc-armhf/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch new file mode 100644 index 000000000..2063f441a --- /dev/null +++ b/cross/gcc-armhf/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch @@ -0,0 +1,54 @@ +From d046a3d12daeada0fb0f44beb201057d85af4a2c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +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 5dd0926d207..0b57a801e23 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. diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD index 4241526ff..8cab915f2 100644 --- a/cross/gcc-armhf/APKBUILD +++ b/cross/gcc-armhf/APKBUILD @@ -31,7 +31,7 @@ pkgver=10.3.1_git20210625 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname=gcc-armhf -pkgrel=0 +pkgrel=1 pkgdesc="Stage2 cross-compiler for armhf" url="https://gcc.gnu.org" arch="x86_64" @@ -235,6 +235,7 @@ source="https://dev.alpinelinux.org/~nenolod/gcc-${pkgver}.tar.xz 0039-CRuntime_Musl-Support-v1.2.0-for-32-bits.patch 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 0041-Use-generic-errstr.go-implementation-on-musl.patch + 0042-configure-fix-detection-of-atomic-builtins-in-libato.patch " # we build out-of-tree @@ -722,4 +723,5 @@ b92ea62f8ffc7471dabbc8a6f770fc141702d4900f6eb4808a8b0c46042434617185366d93b49122 1f54ea2ed780964da3238bd98b63719d68585ac97bd312211797dabec3fc7c54b60af9f7ffc490355c898ed42c0a2745e6486bfc0577b9adee88ee1fb35bf2d1 0039-CRuntime_Musl-Support-v1.2.0-for-32-bits.patch 7e02eaf9e0261a2942cbc4db626cc6d67955bdfdc9036d505f1e3a4b3fa03993de403b58173137ca98db3365df28db234bf70ae76a74a463c39887a40780c2a7 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 99ecfd0beeb8dfcd95ef84b3ad8fb43402edb87ac6b0591c7a8bd986b9e163e1b8ce2c5773ee3cbf1264dc40912b7312f450e6dde4ab8a6cf28b02541de7ce84 0041-Use-generic-errstr.go-implementation-on-musl.patch +b02237276f70e09c56d3826232076c1b5a7b23e47fb8f896edf50c85b9dae7dde6800b2bd7d153777c60845bef2390c6a99526fd86167b156a69a71e61c5d133 0042-configure-fix-detection-of-atomic-builtins-in-libato.patch " diff --git a/cross/gcc-armv7/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch b/cross/gcc-armv7/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch new file mode 100644 index 000000000..2063f441a --- /dev/null +++ b/cross/gcc-armv7/0042-configure-fix-detection-of-atomic-builtins-in-libato.patch @@ -0,0 +1,54 @@ +From d046a3d12daeada0fb0f44beb201057d85af4a2c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +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 5dd0926d207..0b57a801e23 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. diff --git a/cross/gcc-armv7/APKBUILD b/cross/gcc-armv7/APKBUILD index 180a74ad7..a1d0ad6a8 100644 --- a/cross/gcc-armv7/APKBUILD +++ b/cross/gcc-armv7/APKBUILD @@ -31,7 +31,7 @@ pkgver=10.3.1_git20210625 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target="" pkgname=gcc-armv7 -pkgrel=0 +pkgrel=1 pkgdesc="Stage2 cross-compiler for armv7" url="https://gcc.gnu.org" arch="x86_64" @@ -235,6 +235,7 @@ source="https://dev.alpinelinux.org/~nenolod/gcc-${pkgver}.tar.xz 0039-CRuntime_Musl-Support-v1.2.0-for-32-bits.patch 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 0041-Use-generic-errstr.go-implementation-on-musl.patch + 0042-configure-fix-detection-of-atomic-builtins-in-libato.patch " # we build out-of-tree @@ -722,4 +723,5 @@ b92ea62f8ffc7471dabbc8a6f770fc141702d4900f6eb4808a8b0c46042434617185366d93b49122 1f54ea2ed780964da3238bd98b63719d68585ac97bd312211797dabec3fc7c54b60af9f7ffc490355c898ed42c0a2745e6486bfc0577b9adee88ee1fb35bf2d1 0039-CRuntime_Musl-Support-v1.2.0-for-32-bits.patch 7e02eaf9e0261a2942cbc4db626cc6d67955bdfdc9036d505f1e3a4b3fa03993de403b58173137ca98db3365df28db234bf70ae76a74a463c39887a40780c2a7 0040-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch 99ecfd0beeb8dfcd95ef84b3ad8fb43402edb87ac6b0591c7a8bd986b9e163e1b8ce2c5773ee3cbf1264dc40912b7312f450e6dde4ab8a6cf28b02541de7ce84 0041-Use-generic-errstr.go-implementation-on-musl.patch +b02237276f70e09c56d3826232076c1b5a7b23e47fb8f896edf50c85b9dae7dde6800b2bd7d153777c60845bef2390c6a99526fd86167b156a69a71e61c5d133 0042-configure-fix-detection-of-atomic-builtins-in-libato.patch "