Build libssp from gcc
gcc/libssp's configure script runs checks for flags that clang doesn't implement. We actually just need to set a few HAVE defines and compile the .c sources, so just check out this subdirectory using svn and build it using a custom makefile.
This commit is contained in:
1 parent
61eaf3a0de
commit
c9db1e06b5
6 files changed
+70
-3
No files matched your search
@@ -4,3 +4,4 @@ compiler-rt
|
||||
libunwind
|
||||
libcxxabi
|
||||
libcxx
|
||||
libssp
|
||||
+3
-2
@@ -2,7 +2,8 @@ FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update -qq && apt-get install -qqy \
|
||||
git wget bzip2 file unzip libtool pkg-config cmake build-essential \
|
||||
automake yasm gettext autopoint vim python git-svn ninja-build && \
|
||||
automake yasm gettext autopoint vim python git-svn ninja-build \
|
||||
subversion && \
|
||||
apt-get clean -y && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@@ -18,7 +19,7 @@ ENV TOOLCHAIN_PREFIX=/opt/llvm-mingw
|
||||
ENV TOOLCHAIN_ARCHS="i686 x86_64 armv7 aarch64"
|
||||
|
||||
# Build everything and clean up, in one step
|
||||
COPY *.sh ./
|
||||
COPY *.sh libssp-Makefile ./
|
||||
COPY wrappers/*.sh ./wrappers/
|
||||
RUN ./build-all.sh $TOOLCHAIN_PREFIX && \
|
||||
./strip-llvm.sh $TOOLCHAIN_PREFIX && \
|
||||
|
||||
+6
-1
@@ -2,7 +2,8 @@ FROM ubuntu:16.04
|
||||
|
||||
RUN apt-get update -qq && apt-get install -qqy \
|
||||
git wget bzip2 file unzip libtool pkg-config cmake build-essential \
|
||||
automake yasm gettext autopoint vim python git-svn ninja-build && \
|
||||
automake yasm gettext autopoint vim python git-svn ninja-build \
|
||||
subversion && \
|
||||
apt-get clean -y && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@@ -68,6 +69,10 @@ RUN cd test && \
|
||||
done; \
|
||||
done
|
||||
|
||||
# Build libssp
|
||||
COPY build-libssp.sh libssp-Makefile ./
|
||||
RUN ./build-libssp.sh $TOOLCHAIN_PREFIX
|
||||
|
||||
# Strip the final toolchain. (This doesn't reduce the total docker image
|
||||
# size as long as it is in a separate RUN layer though.)
|
||||
COPY strip-llvm.sh .
|
||||
|
||||
@@ -13,3 +13,4 @@ PREFIX="$1"
|
||||
./build-mingw-w64.sh $PREFIX
|
||||
./build-compiler-rt.sh $PREFIX
|
||||
./build-libcxx.sh $PREFIX
|
||||
./build-libssp.sh $PREFIX
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo $0 dest
|
||||
exit 1
|
||||
fi
|
||||
PREFIX="$1"
|
||||
export PATH=$PREFIX/bin:$PATH
|
||||
|
||||
: ${CORES:=4}
|
||||
: ${ARCHS:=${TOOLCHAIN_ARCHS-i686 x86_64 armv7 aarch64}}
|
||||
|
||||
if [ ! -d libssp ]; then
|
||||
svn checkout svn://gcc.gnu.org/svn/gcc/tags/gcc_7_3_0_release/libssp
|
||||
fi
|
||||
|
||||
cp libssp-Makefile libssp/Makefile
|
||||
|
||||
cd libssp
|
||||
|
||||
# gcc/libssp's configure script runs checks for flags that clang doesn't
|
||||
# implement. We actually just need to set a few HAVE defines and compile
|
||||
# the .c sources.
|
||||
cp config.h.in config.h
|
||||
for i in HAVE_FCNTL_H HAVE_INTTYPES_H HAVE_LIMITS_H HAVE_MALLOC_H \
|
||||
HAVE_MEMMOVE HAVE_MEMORY_H HAVE_MEMPCPY HAVE_STDINT_H HAVE_STDIO_H \
|
||||
HAVE_STDLIB_H HAVE_STRINGS_H HAVE_STRING_H HAVE_STRNCAT HAVE_STRNCPY \
|
||||
HAVE_SYS_STAT_H HAVE_SYS_TYPES_H HAVE_UNISTD_H HAVE_USABLE_VSNPRINTF; do
|
||||
cat config.h | sed 's/^#undef '$i'$/#define '$i' 1/' > tmp
|
||||
mv tmp config.h
|
||||
done
|
||||
cat ssp/ssp.h.in | sed 's/@ssp_have_usable_vsnprintf@/define/' > ssp/ssp.h
|
||||
|
||||
for arch in $ARCHS; do
|
||||
mkdir -p build-$arch
|
||||
cd build-$arch
|
||||
make -f ../Makefile -j$CORES CROSS=$arch-w64-mingw32-
|
||||
cp libssp.a $PREFIX/$arch-w64-mingw32/lib
|
||||
cp libssp.a $PREFIX/$arch-w64-mingw32/lib/libssp_nonshared.a
|
||||
cd ..
|
||||
done
|
||||
@@ -0,0 +1,16 @@
|
||||
SRC_PATH=$(word 1, $(dir $(MAKEFILE_LIST)))
|
||||
vpath %.c $(SRC_PATH)
|
||||
|
||||
CC = $(CROSS)gcc
|
||||
AR = $(CROSS)ar
|
||||
|
||||
CFLAGS = -O2 -Wall -Wundef -I$(SRC_PATH) -D_FORTIFY_SOURCE=0 -D__SSP_FORTIFY_LEVEL=0
|
||||
|
||||
SOURCES = $(patsubst $(SRC_PATH)%,%,$(wildcard $(SRC_PATH)*.c))
|
||||
OBJS = $(SOURCES:%.c=%.o)
|
||||
|
||||
libssp.a: $(OBJS)
|
||||
$(AR) rcs $@ $+
|
||||
|
||||
clean:
|
||||
rm -f *.a *.o
|
||||
Reference in new issue
Block a user