Rollup merge of #122049 - Amanieu:riscv64-musl-tier2, r=Mark-Simulacrum

Promote riscv64gc-unknown-linux-musl to tier 2
This commit is contained in:
Matthias Krüger 2024-08-05 23:35:22 +02:00 committed by GitHub
commit 8cbf1c1b22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 63 additions and 3 deletions

View File

@ -21,6 +21,7 @@ pub fn target() -> Target {
llvm_abiname: "lp64d".into(), llvm_abiname: "lp64d".into(),
max_atomic_width: Some(64), max_atomic_width: Some(64),
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]), supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
crt_static_default: false,
..base::linux_musl::opts() ..base::linux_musl::opts()
}, },
} }

View File

@ -24,7 +24,8 @@ RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no
# Needed for apt-key to work: # Needed for apt-key to work:
dirmngr \ dirmngr \
gpg-agent \ gpg-agent \
g++-9-arm-linux-gnueabi g++-9-arm-linux-gnueabi \
g++-11-riscv64-linux-gnu
RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486 RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486
RUN add-apt-repository -y 'deb https://apt.dilos.org/dilos dilos2 main' RUN add-apt-repository -y 'deb https://apt.dilos.org/dilos dilos2 main'
@ -73,6 +74,10 @@ RUN env \
CC=arm-linux-gnueabi-gcc-9 CFLAGS="-march=armv7-a" \ CC=arm-linux-gnueabi-gcc-9 CFLAGS="-march=armv7-a" \
CXX=arm-linux-gnueabi-g++-9 CXXFLAGS="-march=armv7-a" \ CXX=arm-linux-gnueabi-g++-9 CXXFLAGS="-march=armv7-a" \
bash musl.sh armv7 && \ bash musl.sh armv7 && \
env \
CC=riscv64-linux-gnu-gcc-11 \
CXX=riscv64-linux-gnu-g++-11 \
bash musl.sh riscv64gc && \
rm -rf /build/* rm -rf /build/*
WORKDIR /tmp WORKDIR /tmp
@ -125,6 +130,7 @@ ENV TARGETS=$TARGETS,x86_64-unknown-none
ENV TARGETS=$TARGETS,aarch64-unknown-uefi ENV TARGETS=$TARGETS,aarch64-unknown-uefi
ENV TARGETS=$TARGETS,i686-unknown-uefi ENV TARGETS=$TARGETS,i686-unknown-uefi
ENV TARGETS=$TARGETS,x86_64-unknown-uefi ENV TARGETS=$TARGETS,x86_64-unknown-uefi
ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-musl
# As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211 # As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211
# we need asm in the search path for gcc-9 (for gnux32) but not in the search path of the # we need asm in the search path for gcc-9 (for gnux32) but not in the search path of the
@ -132,7 +138,11 @@ ENV TARGETS=$TARGETS,x86_64-unknown-uefi
# Luckily one of the folders is /usr/local/include so symlink /usr/include/x86_64-linux-gnu/asm there # Luckily one of the folders is /usr/local/include so symlink /usr/include/x86_64-linux-gnu/asm there
RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm
# musl-gcc can't find libgcc_s.so.1 since it doesn't use the standard search paths.
RUN ln -s /usr/riscv64-linux-gnu/lib/libgcc_s.so.1 /usr/lib/gcc-cross/riscv64-linux-gnu/11/
ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs \ ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs \
--musl-root-armv7=/musl-armv7 --musl-root-armv7=/musl-armv7 \
--musl-root-riscv64gc=/musl-riscv64gc
ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS

View File

@ -66,6 +66,7 @@
- [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md) - [riscv32imac-unknown-xous-elf](platform-support/riscv32imac-unknown-xous-elf.md)
- [riscv32*-unknown-none-elf](platform-support/riscv32-unknown-none-elf.md) - [riscv32*-unknown-none-elf](platform-support/riscv32-unknown-none-elf.md)
- [riscv64gc-unknown-linux-gnu](platform-support/riscv64gc-unknown-linux-gnu.md) - [riscv64gc-unknown-linux-gnu](platform-support/riscv64gc-unknown-linux-gnu.md)
- [riscv64gc-unknown-linux-musl](platform-support/riscv64gc-unknown-linux-musl.md)
- [sparc-unknown-none-elf](./platform-support/sparc-unknown-none-elf.md) - [sparc-unknown-none-elf](./platform-support/sparc-unknown-none-elf.md)
- [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md) - [*-pc-windows-gnullvm](platform-support/pc-windows-gnullvm.md)
- [\*-nto-qnx-\*](platform-support/nto-qnx.md) - [\*-nto-qnx-\*](platform-support/nto-qnx.md)

View File

@ -98,6 +98,7 @@ target | notes
`powerpc64-unknown-linux-gnu` | PPC64 Linux (kernel 3.2, glibc 2.17) `powerpc64-unknown-linux-gnu` | PPC64 Linux (kernel 3.2, glibc 2.17)
`powerpc64le-unknown-linux-gnu` | PPC64LE Linux (kernel 3.10, glibc 2.17) `powerpc64le-unknown-linux-gnu` | PPC64LE Linux (kernel 3.10, glibc 2.17)
[`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20, glibc 2.29) [`riscv64gc-unknown-linux-gnu`](platform-support/riscv64gc-unknown-linux-gnu.md) | RISC-V Linux (kernel 4.20, glibc 2.29)
[`riscv64gc-unknown-linux-musl`](platform-support/riscv64gc-unknown-linux-musl.md) | RISC-V Linux (kernel 4.20, musl 1.2.3)
`s390x-unknown-linux-gnu` | S390x Linux (kernel 3.2, glibc 2.17) `s390x-unknown-linux-gnu` | S390x Linux (kernel 3.2, glibc 2.17)
`x86_64-unknown-freebsd` | 64-bit FreeBSD `x86_64-unknown-freebsd` | 64-bit FreeBSD
`x86_64-unknown-illumos` | illumos `x86_64-unknown-illumos` | illumos
@ -354,7 +355,6 @@ target | std | host | notes
[`riscv64gc-unknown-hermit`](platform-support/hermit.md) | ✓ | | RISC-V Hermit [`riscv64gc-unknown-hermit`](platform-support/hermit.md) | ✓ | | RISC-V Hermit
`riscv64gc-unknown-freebsd` | | | RISC-V FreeBSD `riscv64gc-unknown-freebsd` | | | RISC-V FreeBSD
`riscv64gc-unknown-fuchsia` | | | RISC-V Fuchsia `riscv64gc-unknown-fuchsia` | | | RISC-V Fuchsia
`riscv64gc-unknown-linux-musl` | | | RISC-V Linux (kernel 4.20, musl 1.2.3)
[`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | RISC-V NetBSD [`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | RISC-V NetBSD
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64 [`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
[`riscv64-linux-android`](platform-support/android.md) | | | RISC-V 64-bit Android [`riscv64-linux-android`](platform-support/android.md) | | | RISC-V 64-bit Android

View File

@ -0,0 +1,47 @@
# riscv64gc-unknown-linux-musl
**Tier: 2**
Target for RISC-V Linux programs using musl libc.
## Target maintainers
- [@Amanieu](https://github.com/Amanieu)
- [@kraj](https://github.com/kraj)
## Requirements
Building the target itself requires a RISC-V compiler that is supported by `cc-rs`.
## Building the target
The target can be built by enabling it for a `rustc` build.
```toml
[build]
target = ["riscv64gc-unknown-linux-musl"]
```
Make sure your C compiler is included in `$PATH`, then add it to the `config.toml`:
```toml
[target.riscv64gc-unknown-linux-musl]
cc = "riscv64-linux-gnu-gcc"
cxx = "riscv64-linux-gnu-g++"
ar = "riscv64-linux-gnu-ar"
linker = "riscv64-linux-gnu-gcc"
```
## Building Rust programs
This target are distributed through `rustup`, and otherwise require no
special configuration.
## Cross-compilation
This target can be cross-compiled from any host.
## Testing
This target can be tested as normal with `x.py` on a RISC-V host or via QEMU
emulation.

View File

@ -141,6 +141,7 @@
"riscv64gc-unknown-hermit", "riscv64gc-unknown-hermit",
"riscv64gc-unknown-none-elf", "riscv64gc-unknown-none-elf",
"riscv64gc-unknown-linux-gnu", "riscv64gc-unknown-linux-gnu",
"riscv64gc-unknown-linux-musl",
"s390x-unknown-linux-gnu", "s390x-unknown-linux-gnu",
"sparc64-unknown-linux-gnu", "sparc64-unknown-linux-gnu",
"sparcv9-sun-solaris", "sparcv9-sun-solaris",