Skip to content

Commit b0e77d2

Browse files
committed
emscripten: Upgrade emsdk to 3.1.68
In line with commit rust-lang/rust@2c38ecf.
1 parent 99f8c87 commit b0e77d2

File tree

4 files changed

+35
-71
lines changed

4 files changed

+35
-71
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

+11-47
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,7 @@ fn test_emscripten(target: &str) {
28102810
// Just pass all these through, no need for a "struct" prefix
28112811
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
28122812

2813-
// LFS64 types have been removed in Emscripten 3.1.44+
2813+
// LFS64 types have been removed in Emscripten 3.1.44
28142814
// https://github.com/emscripten-core/emscripten/pull/19812
28152815
"off64_t" => "off_t".to_string(),
28162816

@@ -2834,7 +2834,7 @@ fn test_emscripten(target: &str) {
28342834
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
28352835
s.replace("e_nsec", ".tv_nsec")
28362836
}
2837-
// FIXME: appears that `epoll_event.data` is an union
2837+
// Rust struct uses raw u64, rather than union
28382838
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
28392839
s => s.to_string(),
28402840
}
@@ -2850,10 +2850,7 @@ fn test_emscripten(target: &str) {
28502850
// https://github.com/emscripten-core/emscripten/issues/5033
28512851
ty if ty.starts_with("epoll") => true,
28522852

2853-
// FIXME: The size has been changed due to musl's time64
2854-
"time_t" => true,
2855-
2856-
// LFS64 types have been removed in Emscripten 3.1.44+
2853+
// LFS64 types have been removed in Emscripten 3.1.44
28572854
// https://github.com/emscripten-core/emscripten/pull/19812
28582855
t => t.ends_with("64") || t.ends_with("64_t"),
28592856
}
@@ -2862,34 +2859,19 @@ fn test_emscripten(target: &str) {
28622859
cfg.skip_struct(move |ty| {
28632860
match ty {
28642861
// This is actually a union, not a struct
2865-
// FIXME: is this necessary?
28662862
"sigval" => true,
28672863

2868-
// FIXME: It was removed in
2869-
// emscripten-core/emscripten@953e414
2870-
"pthread_mutexattr_t" => true,
2871-
28722864
// FIXME: Investigate why the test fails.
28732865
// Skip for now to unblock CI.
28742866
"pthread_condattr_t" => true,
2875-
2876-
// FIXME: The size has been changed when upgraded to musl 1.2.2
2877-
"pthread_mutex_t" => true,
2867+
"pthread_mutexattr_t" => true,
28782868

28792869
// No epoll support
28802870
// https://github.com/emscripten-core/emscripten/issues/5033
28812871
ty if ty.starts_with("epoll") => true,
28822872
ty if ty.starts_with("signalfd") => true,
28832873

2884-
// FIXME: Lowered from 16 to 8 bytes in
2885-
// llvm/llvm-project@d1a96e9
2886-
"max_align_t" => true,
2887-
2888-
// FIXME: The size has been changed due to time64
2889-
"utimbuf" | "timeval" | "timespec" | "rusage" | "itimerval" | "sched_param"
2890-
| "stat" | "stat64" | "shmid_ds" | "msqid_ds" => true,
2891-
2892-
// LFS64 types have been removed in Emscripten 3.1.44+
2874+
// LFS64 types have been removed in Emscripten 3.1.44
28932875
// https://github.com/emscripten-core/emscripten/pull/19812
28942876
ty => ty.ends_with("64") || ty.ends_with("64_t"),
28952877
}
@@ -2898,12 +2880,9 @@ fn test_emscripten(target: &str) {
28982880
cfg.skip_fn(move |name| {
28992881
match name {
29002882
// Emscripten does not support fork/exec/wait or any kind of multi-process support
2901-
// https://github.com/emscripten-core/emscripten/blob/3.1.30/tools/system_libs.py#L973
2883+
// https://github.com/emscripten-core/emscripten/blob/3.1.68/tools/system_libs.py#L1100
29022884
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" | "wait4" => true,
29032885

2904-
// FIXME: Remove after emscripten-core/emscripten#18492 is released (> 3.1.30).
2905-
"clearenv" => true,
2906-
29072886
_ => false,
29082887
}
29092888
});
@@ -2931,8 +2910,8 @@ fn test_emscripten(target: &str) {
29312910
"USRQUOTA" | "GRPQUOTA" | "Q_GETFMT" | "Q_GETINFO" | "Q_SETINFO" | "Q_SYNC"
29322911
| "Q_QUOTAON" | "Q_QUOTAOFF" | "Q_GETQUOTA" | "Q_SETQUOTA" => true,
29332912

2934-
// FIXME: `SYS_gettid` was removed in
2935-
// emscripten-core/emscripten@6d6474e
2913+
// `SYS_gettid` was removed in Emscripten v1.39.9
2914+
// https://github.com/emscripten-core/emscripten/pull/10439
29362915
"SYS_gettid" => true,
29372916

29382917
// No personality.h
@@ -2941,19 +2920,10 @@ fn test_emscripten(target: &str) {
29412920
| "ADDR_LIMIT_32BIT" | "SHORT_INODE" | "WHOLE_SECONDS" | "STICKY_TIMEOUTS"
29422921
| "ADDR_LIMIT_3GB" => true,
29432922

2944-
// FIXME: These values have been changed
2945-
| "POSIX_MADV_DONTNEED" // to 4
2946-
| "RLIMIT_NLIMITS" // to 16
2947-
| "RLIM_NLIMITS" // to 16
2948-
| "IPPROTO_MAX" // to 263
2949-
| "F_GETLK" // to 5
2950-
| "F_SETLK" // to 6
2951-
| "F_SETLKW" // to 7
2952-
| "O_TMPFILE" // to 65
2953-
| "SIG_IGN" // -1
2954-
=> true,
2923+
// FIXME: https://github.com/emscripten-core/emscripten/pull/14883
2924+
"SIG_IGN" => true,
29552925

2956-
// LFS64 types have been removed in Emscripten 3.1.44+
2926+
// LFS64 types have been removed in Emscripten 3.1.44
29572927
// https://github.com/emscripten-core/emscripten/pull/19812
29582928
n if n.starts_with("RLIM64") => true,
29592929

@@ -2963,23 +2933,18 @@ fn test_emscripten(target: &str) {
29632933

29642934
cfg.skip_field_type(move |struct_, field| {
29652935
// This is a weird union, don't check the type.
2966-
// FIXME: is this necessary?
29672936
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
29682937
// sighandler_t type is super weird
2969-
// FIXME: is this necessary?
29702938
(struct_ == "sigaction" && field == "sa_sigaction") ||
29712939
// sigval is actually a union, but we pretend it's a struct
2972-
// FIXME: is this necessary?
29732940
(struct_ == "sigevent" && field == "sigev_value")
29742941
});
29752942

29762943
cfg.skip_field(move |struct_, field| {
29772944
// this is actually a union on linux, so we can't represent it well and
29782945
// just insert some padding.
2979-
// FIXME: is this necessary?
29802946
(struct_ == "siginfo_t" && field == "_pad") ||
29812947
// musl names this __dummy1 but it's still there
2982-
// FIXME: is this necessary?
29832948
(struct_ == "glob_t" && field == "gl_flags") ||
29842949
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
29852950
// while other fields become reserved.
@@ -2991,7 +2956,6 @@ fn test_emscripten(target: &str) {
29912956
].contains(&field))
29922957
});
29932958

2994-
// FIXME: test linux like
29952959
cfg.generate("../src/lib.rs", "main.rs");
29962960
}
29972961

src/unix/linux_like/emscripten/align.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ macro_rules! expand_align {
3737
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
3838
}
3939

40+
// Lowered from 16 to 8 bytes in
41+
// https://github.com/llvm/llvm-project/commit/d1a96e906cc03a95cfd41a1f22bdda92651250c7
4042
#[allow(missing_debug_implementations)]
41-
#[repr(align(16))]
43+
#[repr(align(8))]
4244
pub struct max_align_t {
43-
priv_: [f64; 4]
45+
priv_: [f64; 3]
4446
}
4547

4648
}

src/unix/linux_like/emscripten/mod.rs

+17-19
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ pub type loff_t = i64;
1616
pub type pthread_key_t = ::c_uint;
1717

1818
pub type clock_t = c_long;
19-
pub type time_t = c_long;
19+
20+
// 64-bit time_t since v3.1.16 (2022/07/15)
21+
// https://github.com/emscripten-core/emscripten/pull/17401
22+
pub type time_t = i64;
23+
2024
pub type suseconds_t = c_long;
2125
pub type ino_t = u64;
2226
pub type off_t = i64;
@@ -259,11 +263,8 @@ s! {
259263
pub shm_perm: ::ipc_perm,
260264
pub shm_segsz: ::size_t,
261265
pub shm_atime: ::time_t,
262-
__unused1: ::c_int,
263266
pub shm_dtime: ::time_t,
264-
__unused2: ::c_int,
265267
pub shm_ctime: ::time_t,
266-
__unused3: ::c_int,
267268
pub shm_cpid: ::pid_t,
268269
pub shm_lpid: ::pid_t,
269270
pub shm_nattch: ::c_ulong,
@@ -274,11 +275,8 @@ s! {
274275
pub struct msqid_ds {
275276
pub msg_perm: ::ipc_perm,
276277
pub msg_stime: ::time_t,
277-
__unused1: ::c_int,
278278
pub msg_rtime: ::time_t,
279-
__unused2: ::c_int,
280279
pub msg_ctime: ::time_t,
281-
__unused3: ::c_int,
282280
__msg_cbytes: ::c_ulong,
283281
pub msg_qnum: ::msgqnum_t,
284282
pub msg_qbytes: ::msglen_t,
@@ -748,9 +746,9 @@ pub const POSIX_MADV_WILLNEED: ::c_int = 3;
748746

749747
pub const AT_EACCESS: ::c_int = 0x200;
750748

751-
pub const S_IEXEC: mode_t = 0o0100;
752-
pub const S_IWRITE: mode_t = 0o0200;
753-
pub const S_IREAD: mode_t = 0o0400;
749+
pub const S_IEXEC: mode_t = 64;
750+
pub const S_IWRITE: mode_t = 128;
751+
pub const S_IREAD: mode_t = 256;
754752

755753
pub const F_LOCK: ::c_int = 1;
756754
pub const F_TEST: ::c_int = 3;
@@ -1046,11 +1044,11 @@ pub const PTHREAD_STACK_MIN: ::size_t = 2048;
10461044
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
10471045
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
10481046

1049-
pub const POSIX_MADV_DONTNEED: ::c_int = 0;
1047+
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
10501048

10511049
pub const RLIM_INFINITY: ::rlim_t = !0;
10521050
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1053-
pub const RLIMIT_NLIMITS: ::c_int = 15;
1051+
pub const RLIMIT_NLIMITS: ::c_int = 16;
10541052
#[allow(deprecated)]
10551053
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
10561054
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
@@ -1065,7 +1063,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
10651063
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
10661064
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
10671065

1068-
pub const CPU_SETSIZE: ::c_int = 128;
1066+
pub const CPU_SETSIZE: ::c_int = 1024;
10691067

10701068
pub const TCSANOW: ::c_int = 0;
10711069
pub const TCSADRAIN: ::c_int = 1;
@@ -1167,14 +1165,14 @@ pub const B3500000: ::speed_t = 0o010016;
11671165
pub const B4000000: ::speed_t = 0o010017;
11681166

11691167
pub const SO_BINDTODEVICE: ::c_int = 25;
1170-
pub const SO_TIMESTAMP: ::c_int = 29;
1168+
pub const SO_TIMESTAMP: ::c_int = 63;
11711169
pub const SO_MARK: ::c_int = 36;
11721170
pub const SO_RXQ_OVFL: ::c_int = 40;
11731171
pub const SO_PEEK_OFF: ::c_int = 42;
11741172
pub const SO_BUSY_POLL: ::c_int = 46;
11751173

11761174
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
1177-
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
1175+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
11781176

11791177
pub const O_DIRECT: ::c_int = 0x4000;
11801178
pub const O_DIRECTORY: ::c_int = 0x10000;
@@ -1225,7 +1223,7 @@ pub const SOCK_STREAM: ::c_int = 1;
12251223
pub const SOCK_DGRAM: ::c_int = 2;
12261224
pub const SOCK_SEQPACKET: ::c_int = 5;
12271225

1228-
pub const IPPROTO_MAX: ::c_int = 256;
1226+
pub const IPPROTO_MAX: ::c_int = 263;
12291227

12301228
pub const SOL_SOCKET: ::c_int = 1;
12311229

@@ -1242,8 +1240,8 @@ pub const SO_LINGER: ::c_int = 13;
12421240
pub const SO_REUSEPORT: ::c_int = 15;
12431241
pub const SO_RCVLOWAT: ::c_int = 18;
12441242
pub const SO_SNDLOWAT: ::c_int = 19;
1245-
pub const SO_RCVTIMEO: ::c_int = 20;
1246-
pub const SO_SNDTIMEO: ::c_int = 21;
1243+
pub const SO_RCVTIMEO: ::c_int = 66;
1244+
pub const SO_SNDTIMEO: ::c_int = 67;
12471245
pub const SO_ACCEPTCONN: ::c_int = 30;
12481246

12491247
pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
@@ -1345,7 +1343,7 @@ pub const TIOCM_RNG: ::c_int = 0x080;
13451343
pub const TIOCM_DSR: ::c_int = 0x100;
13461344
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
13471345
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
1348-
pub const O_TMPFILE: ::c_int = 0x400000;
1346+
pub const O_TMPFILE: ::c_int = 0x410000;
13491347

13501348
pub const MAX_ADDR_LEN: usize = 7;
13511349
pub const ARPD_UPDATE: ::c_ushort = 0x01;

0 commit comments

Comments
 (0)