aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2023-06-13 18:28:21 +0800
committerGitHub <noreply@github.com>2023-06-13 18:28:21 +0800
commit89268de2af0957d571cf5ad0e0b894a15b147b25 (patch)
tree9a32eeed2ca66dd46c4ba9bf5329babe8819a35a /README.md
parent89f3238e9dfd9630741b543cf608a8dd5a8cea16 (diff)
parent9027b5a78ddf9c9279618674f67186c1bb636825 (diff)
downloadriscv-gnu-toolchain-89268de2af0957d571cf5ad0e0b894a15b147b25.zip
riscv-gnu-toolchain-89268de2af0957d571cf5ad0e0b894a15b147b25.tar.gz
riscv-gnu-toolchain-89268de2af0957d571cf5ad0e0b894a15b147b25.tar.bz2
Merge pull request #1273 from alexsifivetw/alexc/newlib-llvm
Add newlib toolchain with llvm build flow
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 16 insertions, 4 deletions
diff --git a/README.md b/README.md
index f6e93b8..5ac8921 100644
--- a/README.md
+++ b/README.md
@@ -260,12 +260,12 @@ can be used:
Note, that a combination of `--enable-llvm` and multilib configuration flags
is not supported.
-Also note, that building LLVM is only supported in combination with building
-a Linux toolchain.
-Below is an example how to build a rv64gc Linux toolchain with LLVM support,
+Below are examples how to build a rv64gc Linux/newlib toolchain with LLVM support,
how to use it to build a C and a C++ application using clang, and how to
-execute the generated binaries using QEMU:
+execute the generated binaries using QEMU.
+
+Build Linux toolchain and run examples:
# Build rv64gc toolchain with LLVM
./configure --prefix=$RISCV --enable-llvm --enable-linux --with-arch=rv64gc --with-abi=lp64d
@@ -277,6 +277,18 @@ execute the generated binaries using QEMU:
$RISCV/bin/clang++ -march=rv64imafdc -stdlib=libc++ -o hello_world_cpp hello_world_cpp.cxx
$RISCV/bin/qemu-riscv64 -L $RISCV/sysroot ./hello_world_cpp
+Build newlib toolchain and run examples (don't work with `--with-multilib-generator=`):
+
+ # Build rv64gc bare-metal toolchain with LLVM
+ ./configure --prefix=$RISCV --enable-llvm --disable-linux --with-arch=rv64gc --with-abi=lp64d
+ make -j$(nproc) all build-sim SIM=qemu
+ # Build C application with clang
+ $RISCV/bin/clang -march=rv64imafdc -o hello_world hello_world.c
+ $RISCV/bin/qemu-riscv64 -L $RISCV/sysroot ./hello_world
+ # Build C++ application with clang using static link
+ $RISCV/bin/clang++ -march=rv64imafdc -static -o hello_world_cpp hello_world_cpp.cxx
+ $RISCV/bin/qemu-riscv64 -L $RISCV/sysroot ./hello_world_cpp
+
### Development
This section is only for developer or advanced user, or you want to build