161.13. gcc-riscv64-unknown-elf-16.2.0
The RISC-V bare-metal compiler, for MCUs and the soft cores the FPGA flow synthesises
16.2.0-1 · GPL-3.0-or-later AND GPL-3.0-or-later WITH GCC-exception-3.1 · 27.7 SBU · 366.6 MiB, 713 files · 41_system, 471 of 1047 · ports/core/embedded/gcc-riscv64-unknown-elf
Homepage: https://gcc.gnu.org/
Why it is in KDOS. The comment above the 4 ports from binutils-riscv64-unknown-elf to libstdcxx-riscv64-unknown-elf in script/phases/41_system/packages.d/embedded.txt:
RV32 and RV64 — the MCUs and the soft cores the FPGA flow (yosys, nextpnr) synthesises.
Depends on: binutils-riscv64-unknown-elf, gmp, mpfr, mpc, zlib, zstd, texinfo.
Required by (2): libstdcxx-riscv64-unknown-elf, picolibc-riscv64-unknown-elf.
Sources: gcc-riscv64-unknown-elf-16.2.0.tar.xz (102.2 MiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install gcc-riscv64-unknown-elf'
build.sh:
mkdir -p build && cd build
../configure \
--target=riscv64-unknown-elf \
--prefix=/usr \
--libexecdir=/usr/lib \
--with-sysroot=/usr/riscv64-unknown-elf \
--enable-languages=c,c++ \
--without-headers \
--with-newlib \
--disable-nls \
--disable-shared \
--disable-threads \
--disable-libssp \
--disable-libgomp \
--disable-libquadmath \
--disable-libatomic \
--disable-libstdcxx-pch \
--disable-decimal-float \
--with-gnu-as --with-gnu-ld \
--with-zstd=/usr \
--without-isl \
--enable-multilib --with-abi=lp64d --with-arch=rv64gc \
--enable-host-pie \
--enable-host-bind-now \
--with-pkgversion="KDOS" \
CFLAGS_FOR_TARGET="-Os -pipe -ffunction-sections -fdata-sections"
make all-gcc all-target-libgcc LIBGCC2_DEBUG_CFLAGS=-g0
make DESTDIR=$PKG install-gcc install-target-libgcc LIBGCC2_DEBUG_CFLAGS=-g0
rm -rf "$PKG/usr/share/info" "$PKG/usr/share/man/man7"
Programs: riscv64-unknown-elf-c++, riscv64-unknown-elf-cpp, riscv64-unknown-elf-g++, riscv64-unknown-elf-gcc, riscv64-unknown-elf-gcc-16.2.0, riscv64-unknown-elf-gcc-ar, riscv64-unknown-elf-gcc-nm, riscv64-unknown-elf-gcc-ranlib, riscv64-unknown-elf-gcov, riscv64-unknown-elf-gcov-dump, riscv64-unknown-elf-gcov-tool, riscv64-unknown-elf-lto-dump.
Directories: /usr/lib/gcc/riscv64-unknown-elf/16.2.0/include, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/include-fixed, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/install-tools, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/plugin, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/rv32i, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/rv32iac, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/rv32im, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/rv32imac, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/rv32imafc, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/rv64imac, /usr/lib/gcc/riscv64-unknown-elf/16.2.0/rv64imafdc, /usr/share/licenses/gcc-riscv64-unknown-elf.