You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,8 @@ Then, simply run the following command:
57
57
58
58
You should now be able to use riscv64-unknown-elf-gcc and its cousins.
59
59
60
+
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).
61
+
60
62
### Installation (Linux)
61
63
62
64
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:
457
459
* Initially a host GCC will be built
458
460
* This host GCC is then used to build the cross compiler
459
461
* The cross compiler will be built with `-Werror` to identify code issues
462
+
463
+
### FAQ
464
+
#### Ensuring Code Model Consistency
465
+
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),
466
+
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,
467
+
[read this SiFive blog article](https://www.sifive.com/blog/all-aboard-part-4-risc-v-code-models).
468
+
469
+
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.
470
+
471
+
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.
0 commit comments