The cctools-port linker links against libraries from clang (for LTO), which have different SONAMEs depending on the clang version. Which means the linker needs to be used along the same version of clang it was built against. Thus we also make it depend on linux64-clang-7. But changing the dependency is not enough, cf. bug 1471905, so also touch its build script, which it turns out, we need to do anyways because llvm-dsymutil was renamed to dsymutil. Relatedly, all toolchains that are built using cctools-port need to use linux64-clang-7 too. Building compiler-rt 7 with the OSX 10.11 SDK fails because of some newer APIs being used in compiler-rt for xray, but this is not a feature we use, so disable that. Differential Revision: https://phabricator.services.mozilla.com/D6766
56 lines
2.0 KiB
Bash
Executable File
56 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# cctools sometimes needs to be rebuilt when clang is modified.
|
|
# Until bug 1471905 is addressed, increase the following number
|
|
# when a forced rebuild of cctools is necessary: 1
|
|
|
|
set -x -e -v
|
|
|
|
# This script is for building cctools (Apple's binutils) for Linux using
|
|
# cctools-port (https://github.com/tpoechtrager/cctools-port).
|
|
WORKSPACE=$HOME/workspace
|
|
UPLOAD_DIR=$HOME/artifacts
|
|
|
|
# Repository info
|
|
: CROSSTOOL_PORT_REPOSITORY ${CROSSTOOL_PORT_REPOSITORY:=https://github.com/tpoechtrager/cctools-port}
|
|
: CROSSTOOL_PORT_REV ${CROSSTOOL_PORT_REV:=8e9c3f2506b51cf56725eaa60b6e90e240e249ca}
|
|
|
|
# Set some crosstools-port directories
|
|
CROSSTOOLS_SOURCE_DIR=$WORKSPACE/crosstools-port
|
|
CROSSTOOLS_CCTOOLS_DIR=$CROSSTOOLS_SOURCE_DIR/cctools
|
|
CROSSTOOLS_BUILD_DIR=$WORKSPACE/cctools
|
|
CLANG_DIR=$WORKSPACE/build/src/clang
|
|
|
|
# Create our directories
|
|
mkdir -p $CROSSTOOLS_BUILD_DIR
|
|
|
|
git clone --no-checkout $CROSSTOOL_PORT_REPOSITORY $CROSSTOOLS_SOURCE_DIR
|
|
cd $CROSSTOOLS_SOURCE_DIR
|
|
git checkout $CROSSTOOL_PORT_REV
|
|
# Cherry pick two fixes for LTO.
|
|
git cherry-pick -n 82381f5038a340025ae145745ae5b325cd1b749a
|
|
git cherry-pick -n 328c7371008a854af30823adcd4ec1e763054a1d
|
|
echo "Building from commit hash `git rev-parse $CROSSTOOL_PORT_REV`..."
|
|
|
|
# Fetch clang from tooltool
|
|
cd $WORKSPACE/build/src
|
|
. taskcluster/scripts/misc/tooltool-download.sh
|
|
|
|
# Configure crosstools-port
|
|
cd $CROSSTOOLS_CCTOOLS_DIR
|
|
export CC=$CLANG_DIR/bin/clang
|
|
export CXX=$CLANG_DIR/bin/clang++
|
|
export LDFLAGS="-lpthread -Wl,-rpath-link,$CLANG_DIR/lib"
|
|
./autogen.sh
|
|
./configure --prefix=$CROSSTOOLS_BUILD_DIR --target=x86_64-apple-darwin11 --with-llvm-config=$CLANG_DIR/bin/llvm-config
|
|
|
|
# Build cctools
|
|
make -j `nproc --all` install
|
|
strip $CROSSTOOLS_BUILD_DIR/bin/*
|
|
# cctools-port doesn't include dsymutil but clang will need to find it.
|
|
cp $CLANG_DIR/bin/dsymutil $CROSSTOOLS_BUILD_DIR/bin/x86_64-apple-darwin11-dsymutil
|
|
|
|
# Put a tarball in the artifacts dir
|
|
mkdir -p $UPLOAD_DIR
|
|
tar cJf $UPLOAD_DIR/cctools.tar.xz -C $CROSSTOOLS_BUILD_DIR/.. `basename $CROSSTOOLS_BUILD_DIR`
|