Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ How to do a release
will be uploaded to
[GitHub releases](https://github.com/lowRISC/lowrisc-toolchains/releases).

How to generate the bitmanip patch
------------------------------------

```
git clone https://github.com/riscv-collab/riscv-binutils-gdb.git
cd riscv-binutils-gdb
# checkout Pirmin's bitmanip 1.00+0.93 PR (https://github.com/riscv-collab/riscv-binutils-gdb/pull/267)
gh pr checkout 267
# 7c9dd840 (riscv-binutils-2.35-rvb) is our baseline
git diff 7c9dd840 > $TOP/patches/lowrisc-toolchain-gcc-rv32imcb/binutils/git-7c9dd840/001-bitmanip.patch
```
How to install pre-built toolchain
------------------------------------
1. Download a tar.gz file from release page.
Expand Down
60 changes: 48 additions & 12 deletions build-binutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ repo_dir="$(git rev-parse --show-toplevel)"
build_dir="${repo_dir}/build"
patch_dir="${repo_dir}/patches"
dist_dir="${build_dir}/dist"
static_libs_dir="${build_dir}/libs"

source "${repo_dir}/sw-versions.sh"

Expand All @@ -41,7 +42,9 @@ fi

set -x

mkdir -p "$dist_dir"
mkdir -p "$build_dir"
mkdir -p "$static_libs_dir"
cd "$build_dir"

if [ ! -d binutils ]; then
Expand All @@ -50,21 +53,54 @@ if [ ! -d binutils ]; then
--depth 1
fi

cd binutils
git reset --hard
git checkout "$BINUTILS_COMMIT"
git apply "${patch_dir}/binutils/"*
if [ ! -d gmp ]; then
tmp=$(mktemp -d)
mkdir -p ${tmp}/gmp
curl -L "$GMP_URL" -o "${tmp}/gmp.tar.xz"
printf "$GMP_SHA256 ${tmp}/gmp.tar.xz\n" > ${tmp}/gmp.sha256
sha256sum -c ${tmp}/gmp.sha256
xzcat ${tmp}/gmp.tar.xz | tar --strip-components=1 -C ${tmp}/gmp -x -v -f -
mv ${tmp}/gmp gmp
rm ${tmp}/gmp.tar.xz
fi

mkdir -p build
cd build
if [ ! -d mpfr ]; then
git clone "$MPFR_URL" mpfr \
--branch "$MPFR_BRANCH" \
--depth 1
fi

mkdir -p "$dist_dir"
cd gmp
./configure \
--enable-static=yes \
--enable-shared=no \
--prefix=$static_libs_dir
make -j "$(nproc)"
make -j "$(nproc)" check
make install
cd ..

../configure \
--target="$target" \
--program-prefix="$target-" \
--prefix="$dist_dir" \
--with-libexpat-type=static
cd mpfr
./autogen.sh
./configure \
--enable-static=yes \
--enable-shared=no \
--with-gmp=$static_libs_dir \
--prefix=$static_libs_dir
make -j "$(nproc)"
make install
cd ..

cd binutils
mkdir -p build
cd build
../configure \
--target="$target" \
--program-prefix="$target-" \
--prefix="$dist_dir" \
--with-libexpat-type=static \
--with-gmp=$static_libs_dir \
--with-mpfr=$static_libs_dir
make -j "$(nproc)"
make -C gas check
make install
19 changes: 0 additions & 19 deletions patches/binutils/001-bfd-elf.patch

This file was deleted.

Loading