Skip to content

Commit 3e82531

Browse files
kleisauketgross35
authored andcommitted
emscripten: Upgrade emsdk to 3.1.68
In line with commit rust-lang/rust@2c38ecf. Notable changes: - `time_t` changed to 64-bit. emscripten-core/emscripten@c8857a6
1 parent 99035d7 commit 3e82531

File tree

3 files changed

+25
-62
lines changed

3 files changed

+25
-62
lines changed

ci/emscripten.sh

Lines changed: 3 additions & 3 deletions
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

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,7 @@ fn test_emscripten(target: &str) {
28192819
// Just pass all these through, no need for a "struct" prefix
28202820
"FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(),
28212821

2822-
// LFS64 types have been removed in Emscripten 3.1.44+
2822+
// LFS64 types have been removed in Emscripten 3.1.44
28232823
// https://github.com/emscripten-core/emscripten/pull/19812
28242824
"off64_t" => "off_t".to_string(),
28252825

@@ -2843,7 +2843,7 @@ fn test_emscripten(target: &str) {
28432843
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
28442844
s.replace("e_nsec", ".tv_nsec")
28452845
}
2846-
// FIXME: appears that `epoll_event.data` is an union
2846+
// Rust struct uses raw u64, rather than union
28472847
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
28482848
s => s.to_string(),
28492849
}
@@ -2859,10 +2859,7 @@ fn test_emscripten(target: &str) {
28592859
// https://github.com/emscripten-core/emscripten/issues/5033
28602860
ty if ty.starts_with("epoll") => true,
28612861

2862-
// FIXME: The size has been changed due to musl's time64
2863-
"time_t" => true,
2864-
2865-
// LFS64 types have been removed in Emscripten 3.1.44+
2862+
// LFS64 types have been removed in Emscripten 3.1.44
28662863
// https://github.com/emscripten-core/emscripten/pull/19812
28672864
t => t.ends_with("64") || t.ends_with("64_t"),
28682865
}
@@ -2871,30 +2868,19 @@ fn test_emscripten(target: &str) {
28712868
cfg.skip_struct(move |ty| {
28722869
match ty {
28732870
// This is actually a union, not a struct
2874-
// FIXME: is this necessary?
28752871
"sigval" => true,
28762872

2877-
// FIXME: It was removed in
2878-
// emscripten-core/emscripten@953e414
2879-
"pthread_mutexattr_t" => true,
2880-
28812873
// FIXME: Investigate why the test fails.
28822874
// Skip for now to unblock CI.
28832875
"pthread_condattr_t" => true,
2884-
2885-
// FIXME: The size has been changed when upgraded to musl 1.2.2
2886-
"pthread_mutex_t" => true,
2876+
"pthread_mutexattr_t" => true,
28872877

28882878
// No epoll support
28892879
// https://github.com/emscripten-core/emscripten/issues/5033
28902880
ty if ty.starts_with("epoll") => true,
28912881
ty if ty.starts_with("signalfd") => true,
28922882

2893-
// FIXME: The size has been changed due to time64
2894-
"utimbuf" | "timeval" | "timespec" | "rusage" | "itimerval" | "sched_param"
2895-
| "stat" | "stat64" | "shmid_ds" | "msqid_ds" => true,
2896-
2897-
// LFS64 types have been removed in Emscripten 3.1.44+
2883+
// LFS64 types have been removed in Emscripten 3.1.44
28982884
// https://github.com/emscripten-core/emscripten/pull/19812
28992885
ty => ty.ends_with("64") || ty.ends_with("64_t"),
29002886
}
@@ -2903,12 +2889,9 @@ fn test_emscripten(target: &str) {
29032889
cfg.skip_fn(move |name| {
29042890
match name {
29052891
// Emscripten does not support fork/exec/wait or any kind of multi-process support
2906-
// https://github.com/emscripten-core/emscripten/blob/3.1.30/tools/system_libs.py#L973
2892+
// https://github.com/emscripten-core/emscripten/blob/3.1.68/tools/system_libs.py#L1100
29072893
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" | "wait4" => true,
29082894

2909-
// FIXME: Remove after emscripten-core/emscripten#18492 is released (> 3.1.30).
2910-
"clearenv" => true,
2911-
29122895
_ => false,
29132896
}
29142897
});
@@ -2936,8 +2919,8 @@ fn test_emscripten(target: &str) {
29362919
"USRQUOTA" | "GRPQUOTA" | "Q_GETFMT" | "Q_GETINFO" | "Q_SETINFO" | "Q_SYNC"
29372920
| "Q_QUOTAON" | "Q_QUOTAOFF" | "Q_GETQUOTA" | "Q_SETQUOTA" => true,
29382921

2939-
// FIXME: `SYS_gettid` was removed in
2940-
// emscripten-core/emscripten@6d6474e
2922+
// `SYS_gettid` was removed in Emscripten v1.39.9
2923+
// https://github.com/emscripten-core/emscripten/pull/10439
29412924
"SYS_gettid" => true,
29422925

29432926
// No personality.h
@@ -2946,19 +2929,11 @@ fn test_emscripten(target: &str) {
29462929
| "ADDR_LIMIT_32BIT" | "SHORT_INODE" | "WHOLE_SECONDS" | "STICKY_TIMEOUTS"
29472930
| "ADDR_LIMIT_3GB" => true,
29482931

2949-
// FIXME: These values have been changed
2950-
| "POSIX_MADV_DONTNEED" // to 4
2951-
| "RLIMIT_NLIMITS" // to 16
2952-
| "RLIM_NLIMITS" // to 16
2953-
| "IPPROTO_MAX" // to 263
2954-
| "F_GETLK" // to 5
2955-
| "F_SETLK" // to 6
2956-
| "F_SETLKW" // to 7
2957-
| "O_TMPFILE" // to 65
2958-
| "SIG_IGN" // -1
2959-
=> true,
2932+
// `SIG_IGN` has been changed to -2 since 1 is a valid function address
2933+
// https://github.com/emscripten-core/emscripten/pull/14883
2934+
"SIG_IGN" => true,
29602935

2961-
// LFS64 types have been removed in Emscripten 3.1.44+
2936+
// LFS64 types have been removed in Emscripten 3.1.44
29622937
// https://github.com/emscripten-core/emscripten/pull/19812
29632938
n if n.starts_with("RLIM64") => true,
29642939

@@ -2968,23 +2943,18 @@ fn test_emscripten(target: &str) {
29682943

29692944
cfg.skip_field_type(move |struct_, field| {
29702945
// This is a weird union, don't check the type.
2971-
// FIXME: is this necessary?
29722946
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
29732947
// sighandler_t type is super weird
2974-
// FIXME: is this necessary?
29752948
(struct_ == "sigaction" && field == "sa_sigaction") ||
29762949
// sigval is actually a union, but we pretend it's a struct
2977-
// FIXME: is this necessary?
29782950
(struct_ == "sigevent" && field == "sigev_value")
29792951
});
29802952

29812953
cfg.skip_field(move |struct_, field| {
29822954
// this is actually a union on linux, so we can't represent it well and
29832955
// just insert some padding.
2984-
// FIXME: is this necessary?
29852956
(struct_ == "siginfo_t" && field == "_pad") ||
29862957
// musl names this __dummy1 but it's still there
2987-
// FIXME: is this necessary?
29882958
(struct_ == "glob_t" && field == "gl_flags") ||
29892959
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
29902960
// while other fields become reserved.
@@ -2996,7 +2966,6 @@ fn test_emscripten(target: &str) {
29962966
].contains(&field))
29972967
});
29982968

2999-
// FIXME: test linux like
30002969
cfg.generate("../src/lib.rs", "main.rs");
30012970
}
30022971

src/unix/linux_like/emscripten/mod.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ 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+
pub type time_t = i64;
2020
pub type suseconds_t = c_long;
2121
pub type ino_t = u64;
2222
pub type off_t = i64;
@@ -259,11 +259,8 @@ s! {
259259
pub shm_perm: ::ipc_perm,
260260
pub shm_segsz: ::size_t,
261261
pub shm_atime: ::time_t,
262-
__unused1: ::c_int,
263262
pub shm_dtime: ::time_t,
264-
__unused2: ::c_int,
265263
pub shm_ctime: ::time_t,
266-
__unused3: ::c_int,
267264
pub shm_cpid: ::pid_t,
268265
pub shm_lpid: ::pid_t,
269266
pub shm_nattch: ::c_ulong,
@@ -274,11 +271,8 @@ s! {
274271
pub struct msqid_ds {
275272
pub msg_perm: ::ipc_perm,
276273
pub msg_stime: ::time_t,
277-
__unused1: ::c_int,
278274
pub msg_rtime: ::time_t,
279-
__unused2: ::c_int,
280275
pub msg_ctime: ::time_t,
281-
__unused3: ::c_int,
282276
__msg_cbytes: ::c_ulong,
283277
pub msg_qnum: ::msgqnum_t,
284278
pub msg_qbytes: ::msglen_t,
@@ -1046,11 +1040,11 @@ pub const PTHREAD_STACK_MIN: ::size_t = 2048;
10461040
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
10471041
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
10481042

1049-
pub const POSIX_MADV_DONTNEED: ::c_int = 0;
1043+
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
10501044

10511045
pub const RLIM_INFINITY: ::rlim_t = !0;
10521046
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1053-
pub const RLIMIT_NLIMITS: ::c_int = 15;
1047+
pub const RLIMIT_NLIMITS: ::c_int = 16;
10541048
#[allow(deprecated)]
10551049
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
10561050
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
@@ -1065,7 +1059,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
10651059
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
10661060
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
10671061

1068-
pub const CPU_SETSIZE: ::c_int = 128;
1062+
pub const CPU_SETSIZE: ::c_int = 1024;
10691063

10701064
pub const TCSANOW: ::c_int = 0;
10711065
pub const TCSADRAIN: ::c_int = 1;
@@ -1167,14 +1161,14 @@ pub const B3500000: ::speed_t = 0o010016;
11671161
pub const B4000000: ::speed_t = 0o010017;
11681162

11691163
pub const SO_BINDTODEVICE: ::c_int = 25;
1170-
pub const SO_TIMESTAMP: ::c_int = 29;
1164+
pub const SO_TIMESTAMP: ::c_int = 63;
11711165
pub const SO_MARK: ::c_int = 36;
11721166
pub const SO_RXQ_OVFL: ::c_int = 40;
11731167
pub const SO_PEEK_OFF: ::c_int = 42;
11741168
pub const SO_BUSY_POLL: ::c_int = 46;
11751169

11761170
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
1177-
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
1171+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
11781172

11791173
pub const O_DIRECT: ::c_int = 0x4000;
11801174
pub const O_DIRECTORY: ::c_int = 0x10000;
@@ -1225,7 +1219,7 @@ pub const SOCK_STREAM: ::c_int = 1;
12251219
pub const SOCK_DGRAM: ::c_int = 2;
12261220
pub const SOCK_SEQPACKET: ::c_int = 5;
12271221

1228-
pub const IPPROTO_MAX: ::c_int = 256;
1222+
pub const IPPROTO_MAX: ::c_int = 263;
12291223

12301224
pub const SOL_SOCKET: ::c_int = 1;
12311225

@@ -1242,8 +1236,8 @@ pub const SO_LINGER: ::c_int = 13;
12421236
pub const SO_REUSEPORT: ::c_int = 15;
12431237
pub const SO_RCVLOWAT: ::c_int = 18;
12441238
pub const SO_SNDLOWAT: ::c_int = 19;
1245-
pub const SO_RCVTIMEO: ::c_int = 20;
1246-
pub const SO_SNDTIMEO: ::c_int = 21;
1239+
pub const SO_RCVTIMEO: ::c_int = 66;
1240+
pub const SO_SNDTIMEO: ::c_int = 67;
12471241
pub const SO_ACCEPTCONN: ::c_int = 30;
12481242

12491243
pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
@@ -1345,7 +1339,7 @@ pub const TIOCM_RNG: ::c_int = 0x080;
13451339
pub const TIOCM_DSR: ::c_int = 0x100;
13461340
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
13471341
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
1348-
pub const O_TMPFILE: ::c_int = 0x400000;
1342+
pub const O_TMPFILE: ::c_int = 0x410000;
13491343

13501344
pub const MAX_ADDR_LEN: usize = 7;
13511345
pub const ARPD_UPDATE: ::c_ushort = 0x01;

0 commit comments

Comments
 (0)