Skip to content

Commit bacd9d8

Browse files
authored
Merge pull request #4378 from tgross35/backport-enoki
[0.2] Backports
2 parents 5f6db4c + f202ec4 commit bacd9d8

File tree

37 files changed

+1590
-228
lines changed

37 files changed

+1590
-228
lines changed

.github/workflows/ci.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ on:
77
- libc-0.2
88

99
env:
10+
CARGO_TERM_COLOR: always
1011
CARGO_TERM_VERBOSE: true
1112
LIBC_CI: 1
13+
RUSTDOCFLAGS: -Dwarnings
14+
RUSTFLAGS: -Dwarnings
15+
RUST_BACKTRACE: full
1216

1317
defaults:
1418
run:
@@ -42,6 +46,12 @@ jobs:
4246
TOOLCHAIN: ${{ matrix.toolchain }}
4347
steps:
4448
- uses: actions/checkout@v4
49+
# Remove `-Dwarnings` at the MSRV since lints may be different or buffier
50+
- name: Update RUSTFLAGS
51+
run: |
52+
set -eux
53+
[ "${{ matrix.toolchain }}" = "1.63.0" ] && echo 'RUSTFLAGS=' >> "$GITHUB_ENV" || true
54+
4555
- name: Setup Rust toolchain
4656
run: ./ci/install-rust.sh
4757

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
FROM ubuntu:24.10
22

33
RUN apt-get update && apt-get install -y --no-install-recommends \
4-
ca-certificates curl gcc git libc6-dev make qemu-user xz-utils
4+
ca-certificates curl gcc gcc-14-loongarch64-linux-gnu git libc6-dev \
5+
make qemu-user xz-utils patch rsync
56

6-
COPY install-musl-cross.sh /
7-
RUN /install-musl-cross.sh loongarch64-unknown-linux-musl
7+
COPY install-musl.sh /
8+
RUN /install-musl.sh loongarch64
89

9-
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc \
10+
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \
1011
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \
11-
CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \
12+
CC_loongarch64_unknown_linux_musl=musl-gcc \
1213
CFLAGS_loongarch64_unknown_linux_musl="-mabi=lp64d -fPIC" \
13-
QEMU_LD_PREFIX=/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot \
14-
PATH=$PATH:/loongarch64-unknown-linux-musl/bin:/rust/bin
14+
RUSTFLAGS="-Ctarget-feature=+crt-static" \
15+
QEMU_LD_PREFIX=/musl-loongarch64 \
16+
PATH=$PATH:/musl-loongarch64/bin:/rust/bin

ci/install-musl-cross.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

ci/install-musl.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55

66
set -eux
77

8-
musl_version=1.1.24
8+
case ${1} in
9+
loongarch64)
10+
musl_version=1.2.5
11+
;;
12+
*)
13+
musl_version=1.1.24
14+
;;
15+
esac
16+
917
musl="musl-${musl_version}"
1018

1119
# Download, configure, build, and install musl:
@@ -53,6 +61,13 @@ case ${1} in
5361
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
5462
make install -j4
5563
;;
64+
loongarch64)
65+
musl_arch=loongarch64
66+
kernel_arch=loongarch
67+
CC=loongarch64-linux-gnu-gcc-14 \
68+
./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes
69+
make install -j4
70+
;;
5671
*)
5772
echo "Unknown target arch: \"${1}\""
5873
exit 1

libc-test/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ description = """
1212
A test crate for the libc crate.
1313
"""
1414

15-
[dependencies.libc]
16-
path = ".."
17-
version = "0.2.171"
18-
default-features = false
15+
[dependencies]
16+
cfg-if = "1.0.0"
17+
libc = { path = "..", version = "0.2.171", default-features = false }
1918

2019
[dev-dependencies]
2120
syn = { version = "2.0.91", features = ["full", "visit"] }

libc-test/build.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn src_hotfix_dir() -> PathBuf {
1313

1414
fn do_cc() {
1515
let target = env::var("TARGET").unwrap();
16-
if cfg!(unix) {
16+
if cfg!(unix) || target.contains("cygwin") {
1717
let exclude = ["redox", "wasi", "wali"];
1818
if !exclude.iter().any(|x| target.contains(x)) {
1919
let mut cmsg = cc::Build::new();
@@ -700,6 +700,7 @@ fn test_cygwin(target: &str) {
700700
"dlfcn.h",
701701
"errno.h",
702702
"fcntl.h",
703+
"fnmatch.h",
703704
"grp.h",
704705
"iconv.h",
705706
"langinfo.h",
@@ -710,11 +711,13 @@ fn test_cygwin(target: &str) {
710711
"netinet/tcp.h",
711712
"poll.h",
712713
"pthread.h",
714+
"pty.h",
713715
"pwd.h",
714716
"resolv.h",
715717
"sched.h",
716718
"semaphore.h",
717719
"signal.h",
720+
"spawn.h",
718721
"stddef.h",
719722
"stdlib.h",
720723
"string.h",
@@ -734,6 +737,7 @@ fn test_cygwin(target: &str) {
734737
"sys/uio.h",
735738
"sys/un.h",
736739
"sys/utsname.h",
740+
"sys/vfs.h",
737741
"syslog.h",
738742
"termios.h",
739743
"unistd.h",
@@ -853,7 +857,7 @@ fn test_cygwin(target: &str) {
853857
}
854858
});
855859

856-
cfg.generate("../src/lib.rs", "main.rs");
860+
cfg.generate(src_hotfix_dir().join("lib.rs"), "main.rs");
857861
}
858862

859863
fn test_windows(target: &str) {
@@ -1049,6 +1053,13 @@ fn test_solarish(target: &str) {
10491053
cfg.define("__EXTENSIONS__", None);
10501054
cfg.define("_LCONV_C99", None);
10511055

1056+
// FIXME(solaris): This should be removed once new Nix crate is released.
1057+
// See comment in src/unix/solarish/solaris.rs for these.
1058+
if is_solaris {
1059+
cfg.define("O_DIRECT", Some("0x2000000"));
1060+
cfg.define("SIGINFO", Some("41"));
1061+
}
1062+
10521063
headers! {
10531064
cfg:
10541065
"aio.h",
@@ -1307,6 +1318,10 @@ fn test_solarish(target: &str) {
13071318
// https://github.com/gnzlbg/ctest/issues/68
13081319
"lio_listio" => true,
13091320

1321+
// Exists on illumos too but, for now, is
1322+
// [a recent addition](https://www.illumos.org/issues/17094).
1323+
"secure_getenv" if is_illumos => true,
1324+
13101325
_ => false,
13111326
}
13121327
});
@@ -4136,8 +4151,7 @@ fn test_linux(target: &str) {
41364151
"epoll_params" => true,
41374152

41384153
// FIXME(linux): Requires >= 6.12 kernel headers.
4139-
"dmabuf_cmsg" |
4140-
"dmabuf_token" => true,
4154+
"dmabuf_cmsg" | "dmabuf_token" => true,
41414155

41424156
_ => false,
41434157
}

libc-test/semver/android.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,8 +1793,11 @@ NLMSG_MIN_TYPE
17931793
NLMSG_NOOP
17941794
NLMSG_OVERRUN
17951795
NLM_F_ACK
1796+
NLM_F_ACK_TLVS
17961797
NLM_F_APPEND
17971798
NLM_F_ATOMIC
1799+
NLM_F_BULK
1800+
NLM_F_CAPPED
17981801
NLM_F_CREATE
17991802
NLM_F_DUMP
18001803
NLM_F_DUMP_FILTERED
@@ -1803,6 +1806,7 @@ NLM_F_ECHO
18031806
NLM_F_EXCL
18041807
NLM_F_MATCH
18051808
NLM_F_MULTI
1809+
NLM_F_NONREC
18061810
NLM_F_REPLACE
18071811
NLM_F_REQUEST
18081812
NLM_F_ROOT
@@ -2222,10 +2226,16 @@ SCM_CREDENTIALS
22222226
SCM_RIGHTS
22232227
SCM_TIMESTAMP
22242228
SCM_TIMESTAMPING
2229+
SECCOMP_ADDFD_FLAG_SEND
2230+
SECCOMP_ADDFD_FLAG_SETFD
22252231
SECCOMP_FILTER_FLAG_LOG
22262232
SECCOMP_FILTER_FLAG_NEW_LISTENER
22272233
SECCOMP_FILTER_FLAG_SPEC_ALLOW
22282234
SECCOMP_FILTER_FLAG_TSYNC
2235+
SECCOMP_FILTER_FLAG_TSYNC_ESRCH
2236+
SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV
2237+
SECCOMP_GET_ACTION_AVAIL
2238+
SECCOMP_GET_NOTIF_SIZES
22292239
SECCOMP_MODE_DISABLED
22302240
SECCOMP_MODE_FILTER
22312241
SECCOMP_MODE_STRICT
@@ -2241,6 +2251,9 @@ SECCOMP_RET_LOG
22412251
SECCOMP_RET_TRACE
22422252
SECCOMP_RET_TRAP
22432253
SECCOMP_RET_USER_NOTIF
2254+
SECCOMP_SET_MODE_FILTER
2255+
SECCOMP_SET_MODE_STRICT
2256+
SECCOMP_USER_NOTIF_FLAG_CONTINUE
22442257
SEEK_CUR
22452258
SEEK_DATA
22462259
SEEK_END
@@ -3325,6 +3338,7 @@ fwrite_unlocked
33253338
gai_strerror
33263339
genlmsghdr
33273340
getaddrinfo
3341+
getauxval
33283342
getchar
33293343
getchar_unlocked
33303344
getcwd

0 commit comments

Comments
 (0)