aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKito Cheng <kito.cheng@sifive.com>2022-04-11 23:11:25 +0800
committerGitHub <noreply@github.com>2022-04-11 23:11:25 +0800
commit372e33ea8dbfc297466f679f68bb98da69a52d05 (patch)
tree08a0c69615c9c658c5b2ef9c3505af4ffea9bd5f
parentcc1075c916491ac5bd6cae419f6ca371a268b10d (diff)
parent629c67e0a93ec03edd3dfab60a2b8ad9c1768a2a (diff)
downloadriscv-gnu-toolchain-372e33ea8dbfc297466f679f68bb98da69a52d05.zip
riscv-gnu-toolchain-372e33ea8dbfc297466f679f68bb98da69a52d05.tar.gz
riscv-gnu-toolchain-372e33ea8dbfc297466f679f68bb98da69a52d05.tar.bz2
Merge pull request #1032 from florianhofhammer/feature/update-submodules
Rename glibc, newlib submodules and add musl submodule
-rw-r--r--.github/workflows/build.yaml14
-rw-r--r--.github/workflows/nightly-release.yaml14
-rw-r--r--.gitmodules12
-rw-r--r--Makefile.in6
-rw-r--r--README.md24
-rwxr-xr-xconfigure9
-rw-r--r--configure.ac12
m---------glibc (renamed from riscv-glibc)0
m---------musl0
m---------newlib (renamed from riscv-newlib)0
10 files changed, 67 insertions, 24 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 18bbf6c..6481c87 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -14,8 +14,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
- mode: [newlib, linux]
+ mode: [newlib, linux, musl]
target: [rv32gc-ilp32d, rv64gc-lp64d]
+ exclude:
+ - mode: musl
+ target: rv32gc-ilp32d
steps:
- uses: actions/checkout@v2
@@ -40,7 +43,14 @@ jobs:
id: toolchain-name-generator
run: |
if [[ "${{ matrix.target }}" == *"32"* ]]; then BITS=32; else BITS=64; fi
- if [[ "${{ matrix.mode }}" == "linux" ]]; then MODE="glibc"; else MODE="elf"; fi
+ case "${{ matrix.mode }}" in
+ "linux")
+ MODE="glibc";;
+ "musl")
+ MODE="musl";;
+ *)
+ MODE="elf";;
+ esac
echo ::set-output name=TOOLCHAIN_NAME::riscv$BITS-$MODE-${{ matrix.os }}-nightly
- uses: actions/upload-artifact@v2
diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml
index 21d6cf9..b8449e4 100644
--- a/.github/workflows/nightly-release.yaml
+++ b/.github/workflows/nightly-release.yaml
@@ -49,8 +49,11 @@ jobs:
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
- mode: [newlib, linux]
+ mode: [newlib, linux, musl]
target: [rv32gc-ilp32d, rv64gc-lp64d]
+ exclude:
+ - mode: musl
+ target: rv32gc-ilp32d
steps:
- uses: actions/checkout@v2
@@ -75,7 +78,14 @@ jobs:
id: toolchain-name-generator
run: |
if [[ "${{ matrix.target }}" == *"32"* ]]; then BITS=32; else BITS=64; fi
- if [[ "${{ matrix.mode }}" == "linux" ]]; then MODE="glibc"; else MODE="elf"; fi
+ case "${{ matrix.mode }}" in
+ "linux")
+ MODE="glibc";;
+ "musl")
+ MODE="musl";;
+ *)
+ MODE="elf";;
+ esac
echo ::set-output name=TOOLCHAIN_NAME::riscv$BITS-$MODE-${{ matrix.os }}-nightly
- uses: actions/upload-artifact@v2
diff --git a/.gitmodules b/.gitmodules
index d1231e4..229b971 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -6,15 +6,15 @@
path = riscv-gcc
url = https://github.com/riscv-collab/riscv-gcc.git
branch = riscv-gcc-10.2.0
-[submodule "riscv-glibc"]
- path = riscv-glibc
+[submodule "glibc"]
+ path = glibc
url = git://sourceware.org/git/glibc.git
[submodule "riscv-dejagnu"]
path = riscv-dejagnu
url = https://github.com/riscv-collab/riscv-dejagnu.git
branch = riscv-dejagnu-1.6
-[submodule "riscv-newlib"]
- path = riscv-newlib
+[submodule "newlib"]
+ path = newlib
url = git://sourceware.org/git/newlib-cygwin.git
branch = master
[submodule "riscv-gdb"]
@@ -24,3 +24,7 @@
[submodule "qemu"]
path = qemu
url = https://git.qemu.org/git/qemu.git
+[submodule "musl"]
+ path = musl
+ url = git://git.musl-libc.org/musl
+ branch = master
diff --git a/Makefile.in b/Makefile.in
index c9a56d9..61acd88 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -102,7 +102,13 @@ CONFIGURE_HOST = @configure_host@
all: @default_target@
newlib: stamps/build-gcc-newlib-stage2
linux: stamps/build-gcc-linux-stage2
+ifneq (,$(findstring riscv32,$(MUSL_TUPLE)))
+.PHONY: musl
+musl:
+ @echo "musl only supports 64bit builds." && exit 1
+else
musl: stamps/build-gcc-musl-stage2
+endif
ifeq (@enable_gdb@,--enable-gdb)
newlib: stamps/build-gdb-newlib
linux: stamps/build-gdb-linux
diff --git a/README.md b/README.md
index 79b6f23..18cb70b 100644
--- a/README.md
+++ b/README.md
@@ -68,12 +68,15 @@ run the following command:
./configure --prefix=/opt/riscv
make linux
-The build defaults to targetting RV64GC (64-bit), even on a 32-bit build
-environment. To build the 32-bit RV32GC toolchain, use:
+The build defaults to targeting RV64GC (64-bit) with glibc, even on a 32-bit
+build environment. To build the 32-bit RV32GC toolchain, use:
./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32d
make linux
+In case you prefer musl libc over glibc, configure just like above and opt for
+`make musl` instead of `make linux`.
+
Supported architectures are rv32i or rv64i plus standard extensions (a)tomics,
(m)ultiplication and division, (f)loat, (d)ouble, or (g)eneral for MAFD.
@@ -88,11 +91,19 @@ To build either cross-compiler with support for both 32-bit and
./configure --prefix=/opt/riscv --enable-multilib
-And then either `make` or `make linux` for the Newlib or Linux cross-compiler respectively.
+And then either `make`, `make linux` or `make musl` for the Newlib, Linux
+glibc-based or Linux musl libc-based cross-compiler, respectively.
+
+The multilib compiler will have the prefix riscv64-unknown-elf- or
+riscv64-unknown-linux-gnu- but will be able to target both 32-bit and 64-bit
+systems.
+It will support the most common `-march`/`-mabi` options, which can be seen by
+using the `--print-multi-lib` flag on either cross-compiler.
-The multilib compiler will have the prefix riscv64-unknown-elf- or riscv64-unknown-linux-gnu-,
-but will be able to target both 32-bit and 64-bit systems. It will support
-the most common `-march`/`-mabi` options, which can be seen by using the `--print-multi-lib` flag on either cross-compiler.
+The musl compiler (riscv64-unknown-linux-musl-) will only be able to target
+64-bit systems due to limitations in the upstream musl architecture support.
+The `--enable-multilib` flag therefore does not actually enable multilib support
+for musl libc.
### Troubleshooting Build Problems
@@ -241,4 +252,3 @@ Here is the list of configure option for specify source tree:
--with-gdb-src
--with-linux-headers-src
--with-qemu-src
-
diff --git a/configure b/configure
index adc32b2..9d354c2 100755
--- a/configure
+++ b/configure
@@ -1320,7 +1320,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-linux set linux as the default make target
[--disable-linux]
- --enable-multilib build both RV32 and RV64 runtime libraries
+ --enable-multilib build both RV32 and RV64 runtime libraries (only RV64 for musl libc)
[--disable-multilib]
--enable-gcc-checking Enable gcc internal checking, it will make gcc very
slow, only enable it when developing gcc
@@ -3558,7 +3558,7 @@ fi
with_newlib_src=$with_newlib_src
else
- with_newlib_src="\$(srcdir)/riscv-newlib"
+ with_newlib_src="\$(srcdir)/newlib"
fi
@@ -3577,7 +3577,7 @@ fi
with_glibc_src=$with_glibc_src
else
- with_glibc_src="\$(srcdir)/riscv-glibc"
+ with_glibc_src="\$(srcdir)/glibc"
fi
@@ -3596,7 +3596,7 @@ fi
with_musl_src=$with_musl_src
else
- with_musl_src="\$(srcdir)/riscv-musl"
+ with_musl_src="\$(srcdir)/musl"
fi
@@ -4820,4 +4820,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
-
diff --git a/configure.ac b/configure.ac
index c977f5c..78095a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,7 +89,7 @@ AC_SUBST(WITH_TUNE, --with-tune=$with_tune)
AC_ARG_ENABLE(multilib,
[AS_HELP_STRING([--enable-multilib],
- [build both RV32 and RV64 runtime libraries @<:@--disable-multilib@:>@])],
+ [build both RV32 and RV64 runtime libraries (only RV64 for musl libc) @<:@--disable-multilib@:>@])],
[],
[enable_multilib=no]
)
@@ -118,6 +118,10 @@ AS_IF([test "x$enable_multilib" != xno],
[AC_SUBST(newlib_multilib_names,"rv32i-ilp32 rv32iac-ilp32 rv32im-ilp32 rv32imac-ilp32 rv32imafc-ilp32f rv64imac-lp64 rv64imafdc-lp64d")],
[AC_SUBST(newlib_multilib_names,"$with_arch-$with_abi")])
+AS_IF([test "x$enable_multilib" != xno],
+ [AC_SUBST(musl_multilib_names,"rv64imac-lp64 rv64imafdc-lp64d")],
+ [AC_SUBST(musl_multilib_names,"$with_arch-$with_abi")])
+
AC_ARG_ENABLE(gcc-checking,
[AS_HELP_STRING([--enable-gcc-checking],
[Enable gcc internal checking, it will make gcc very slow, only enable it when developing gcc @<:@--disable-gcc-checking@:>@])],
@@ -217,9 +221,9 @@ AC_DEFUN([AX_ARG_WITH_SRC],
AX_ARG_WITH_SRC(gcc, riscv-gcc)
AX_ARG_WITH_SRC(binutils, riscv-binutils)
-AX_ARG_WITH_SRC(newlib, riscv-newlib)
-AX_ARG_WITH_SRC(glibc, riscv-glibc)
-AX_ARG_WITH_SRC(musl, riscv-musl)
+AX_ARG_WITH_SRC(newlib, newlib)
+AX_ARG_WITH_SRC(glibc, glibc)
+AX_ARG_WITH_SRC(musl, musl)
AX_ARG_WITH_SRC(gdb, riscv-gdb)
AX_ARG_WITH_SRC(qemu, qemu)
diff --git a/riscv-glibc b/glibc
-Subproject 9826b03b747b841f5fc6de2054bf1ef3f5c4bdf
+Subproject 9826b03b747b841f5fc6de2054bf1ef3f5c4bdf
diff --git a/musl b/musl
new file mode 160000
+Subproject 85e0e3519655220688e757b9d5bfd314923548b
diff --git a/riscv-newlib b/newlib
-Subproject 415fdd4279b85eeec9d54775ce13c5c412451e0
+Subproject 415fdd4279b85eeec9d54775ce13c5c412451e0