Skip to content

Commit a93c2b7

Browse files
Merge #987
987: Link to libgcc for `armv5te-unknown-linux-musleabi` target. r=Emilgardis a=Alexhuszagh Fixes missing sync builtins required for libraries such as OpenSSL, specifically, the `__sync_X_and_fetch` builtins. Closes #367. Improves documentation related to #906. Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
2 parents 7b04b6d + 44184ec commit a93c2b7

File tree

6 files changed

+51
-24
lines changed

6 files changed

+51
-24
lines changed

.changes/987.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "fixed",
3+
"description": "link to libgcc for `armv5te-unknown-linux-musleabi` to fix missing `__sync_X_and_fetch` builtins.",
4+
"issues": [367]
5+
}

docker/Dockerfile.mips64-unknown-linux-muslabi64

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ ENV CROSS_MUSL_SYSROOT=/usr/local/mips64-linux-musl
2121
COPY musl-symlink.sh /
2222
RUN /musl-symlink.sh $CROSS_MUSL_SYSROOT mips64
2323
RUN mkdir -p $CROSS_MUSL_SYSROOT/usr/lib64
24-
# needed for the C/C++ runner
24+
# needed for the C/C++ runners
2525
RUN ln -s $CROSS_MUSL_SYSROOT/usr/lib/libc.so $CROSS_MUSL_SYSROOT/usr/lib64/libc.so
2626
RUN ln -s $CROSS_MUSL_SYSROOT/usr/lib/libc.so.1 $CROSS_MUSL_SYSROOT/usr/lib64/libc.so.1
2727

28-
COPY mips64-linux-muslabi64-gcc.sh /usr/bin/
28+
COPY mips64-linux-musl-gcc.sh /usr/bin/
2929

3030
COPY qemu-runner base-runner.sh /
3131

32-
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_MUSLABI64_LINKER=mips64-linux-muslabi64-gcc.sh \
32+
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_MUSLABI64_LINKER=mips64-linux-musl-gcc.sh \
3333
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_MUSLABI64_RUNNER="/qemu-runner mips64" \
3434
CC_mips64_unknown_linux_muslabi64=mips64-linux-musl-gcc \
3535
CXX_mips64_unknown_linux_muslabi64=mips64-linux-musl-g++ \

docker/aarch64-linux-musl-gcc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ main() {
1414
local minor=
1515
minor=$(echo "$release" | cut -d '.' -f2)
1616

17-
if (( minor >= 48 )); then
17+
if (( minor >= 48 )) || [[ $# -eq 0 ]]; then
1818
# no workaround
19-
aarch64-linux-musl-gcc "${@}"
19+
exec aarch64-linux-musl-gcc "${@}"
2020
else
2121
# apply workaround
22-
aarch64-linux-musl-gcc "${@}" -lgcc
22+
exec aarch64-linux-musl-gcc "${@}" -lgcc -static-libgcc
2323
fi
2424
}
2525

docker/arm-linux-musleabi-gcc.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# this linker wrapper works around the missing sync `sync_X_and_fetch`
4+
# routines. this affects rust versions with compiler-builtins <= 0.1.77,
5+
# which has not yet been merged into stable. this requires the `-lgcc`
6+
# linker flag to provide the missing builtin.
7+
# https://github.com/rust-lang/compiler-builtins/pull/484
8+
9+
set -x
10+
set -euo pipefail
11+
12+
main() {
13+
if [[ $# -eq 0 ]]; then
14+
exec arm-linux-musleabi-gcc "${@}"
15+
else
16+
exec arm-linux-musleabi-gcc "${@}" -lgcc -static-libgcc
17+
fi
18+
}
19+
20+
main "${@}"

docker/mips64-linux-musl-gcc.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# this linker wrapper works around the missing soft-fp routine __trunctfsf2
4+
# this affects rust versions with compiler-builtins <= 0.1.77,
5+
# which has not yet been merged into stable. this requires the `-lgcc`
6+
# linker flag to provide the missing builtin.
7+
# https://github.com/rust-lang/compiler-builtins/pull/483
8+
9+
set -x
10+
set -euo pipefail
11+
12+
main() {
13+
if [[ $# -eq 0 ]]; then
14+
exec mips64-linux-musl-gcc "${@}"
15+
else
16+
exec mips64-linux-musl-gcc "${@}" -lgcc -static-libgcc
17+
fi
18+
}
19+
20+
main "${@}"

docker/mips64-linux-muslabi64-gcc.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)