Skip to content

Commit 372e33e

Browse files
authored
Merge pull request #1032 from florianhofhammer/feature/update-submodules
Rename glibc, newlib submodules and add musl submodule
2 parents cc1075c + 629c67e commit 372e33e

File tree

10 files changed

+68
-24
lines changed

10 files changed

+68
-24
lines changed

.github/workflows/build.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ubuntu-18.04, ubuntu-20.04]
17-
mode: [newlib, linux]
17+
mode: [newlib, linux, musl]
1818
target: [rv32gc-ilp32d, rv64gc-lp64d]
19+
exclude:
20+
- mode: musl
21+
target: rv32gc-ilp32d
1922
steps:
2023
- uses: actions/checkout@v2
2124

@@ -40,7 +43,14 @@ jobs:
4043
id: toolchain-name-generator
4144
run: |
4245
if [[ "${{ matrix.target }}" == *"32"* ]]; then BITS=32; else BITS=64; fi
43-
if [[ "${{ matrix.mode }}" == "linux" ]]; then MODE="glibc"; else MODE="elf"; fi
46+
case "${{ matrix.mode }}" in
47+
"linux")
48+
MODE="glibc";;
49+
"musl")
50+
MODE="musl";;
51+
*)
52+
MODE="elf";;
53+
esac
4454
echo ::set-output name=TOOLCHAIN_NAME::riscv$BITS-$MODE-${{ matrix.os }}-nightly
4555
4656
- uses: actions/upload-artifact@v2

.github/workflows/nightly-release.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ jobs:
4949
strategy:
5050
matrix:
5151
os: [ubuntu-18.04, ubuntu-20.04]
52-
mode: [newlib, linux]
52+
mode: [newlib, linux, musl]
5353
target: [rv32gc-ilp32d, rv64gc-lp64d]
54+
exclude:
55+
- mode: musl
56+
target: rv32gc-ilp32d
5457
steps:
5558
- uses: actions/checkout@v2
5659

@@ -75,7 +78,14 @@ jobs:
7578
id: toolchain-name-generator
7679
run: |
7780
if [[ "${{ matrix.target }}" == *"32"* ]]; then BITS=32; else BITS=64; fi
78-
if [[ "${{ matrix.mode }}" == "linux" ]]; then MODE="glibc"; else MODE="elf"; fi
81+
case "${{ matrix.mode }}" in
82+
"linux")
83+
MODE="glibc";;
84+
"musl")
85+
MODE="musl";;
86+
*)
87+
MODE="elf";;
88+
esac
7989
echo ::set-output name=TOOLCHAIN_NAME::riscv$BITS-$MODE-${{ matrix.os }}-nightly
8090
8191
- uses: actions/upload-artifact@v2

.gitmodules

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
path = riscv-gcc
77
url = https://github.com/riscv-collab/riscv-gcc.git
88
branch = riscv-gcc-10.2.0
9-
[submodule "riscv-glibc"]
10-
path = riscv-glibc
9+
[submodule "glibc"]
10+
path = glibc
1111
url = git://sourceware.org/git/glibc.git
1212
[submodule "riscv-dejagnu"]
1313
path = riscv-dejagnu
1414
url = https://github.com/riscv-collab/riscv-dejagnu.git
1515
branch = riscv-dejagnu-1.6
16-
[submodule "riscv-newlib"]
17-
path = riscv-newlib
16+
[submodule "newlib"]
17+
path = newlib
1818
url = git://sourceware.org/git/newlib-cygwin.git
1919
branch = master
2020
[submodule "riscv-gdb"]
@@ -24,3 +24,7 @@
2424
[submodule "qemu"]
2525
path = qemu
2626
url = https://git.qemu.org/git/qemu.git
27+
[submodule "musl"]
28+
path = musl
29+
url = git://git.musl-libc.org/musl
30+
branch = master

Makefile.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ CONFIGURE_HOST = @configure_host@
102102
all: @default_target@
103103
newlib: stamps/build-gcc-newlib-stage2
104104
linux: stamps/build-gcc-linux-stage2
105+
ifneq (,$(findstring riscv32,$(MUSL_TUPLE)))
106+
.PHONY: musl
107+
musl:
108+
@echo "musl only supports 64bit builds." && exit 1
109+
else
105110
musl: stamps/build-gcc-musl-stage2
111+
endif
106112
ifeq (@enable_gdb@,--enable-gdb)
107113
newlib: stamps/build-gdb-newlib
108114
linux: stamps/build-gdb-linux

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,15 @@ run the following command:
6868
./configure --prefix=/opt/riscv
6969
make linux
7070

71-
The build defaults to targetting RV64GC (64-bit), even on a 32-bit build
72-
environment. To build the 32-bit RV32GC toolchain, use:
71+
The build defaults to targeting RV64GC (64-bit) with glibc, even on a 32-bit
72+
build environment. To build the 32-bit RV32GC toolchain, use:
7373

7474
./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32d
7575
make linux
7676

77+
In case you prefer musl libc over glibc, configure just like above and opt for
78+
`make musl` instead of `make linux`.
79+
7780
Supported architectures are rv32i or rv64i plus standard extensions (a)tomics,
7881
(m)ultiplication and division, (f)loat, (d)ouble, or (g)eneral for MAFD.
7982

@@ -88,11 +91,19 @@ To build either cross-compiler with support for both 32-bit and
8891

8992
./configure --prefix=/opt/riscv --enable-multilib
9093

91-
And then either `make` or `make linux` for the Newlib or Linux cross-compiler respectively.
94+
And then either `make`, `make linux` or `make musl` for the Newlib, Linux
95+
glibc-based or Linux musl libc-based cross-compiler, respectively.
96+
97+
The multilib compiler will have the prefix riscv64-unknown-elf- or
98+
riscv64-unknown-linux-gnu- but will be able to target both 32-bit and 64-bit
99+
systems.
100+
It will support the most common `-march`/`-mabi` options, which can be seen by
101+
using the `--print-multi-lib` flag on either cross-compiler.
92102

93-
The multilib compiler will have the prefix riscv64-unknown-elf- or riscv64-unknown-linux-gnu-,
94-
but will be able to target both 32-bit and 64-bit systems. It will support
95-
the most common `-march`/`-mabi` options, which can be seen by using the `--print-multi-lib` flag on either cross-compiler.
103+
The musl compiler (riscv64-unknown-linux-musl-) will only be able to target
104+
64-bit systems due to limitations in the upstream musl architecture support.
105+
The `--enable-multilib` flag therefore does not actually enable multilib support
106+
for musl libc.
96107

97108
### Troubleshooting Build Problems
98109

@@ -241,4 +252,3 @@ Here is the list of configure option for specify source tree:
241252
--with-gdb-src
242253
--with-linux-headers-src
243254
--with-qemu-src
244-

configure

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ Optional Features:
13201320
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
13211321
--enable-linux set linux as the default make target
13221322
[--disable-linux]
1323-
--enable-multilib build both RV32 and RV64 runtime libraries
1323+
--enable-multilib build both RV32 and RV64 runtime libraries (only RV64 for musl libc)
13241324
[--disable-multilib]
13251325
--enable-gcc-checking Enable gcc internal checking, it will make gcc very
13261326
slow, only enable it when developing gcc
@@ -3558,7 +3558,7 @@ fi
35583558
with_newlib_src=$with_newlib_src
35593559
35603560
else
3561-
with_newlib_src="\$(srcdir)/riscv-newlib"
3561+
with_newlib_src="\$(srcdir)/newlib"
35623562
35633563
fi
35643564
@@ -3577,7 +3577,7 @@ fi
35773577
with_glibc_src=$with_glibc_src
35783578
35793579
else
3580-
with_glibc_src="\$(srcdir)/riscv-glibc"
3580+
with_glibc_src="\$(srcdir)/glibc"
35813581
35823582
fi
35833583
@@ -3596,7 +3596,7 @@ fi
35963596
with_musl_src=$with_musl_src
35973597
35983598
else
3599-
with_musl_src="\$(srcdir)/riscv-musl"
3599+
with_musl_src="\$(srcdir)/musl"
36003600
36013601
fi
36023602
@@ -4820,4 +4820,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
48204820
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
48214821
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
48224822
fi
4823-

configure.ac

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ AC_SUBST(WITH_TUNE, --with-tune=$with_tune)
8989

9090
AC_ARG_ENABLE(multilib,
9191
[AS_HELP_STRING([--enable-multilib],
92-
[build both RV32 and RV64 runtime libraries @<:@--disable-multilib@:>@])],
92+
[build both RV32 and RV64 runtime libraries (only RV64 for musl libc) @<:@--disable-multilib@:>@])],
9393
[],
9494
[enable_multilib=no]
9595
)
@@ -118,6 +118,10 @@ AS_IF([test "x$enable_multilib" != xno],
118118
[AC_SUBST(newlib_multilib_names,"rv32i-ilp32 rv32iac-ilp32 rv32im-ilp32 rv32imac-ilp32 rv32imafc-ilp32f rv64imac-lp64 rv64imafdc-lp64d")],
119119
[AC_SUBST(newlib_multilib_names,"$with_arch-$with_abi")])
120120

121+
AS_IF([test "x$enable_multilib" != xno],
122+
[AC_SUBST(musl_multilib_names,"rv64imac-lp64 rv64imafdc-lp64d")],
123+
[AC_SUBST(musl_multilib_names,"$with_arch-$with_abi")])
124+
121125
AC_ARG_ENABLE(gcc-checking,
122126
[AS_HELP_STRING([--enable-gcc-checking],
123127
[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],
217221

218222
AX_ARG_WITH_SRC(gcc, riscv-gcc)
219223
AX_ARG_WITH_SRC(binutils, riscv-binutils)
220-
AX_ARG_WITH_SRC(newlib, riscv-newlib)
221-
AX_ARG_WITH_SRC(glibc, riscv-glibc)
222-
AX_ARG_WITH_SRC(musl, riscv-musl)
224+
AX_ARG_WITH_SRC(newlib, newlib)
225+
AX_ARG_WITH_SRC(glibc, glibc)
226+
AX_ARG_WITH_SRC(musl, musl)
223227
AX_ARG_WITH_SRC(gdb, riscv-gdb)
224228
AX_ARG_WITH_SRC(qemu, qemu)
225229

riscv-glibc renamed to glibc

Submodule glibc updated from 0000000 to 9826b03

musl

Submodule musl added at 85e0e35

riscv-newlib renamed to newlib

Submodule newlib updated from 0000000 to 415fdd4

0 commit comments

Comments
 (0)