Skip to content

Commit 00b5413

Browse files
committed
ci: use musl shared script in dist-i586-gnu-i686-musl
1 parent 10a7591 commit 00b5413

File tree

4 files changed

+41
-73
lines changed

4 files changed

+41
-73
lines changed

src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1717
pkg-config
1818

1919
WORKDIR /build/
20-
COPY dist-i586-gnu-i686-musl/musl-libunwind-patch.patch dist-i586-gnu-i686-musl/build-musl.sh /build/
21-
RUN sh /build/build-musl.sh && rm -rf /build
20+
COPY scripts/musl.sh /build/
21+
RUN CC=gcc CFLAGS="-m32 -fPIC -Wa,-mrelax-relocations=no" \
22+
CXX=g++ CXXFLAGS="-m32 -Wa,-mrelax-relocations=no" \
23+
bash musl.sh i686 --target=i686 && \
24+
rm -rf /build
2225

2326
COPY scripts/sccache.sh /scripts/
2427
RUN sh /scripts/sccache.sh

src/ci/docker/dist-i586-gnu-i686-musl/build-musl.sh

-55
This file was deleted.

src/ci/docker/dist-i586-gnu-i686-musl/musl-libunwind-patch.patch

-15
This file was deleted.

src/ci/docker/scripts/musl.sh

+36-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ fi
3939

4040
cd $MUSL
4141
./configure --disable-shared --prefix=/musl-$TAG $@
42-
hide_output make -j$(nproc)
42+
if [ "$TAG" = "i686" ]; then
43+
hide_output make -j$(nproc) AR=ar RANLIB=ranlib
44+
else
45+
hide_output make -j$(nproc)
46+
fi
4347
hide_output make install
4448
hide_output make clean
4549

@@ -50,6 +54,37 @@ LLVM=39
5054
if [ ! -d libunwind-release_$LLVM ]; then
5155
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
5256
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
57+
# Whoa what's this mysterious patch we're applying to libunwind! Why are we
58+
# swapping the values of ESP/EBP in libunwind?!
59+
#
60+
# Discovered in #35599 it turns out that the vanilla build of libunwind is not
61+
# suitable for unwinding i686 musl. After some investigation it ended up
62+
# looking like the register values for ESP/EBP were indeed incorrect (swapped)
63+
# in the source. Similar commits in libunwind (r280099 and r282589) have noticed
64+
# this for other platforms, and we just need to realize it for musl linux as
65+
# well.
66+
#
67+
# More technical info can be found at #35599
68+
cd libunwind-release_$LLVM
69+
patch -Np1 << EOF
70+
diff --git a/include/libunwind.h b/include/libunwind.h
71+
index c5b9633..1360eb2 100644
72+
--- a/include/libunwind.h
73+
+++ b/include/libunwind.h
74+
@@ -151,8 +151,8 @@ enum {
75+
UNW_X86_ECX = 1,
76+
UNW_X86_EDX = 2,
77+
UNW_X86_EBX = 3,
78+
- UNW_X86_EBP = 4,
79+
- UNW_X86_ESP = 5,
80+
+ UNW_X86_ESP = 4,
81+
+ UNW_X86_EBP = 5,
82+
UNW_X86_ESI = 6,
83+
UNW_X86_EDI = 7
84+
};
85+
fi
86+
EOF
87+
cd ..
5388
fi
5489

5590
mkdir libunwind-build

0 commit comments

Comments
 (0)