diff options
author | Valen <18544814+SpiccyMayonnaise@users.noreply.github.com> | 2024-04-06 01:40:45 +1030 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-05 17:10:45 +0200 |
commit | 65d9e0f354ff73460ca4827a51fdff00af105048 (patch) | |
tree | 389a1066b9e7c9a2811dd0e81fe3872a94f900dd | |
parent | 9a28c809a5d355874def06a414aa5f272fae564d (diff) | |
download | riscv-gnu-toolchain-65d9e0f354ff73460ca4827a51fdff00af105048.zip riscv-gnu-toolchain-65d9e0f354ff73460ca4827a51fdff00af105048.tar.gz riscv-gnu-toolchain-65d9e0f354ff73460ca4827a51fdff00af105048.tar.bz2 |
Update README with a short summary of the --with-cmodel configure option (#1414)
Update README.md to indicate core model option
Signed-off-by: Valen <18544814+SpiccyMayonnaise@users.noreply.github.com>
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
-rw-r--r-- | README.md | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 |