Skip to content

Commit

Permalink
ci: use musl shared script in dist-i586-gnu-i686-musl
Browse files Browse the repository at this point in the history
  • Loading branch information
malbarbo committed Jan 3, 2018
1 parent 10a7591 commit 00b5413
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 73 deletions.
7 changes: 5 additions & 2 deletions src/ci/docker/dist-i586-gnu-i686-musl/Dockerfile
Expand Up @@ -17,8 +17,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config

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

COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
Expand Down
55 changes: 0 additions & 55 deletions src/ci/docker/dist-i586-gnu-i686-musl/build-musl.sh

This file was deleted.

15 changes: 0 additions & 15 deletions src/ci/docker/dist-i586-gnu-i686-musl/musl-libunwind-patch.patch

This file was deleted.

37 changes: 36 additions & 1 deletion src/ci/docker/scripts/musl.sh
Expand Up @@ -39,7 +39,11 @@ fi

cd $MUSL
./configure --disable-shared --prefix=/musl-$TAG $@
hide_output make -j$(nproc)
if [ "$TAG" = "i686" ]; then
hide_output make -j$(nproc) AR=ar RANLIB=ranlib
else
hide_output make -j$(nproc)
fi
hide_output make install
hide_output make clean

Expand All @@ -50,6 +54,37 @@ LLVM=39
if [ ! -d libunwind-release_$LLVM ]; then
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf -
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf -
# Whoa what's this mysterious patch we're applying to libunwind! Why are we
# swapping the values of ESP/EBP in libunwind?!
#
# Discovered in #35599 it turns out that the vanilla build of libunwind is not
# suitable for unwinding i686 musl. After some investigation it ended up
# looking like the register values for ESP/EBP were indeed incorrect (swapped)
# in the source. Similar commits in libunwind (r280099 and r282589) have noticed
# this for other platforms, and we just need to realize it for musl linux as
# well.
#
# More technical info can be found at #35599
cd libunwind-release_$LLVM
patch -Np1 << EOF
diff --git a/include/libunwind.h b/include/libunwind.h
index c5b9633..1360eb2 100644
--- a/include/libunwind.h
+++ b/include/libunwind.h
@@ -151,8 +151,8 @@ enum {
UNW_X86_ECX = 1,
UNW_X86_EDX = 2,
UNW_X86_EBX = 3,
- UNW_X86_EBP = 4,
- UNW_X86_ESP = 5,
+ UNW_X86_ESP = 4,
+ UNW_X86_EBP = 5,
UNW_X86_ESI = 6,
UNW_X86_EDI = 7
};
fi
EOF
cd ..
fi

mkdir libunwind-build
Expand Down

0 comments on commit 00b5413

Please sign in to comment.