Skip to content

Instantly share code, notes, and snippets.


nathanchance/ Secret

Created Apr 18, 2020
What would you like to do?
#!/usr/bin/env bash
# Where the script is located
BASE=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
# Build the compiler.
# Explanation of flags:
# * '--assertions': The bug only happens with assertions.
# * '--build-stage1-only': Speeds up the build since the script is
# the script is two stage by default.
# * '--no-update': We do not want the script trying to checkout a
# revision different from the one we are currently testing.
# * '--projects clang': by default, the script builds clang, compiler-rt,
# lld, and polly. We know this bug lies only in clang.
# * '--targets "RISCV;X86"': We only need the RISC-V (target) and X86 (host)
# backends. Avoid building the others to speed up the build (slightly).
# If the compiler cannot be built, exit 125 because it is untestable.
"${TC_BLD}"/ \
--assertions \
--build-stage1-only \
--no-update \
--projects clang \
--targets "RISCV;X86" || exit 125
# Build the Linux kernel (specifically 'crypto/jitterentropy.o' because that
# is the translation unit with the error)
# Removing the out folder is to avoid potential issues with distclean
# PATH is needed so that the toolchain we built above is used, as well as
# having access to riscv64 binutils
# Being the last line of the script means that its exit code will be the
# exit code of the script
rm -rf "${LINUX_SRC}"/out && \
PATH=${TC_BLD}/build/llvm/stage1/bin:${TC_BLD}/install/bin:${PATH} \
make -C "${LINUX_SRC}" \
-j"$(nproc)" \
-s \
ARCH=riscv \
CC=clang \
CROSS_COMPILE=riscv64-linux-gnu- \
LD=riscv64-linux-gnu-ld \
LLVM=1 \
O=out/riscv64 \
allyesconfig \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.