diff options
-rwxr-xr-x | .github/setup-apt.sh | 2 | ||||
-rw-r--r-- | Makefile.in | 6 | ||||
-rw-r--r-- | README.md | 20 | ||||
m--------- | newlib | 0 |
4 files changed, 20 insertions, 8 deletions
diff --git a/.github/setup-apt.sh b/.github/setup-apt.sh index a470961..fb118fe 100755 --- a/.github/setup-apt.sh +++ b/.github/setup-apt.sh @@ -6,4 +6,4 @@ apt update apt install -y autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev \ libgmp-dev gawk build-essential bison flex texinfo gperf libtool \ patchutils bc zlib1g-dev libexpat-dev git ninja-build cmake libglib2.0-dev expect \ - device-tree-compiler python3-pyelftools + device-tree-compiler python3-pyelftools libslirp-dev diff --git a/Makefile.in b/Makefile.in index f877704..69e2927 100644 --- a/Makefile.in +++ b/Makefile.in @@ -96,7 +96,7 @@ GLIBC_CXX_FOR_TARGET ?= $(LINUX_TUPLE)-g++ GLIBC_TARGET_BOARDS ?= $(shell $(srcdir)/scripts/generate_target_board \ --sim-name riscv-sim \ --cmodel $(shell echo @cmodel@ | cut -d '=' -f2) \ - --build-arch-abi $(GLIBC_MULTILIB_NAMES) \ + --build-arch-abi "$(GLIBC_MULTILIB_NAMES)" \ --extra-test-arch-abi-flags-list "$(EXTRA_MULTILIB_TEST)") NEWLIB_CC_FOR_TARGET ?= $(NEWLIB_TUPLE)-gcc @@ -104,13 +104,13 @@ NEWLIB_CXX_FOR_TARGET ?= $(NEWLIB_TUPLE)-g++ NEWLIB_TARGET_BOARDS ?= $(shell $(srcdir)/scripts/generate_target_board \ --sim-name riscv-sim \ --cmodel $(shell echo @cmodel@ | cut -d '=' -f2) \ - --build-arch-abi $(NEWLIB_MULTILIB_NAMES) \ + --build-arch-abi "$(NEWLIB_MULTILIB_NAMES)" \ --extra-test-arch-abi-flags-list "$(EXTRA_MULTILIB_TEST)") NEWLIB_NANO_TARGET_BOARDS ?= $(shell $(srcdir)/scripts/generate_target_board \ --sim-name riscv-sim-nano \ --cmodel $(shell echo @cmodel@ | cut -d '=' -f2) \ - --build-arch-abi $(NEWLIB_MULTILIB_NAMES) \ + --build-arch-abi "$(NEWLIB_MULTILIB_NAMES)" \ --extra-test-arch-abi-flags-list "$(EXTRA_MULTILIB_TEST)") NEWLIB_CC_FOR_MULTILIB_INFO := $(NEWLIB_CC_FOR_TARGET) @@ -20,21 +20,21 @@ Several standard packages are needed to build the toolchain. On Ubuntu, executing the following command should suffice: - $ sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev + $ sudo apt-get install autoconf automake autotools-dev curl python3 python3-pip libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev libslirp-dev On Fedora/CentOS/RHEL OS, executing the following command should suffice: - $ sudo yum install autoconf automake python3 libmpc-devel mpfr-devel gmp-devel gawk bison flex texinfo patchutils gcc gcc-c++ zlib-devel expat-devel + $ sudo yum install autoconf automake python3 libmpc-devel mpfr-devel gmp-devel gawk bison flex texinfo patchutils gcc gcc-c++ zlib-devel expat-devel libslirp-devel On Arch Linux, executing the following command should suffice: - $ sudo pacman -Syyu autoconf automake curl python3 libmpc mpfr gmp gawk base-devel bison flex texinfo gperf libtool patchutils bc zlib expat + $ sudo pacman -Syyu autoconf automake curl python3 libmpc mpfr gmp gawk base-devel bison flex texinfo gperf libtool patchutils bc zlib expat libslirp Also available for Arch users on the AUR: [https://aur.archlinux.org/packages/riscv-gnu-toolchain-bin](https://aur.archlinux.org/packages/riscv-gnu-toolchain-bin) On OS X, you can use [Homebrew](http://brew.sh) to install the dependencies: - $ brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat texinfo flock + $ brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat texinfo flock libslirp To build the glibc (Linux) on OS X, you will need to build within a case-sensitive file system. The simplest approach is to create and mount a new disk image with @@ -57,6 +57,8 @@ Then, simply run the following command: You should now be able to use riscv64-unknown-elf-gcc and its cousins. +Note: If you're planning to use an external library that replaces part of newlib (for example `libgloss-htif`), [read the FAQ](#ensuring-code-model-consistency). + ### Installation (Linux) To build the Linux cross-compiler, pick an install path (that is writeable). @@ -457,3 +459,13 @@ sources is among them. The flag `--enable-host-gcc` does exaclty that: * Initially a host GCC will be built * This host GCC is then used to build the cross compiler * The cross compiler will be built with `-Werror` to identify code issues + +### FAQ +#### Ensuring Code Model Consistency +If parts of newlib are going to be replaced with an external library (such as with [libgloss-htif](https://github.com/ucb-bar/libgloss-htif) for Berkeley Host-Target Interface), +you should take care to ensure that both newlib and the external library are built using the same code model. For more information about RISC-V code models, +[read this SiFive blog article](https://www.sifive.com/blog/all-aboard-part-4-risc-v-code-models). + +Errors that indicate a code model mismatch include "relocation overflow" or "relocation truncated" errors from the linker being unable to successfully relocate symbols in the executable. + +By default, `riscv-gnu-toolchain` builds newlib with `-mcmodel=medlow`. You can use the alternative `medany` code model (as used in libgloss-htif) by passing `--with-cmodel=medany` to the configure script.
\ No newline at end of file diff --git a/newlib b/newlib -Subproject 9e09d6ed83cce4777a5950412647ccc60304040 +Subproject 26f7004bf73c421c3fd5e5a6ccf470d05337b43 |