Use binutils objcopy and strip if available
For x86 architectures, binutils objcopy and strip can be used as such. For armv7 and aarch64, binutils doesn't recognize the architectures and refuse to touch the files. For most/everything that objcopy/strip do, the actual architecture doesn't really matter though. Therefore, provide a wrapper script and a minimal tool for editing PE executables, that change the architecture from armv7 and aarch64 to i686 and x86_64 respectively before invoking binutils, and change it back afterwards. In case the binutils tools are missing, just return a successful result without doing anything for stripping operations (previously, we had the <triplet>-strip tool symlinked to /bin/true, so this isn't any worse than before) and fail for other objcopy operations.
This commit is contained in:
1 parent
86d8400cae
commit
609fe4b81d
5 files changed
+278
-3
No files matched your search
+10
@@ -21,8 +21,18 @@ ENV TOOLCHAIN_ARCHS="i686 x86_64 armv7 aarch64"
|
||||
# Build everything and clean up, in one step
|
||||
COPY *.sh libssp-Makefile ./
|
||||
COPY wrappers/*.sh ./wrappers/
|
||||
COPY wrappers/*.c ./wrappers/
|
||||
RUN ./build-all.sh $TOOLCHAIN_PREFIX && \
|
||||
./strip-llvm.sh $TOOLCHAIN_PREFIX && \
|
||||
rm -rf /build
|
||||
|
||||
# Cheating: Pull strip and objcopy from the normal binutils package.
|
||||
RUN apt-get update -qq && \
|
||||
apt-get install -qqy binutils-mingw-w64-x86-64 && \
|
||||
cp /usr/bin/x86_64-w64-mingw32-strip $TOOLCHAIN_PREFIX/bin/binutils-strip && \
|
||||
cp /usr/bin/x86_64-w64-mingw32-objcopy $TOOLCHAIN_PREFIX/bin/binutils-objcopy && \
|
||||
apt-get remove -qqy binutils-mingw-w64-x86-64 && \
|
||||
apt-get clean -y && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV PATH=$TOOLCHAIN_PREFIX/bin:$PATH
|
||||
Reference in new issue
Block a user