Skip to content
Snippets Groups Projects
Commit 0a568a04 authored by Roman Shaposhnik's avatar Roman Shaposhnik Committed by Ariadne Conill
Browse files

Accounting for gcc requiring explicit -latomic in bootstrap.sh


On some architectures rograms which use C11 or C++11 atomics,
like #include <atomic>, generally must link against -latomic
explicitly.

For now the check is only against riscv64, but the list may grow.

Signed-off-by: default avatarRoman Shaposhnik <rvs@zededa.com>
parent 3ca28d71
No related branches found
No related tags found
1 merge request!21622Updating bootstrap.sh based on riscv64 port
Pipeline #83624 passed
...@@ -94,6 +94,16 @@ msg "Cross building base system" ...@@ -94,6 +94,16 @@ msg "Cross building base system"
# Implicit dependencies for early targets # Implicit dependencies for early targets
EXTRADEPENDS_TARGET="libgcc libstdc++ musl-dev" EXTRADEPENDS_TARGET="libgcc libstdc++ musl-dev"
# On a few architectures like riscv64 we need to account for
# gcc requiring -ltomic to be set explicitly if a C[++]11 program
# uses atomics (e.g. #include <atomic>):
# https://github.com/riscv/riscv-gnu-toolchain/issues/183#issuecomment-253721765
# The reason gcc itself is needed is because .so is in that package,
# not in libatomic.
if [ "$TARGET_ARCH" = "riscv64" ]; then
NEEDS_LIBATOMIC="yes"
fi
# ordered cross-build # ordered cross-build
for PKG in fortify-headers linux-headers musl libc-dev pkgconf zlib \ for PKG in fortify-headers linux-headers musl libc-dev pkgconf zlib \
openssl ca-certificates libmd \ openssl ca-certificates libmd \
...@@ -111,7 +121,10 @@ for PKG in fortify-headers linux-headers musl libc-dev pkgconf zlib \ ...@@ -111,7 +121,10 @@ for PKG in fortify-headers linux-headers musl libc-dev pkgconf zlib \
libxml2 pax-utils llvm11 community/rust \ libxml2 pax-utils llvm11 community/rust \
$KERNEL_PKG ; do $KERNEL_PKG ; do
EXTRADEPENDS_TARGET="$EXTRADEPENDS_TARGET" \ if [ "$NEEDS_LIBATOMIC" = "yes" ]; then
EXTRADEPENDS_BUILD="libatomic gcc-$TARGET_ARCH g++-$TARGET_ARCH"
fi
EXTRADEPENDS_TARGET="$EXTRADEPENDS_TARGET" EXTRADEPENDS_BUILD="$EXTRADEPENDS_BUILD" \
CHOST=$TARGET_ARCH BOOTSTRAP=bootimage APKBUILD=$(apkbuildname $PKG) abuild -r CHOST=$TARGET_ARCH BOOTSTRAP=bootimage APKBUILD=$(apkbuildname $PKG) abuild -r
case "$PKG" in case "$PKG" in
...@@ -119,6 +132,11 @@ for PKG in fortify-headers linux-headers musl libc-dev pkgconf zlib \ ...@@ -119,6 +132,11 @@ for PKG in fortify-headers linux-headers musl libc-dev pkgconf zlib \
# Additional implicit dependencies once built # Additional implicit dependencies once built
EXTRADEPENDS_TARGET="$EXTRADEPENDS_TARGET $PKG" EXTRADEPENDS_TARGET="$EXTRADEPENDS_TARGET $PKG"
;; ;;
gcc)
if [ "$NEEDS_LIBATOMIC" = "yes" ]; then
EXTRADEPENDS_TARGET="libatomic gcc $EXTRADEPENDS_TARGET"
fi
;;
build-base) build-base)
# After build-base, that alone is sufficient dependency in the target # After build-base, that alone is sufficient dependency in the target
EXTRADEPENDS_TARGET="busybox $PKG" EXTRADEPENDS_TARGET="busybox $PKG"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment