Skip to content

Commit bea7771

Browse files
authored
Merge pull request #4039 from tgross35/backport-waxbeans
[0.2] Backports
2 parents 4afdaf5 + 6c8488a commit bea7771

File tree

9 files changed

+269
-318
lines changed

9 files changed

+269
-318
lines changed

ci/emscripten.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
set -ex
44

5-
# FIXME: 3.1.21 removed a lot of header files (https://github.com/emscripten-core/emscripten/pull/17704).
6-
# We have to tweak libc-test (and deprecate unsupported items, maybe) when updating emsdk.
7-
EMSDK_VERSION=3.1.20
5+
# Note: keep in sync with:
6+
# https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh
7+
EMSDK_VERSION=3.1.68
88

99
git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
1010
cd /emsdk-portable

libc-test/build.rs

+52-74
Original file line numberDiff line numberDiff line change
@@ -2072,6 +2072,18 @@ fn test_android(target: &str) {
20722072
// Added in API level 28, but some tests use level 24.
20732073
"fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" => true,
20742074

2075+
// Added in API level 28, but some tests use level 24.
2076+
"aligned_alloc" => true,
2077+
2078+
// Added in API level 26, but some tests use level 24.
2079+
"getgrent" => true,
2080+
2081+
// Added in API level 26, but some tests use level 24.
2082+
"setgrent" => true,
2083+
2084+
// Added in API level 26, but some tests use level 24.
2085+
"endgrent" => true,
2086+
20752087
// FIXME: bad function pointers:
20762088
"isalnum" | "isalpha" | "iscntrl" | "isdigit" | "isgraph" | "islower" | "isprint"
20772089
| "ispunct" | "isspace" | "isupper" | "isxdigit" | "isblank" | "tolower"
@@ -2782,7 +2794,6 @@ fn test_emscripten(target: &str) {
27822794
cfg.define("_GNU_SOURCE", None); // FIXME: ??
27832795

27842796
headers! { cfg:
2785-
"aio.h",
27862797
"ctype.h",
27872798
"dirent.h",
27882799
"dlfcn.h",
@@ -2823,32 +2834,21 @@ fn test_emscripten(target: &str) {
28232834
"stdio.h",
28242835
"stdlib.h",
28252836
"string.h",
2826-
"sys/epoll.h",
2827-
"sys/eventfd.h",
28282837
"sys/file.h",
28292838
"sys/ioctl.h",
28302839
"sys/ipc.h",
28312840
"sys/mman.h",
28322841
"sys/mount.h",
28332842
"sys/msg.h",
2834-
"sys/personality.h",
2835-
"sys/prctl.h",
2836-
"sys/ptrace.h",
2837-
"sys/quota.h",
2838-
"sys/reboot.h",
28392843
"sys/resource.h",
28402844
"sys/sem.h",
28412845
"sys/shm.h",
2842-
"sys/signalfd.h",
28432846
"sys/socket.h",
28442847
"sys/stat.h",
28452848
"sys/statvfs.h",
2846-
"sys/swap.h",
28472849
"sys/syscall.h",
2848-
"sys/sysctl.h",
28492850
"sys/sysinfo.h",
28502851
"sys/time.h",
2851-
"sys/timerfd.h",
28522852
"sys/times.h",
28532853
"sys/types.h",
28542854
"sys/uio.h",
@@ -2874,9 +2874,7 @@ fn test_emscripten(target: &str) {
28742874
// Just pass all these through, no need for a "struct" prefix
28752875
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
28762876

2877-
"os_unfair_lock" => "struct os_unfair_lock_s".to_string(),
2878-
2879-
// LFS64 types have been removed in Emscripten 3.1.44+
2877+
// LFS64 types have been removed in Emscripten 3.1.44
28802878
// https://github.com/emscripten-core/emscripten/pull/19812
28812879
"off64_t" => "off_t".to_string(),
28822880

@@ -2900,7 +2898,7 @@ fn test_emscripten(target: &str) {
29002898
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
29012899
s.replace("e_nsec", ".tv_nsec")
29022900
}
2903-
// FIXME: appears that `epoll_event.data` is an union
2901+
// Rust struct uses raw u64, rather than union
29042902
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
29052903
s => s.to_string(),
29062904
}
@@ -2912,10 +2910,11 @@ fn test_emscripten(target: &str) {
29122910
// FIXME: is this necessary?
29132911
"sighandler_t" => true,
29142912

2915-
// FIXME: The size has been changed due to musl's time64
2916-
"time_t" => true,
2913+
// No epoll support
2914+
// https://github.com/emscripten-core/emscripten/issues/5033
2915+
ty if ty.starts_with("epoll") => true,
29172916

2918-
// LFS64 types have been removed in Emscripten 3.1.44+
2917+
// LFS64 types have been removed in Emscripten 3.1.44
29192918
// https://github.com/emscripten-core/emscripten/pull/19812
29202919
t => t.ends_with("64") || t.ends_with("64_t"),
29212920
}
@@ -2924,29 +2923,19 @@ fn test_emscripten(target: &str) {
29242923
cfg.skip_struct(move |ty| {
29252924
match ty {
29262925
// This is actually a union, not a struct
2927-
// FIXME: is this necessary?
29282926
"sigval" => true,
29292927

2930-
// FIXME: It was removed in
2931-
// emscripten-core/emscripten@953e414
2932-
"pthread_mutexattr_t" => true,
2933-
29342928
// FIXME: Investigate why the test fails.
29352929
// Skip for now to unblock CI.
29362930
"pthread_condattr_t" => true,
2931+
"pthread_mutexattr_t" => true,
29372932

2938-
// FIXME: The size has been changed when upgraded to musl 1.2.2
2939-
"pthread_mutex_t" => true,
2940-
2941-
// FIXME: Lowered from 16 to 8 bytes in
2942-
// llvm/llvm-project@d1a96e9
2943-
"max_align_t" => true,
2944-
2945-
// FIXME: The size has been changed due to time64
2946-
"utimbuf" | "timeval" | "timespec" | "rusage" | "itimerval" | "sched_param"
2947-
| "stat" | "stat64" | "shmid_ds" | "msqid_ds" => true,
2933+
// No epoll support
2934+
// https://github.com/emscripten-core/emscripten/issues/5033
2935+
ty if ty.starts_with("epoll") => true,
2936+
ty if ty.starts_with("signalfd") => true,
29482937

2949-
// LFS64 types have been removed in Emscripten 3.1.44+
2938+
// LFS64 types have been removed in Emscripten 3.1.44
29502939
// https://github.com/emscripten-core/emscripten/pull/19812
29512940
ty => ty.ends_with("64") || ty.ends_with("64_t"),
29522941
}
@@ -2955,12 +2944,9 @@ fn test_emscripten(target: &str) {
29552944
cfg.skip_fn(move |name| {
29562945
match name {
29572946
// Emscripten does not support fork/exec/wait or any kind of multi-process support
2958-
// https://github.com/emscripten-core/emscripten/blob/3.1.30/tools/system_libs.py#L973
2947+
// https://github.com/emscripten-core/emscripten/blob/3.1.68/tools/system_libs.py#L1100
29592948
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" | "wait4" => true,
29602949

2961-
// FIXME: Remove after emscripten-core/emscripten#18492 is released (> 3.1.30).
2962-
"clearenv" => true,
2963-
29642950
_ => false,
29652951
}
29662952
});
@@ -2974,23 +2960,35 @@ fn test_emscripten(target: &str) {
29742960
// FIXME: emscripten uses different constants to constructs these
29752961
n if n.contains("__SIZEOF_PTHREAD") => true,
29762962

2977-
// FIXME: `SYS_gettid` was removed in
2978-
// emscripten-core/emscripten@6d6474e
2963+
// No epoll support
2964+
// https://github.com/emscripten-core/emscripten/issues/5033
2965+
n if n.starts_with("EPOLL") => true,
2966+
2967+
// No ptrace.h
2968+
// https://github.com/emscripten-core/emscripten/pull/17704
2969+
n if n.starts_with("PTRACE_") => true,
2970+
2971+
// No quota.h
2972+
// https://github.com/emscripten-core/emscripten/pull/17704
2973+
n if n.starts_with("QIF_") => true,
2974+
"USRQUOTA" | "GRPQUOTA" | "Q_GETFMT" | "Q_GETINFO" | "Q_SETINFO" | "Q_SYNC"
2975+
| "Q_QUOTAON" | "Q_QUOTAOFF" | "Q_GETQUOTA" | "Q_SETQUOTA" => true,
2976+
2977+
// `SYS_gettid` was removed in Emscripten v1.39.9
2978+
// https://github.com/emscripten-core/emscripten/pull/10439
29792979
"SYS_gettid" => true,
29802980

2981-
// FIXME: These values have been changed
2982-
| "POSIX_MADV_DONTNEED" // to 4
2983-
| "RLIMIT_NLIMITS" // to 16
2984-
| "RLIM_NLIMITS" // to 16
2985-
| "IPPROTO_MAX" // to 263
2986-
| "F_GETLK" // to 5
2987-
| "F_SETLK" // to 6
2988-
| "F_SETLKW" // to 7
2989-
| "O_TMPFILE" // to 65
2990-
| "SIG_IGN" // -1
2991-
=> true,
2981+
// No personality.h
2982+
// https://github.com/emscripten-core/emscripten/pull/17704
2983+
"ADDR_NO_RANDOMIZE" | "MMAP_PAGE_ZERO" | "ADDR_COMPAT_LAYOUT" | "READ_IMPLIES_EXEC"
2984+
| "ADDR_LIMIT_32BIT" | "SHORT_INODE" | "WHOLE_SECONDS" | "STICKY_TIMEOUTS"
2985+
| "ADDR_LIMIT_3GB" => true,
29922986

2993-
// LFS64 types have been removed in Emscripten 3.1.44+
2987+
// `SIG_IGN` has been changed to -2 since 1 is a valid function address
2988+
// https://github.com/emscripten-core/emscripten/pull/14883
2989+
"SIG_IGN" => true,
2990+
2991+
// LFS64 types have been removed in Emscripten 3.1.44
29942992
// https://github.com/emscripten-core/emscripten/pull/19812
29952993
n if n.starts_with("RLIM64") => true,
29962994

@@ -3000,38 +2998,19 @@ fn test_emscripten(target: &str) {
30002998

30012999
cfg.skip_field_type(move |struct_, field| {
30023000
// This is a weird union, don't check the type.
3003-
// FIXME: is this necessary?
30043001
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
30053002
// sighandler_t type is super weird
3006-
// FIXME: is this necessary?
30073003
(struct_ == "sigaction" && field == "sa_sigaction") ||
30083004
// sigval is actually a union, but we pretend it's a struct
3009-
// FIXME: is this necessary?
3010-
(struct_ == "sigevent" && field == "sigev_value") ||
3011-
// aio_buf is "volatile void*" and Rust doesn't understand volatile
3012-
// FIXME: is this necessary?
3013-
(struct_ == "aiocb" && field == "aio_buf")
3005+
(struct_ == "sigevent" && field == "sigev_value")
30143006
});
30153007

30163008
cfg.skip_field(move |struct_, field| {
30173009
// this is actually a union on linux, so we can't represent it well and
30183010
// just insert some padding.
3019-
// FIXME: is this necessary?
30203011
(struct_ == "siginfo_t" && field == "_pad") ||
30213012
// musl names this __dummy1 but it's still there
3022-
// FIXME: is this necessary?
30233013
(struct_ == "glob_t" && field == "gl_flags") ||
3024-
// musl seems to define this as an *anonymous* bitfield
3025-
// FIXME: is this necessary?
3026-
(struct_ == "statvfs" && field == "__f_unused") ||
3027-
// sigev_notify_thread_id is actually part of a sigev_un union
3028-
(struct_ == "sigevent" && field == "sigev_notify_thread_id") ||
3029-
// signalfd had SIGSYS fields added in Linux 4.18, but no libc release has them yet.
3030-
(struct_ == "signalfd_siginfo" && (field == "ssi_addr_lsb" ||
3031-
field == "_pad2" ||
3032-
field == "ssi_syscall" ||
3033-
field == "ssi_call_addr" ||
3034-
field == "ssi_arch")) ||
30353014
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
30363015
// while other fields become reserved.
30373016
(struct_ == "sched_param" && [
@@ -3042,7 +3021,6 @@ fn test_emscripten(target: &str) {
30423021
].contains(&field))
30433022
});
30443023

3045-
// FIXME: test linux like
30463024
cfg.generate("../src/lib.rs", "main.rs");
30473025
}
30483026

libc-test/semver/android.txt

+3
Original file line numberDiff line numberDiff line change
@@ -3186,6 +3186,7 @@ dlsym
31863186
dup
31873187
dup2
31883188
duplocale
3189+
endgrent
31893190
endservent
31903191
epoll_create
31913192
epoll_create1
@@ -3290,6 +3291,7 @@ getegid
32903291
getenv
32913292
geteuid
32923293
getgid
3294+
getgrent
32933295
getgrgid
32943296
getgrgid_r
32953297
getgrnam
@@ -3684,6 +3686,7 @@ seteuid
36843686
setfsgid
36853687
setfsuid
36863688
setgid
3689+
setgrent
36873690
setgroups
36883691
sethostname
36893692
setlocale

libc-test/semver/espidf.txt

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
AF_INET6
2+
AF_UNIX
3+
FIONBIO
4+
MSG_CTRUNC
5+
MSG_DONTROUTE
6+
MSG_DONTWAIT
7+
MSG_EOR
8+
MSG_MORE
9+
MSG_NOSIGNAL
10+
MSG_OOB
11+
MSG_PEEK
12+
MSG_TRUNC
13+
MSG_WAITALL
14+
NSIG
15+
POLLERR
16+
POLLHUP
17+
POLLIN
18+
POLLOUT
19+
POLLPRI
20+
POLLRDBAND
21+
POLLRDNORM
22+
POLLWRBAND
23+
POLLWRNORM
24+
PTHREAD_STACK_MIN
25+
SIGABRT
26+
SIGFPE
27+
SIGHUP
28+
SIGILL
29+
SIGINT
30+
SIGQUIT
31+
SIGSEGV
32+
SIGTERM
33+
SOL_SOCKET
34+
cmsghdr
35+
dirent
36+
eventfd
37+
gethostname
38+
getrandom
39+
msghdr
40+
pthread_create
41+
recvmsg
42+
sendmsg
43+
sigset_t
44+
sockaddr
45+
sockaddr_in
46+
sockaddr_in6
47+
sockaddr_storage
48+
sockaddr_un
49+
stat

src/unix/linux_like/android/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -3675,6 +3675,9 @@ safe_f! {
36753675
}
36763676

36773677
extern "C" {
3678+
pub fn setgrent();
3679+
pub fn endgrent();
3680+
pub fn getgrent() -> *mut ::group;
36783681
pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
36793682
pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
36803683
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;

src/unix/linux_like/emscripten/align.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ macro_rules! expand_align {
3838
}
3939

4040
#[allow(missing_debug_implementations)]
41-
#[repr(align(16))]
41+
#[repr(align(8))]
4242
pub struct max_align_t {
43-
priv_: [f64; 4]
43+
priv_: [f64; 3]
4444
}
4545

4646
}

0 commit comments

Comments
 (0)