Skip to content

Commit 4aa7cca

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 (backport <rust-lang#3962>) (cherry picked from commit 3e82531)
1 parent eb821a3 commit 4aa7cca

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
@@ -2874,7 +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-
// LFS64 types have been removed in Emscripten 3.1.44+
2877+
// LFS64 types have been removed in Emscripten 3.1.44
28782878
// https://github.com/emscripten-core/emscripten/pull/19812
28792879
"off64_t" => "off_t".to_string(),
28802880

@@ -2898,7 +2898,7 @@ fn test_emscripten(target: &str) {
28982898
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
28992899
s.replace("e_nsec", ".tv_nsec")
29002900
}
2901-
// FIXME: appears that `epoll_event.data` is an union
2901+
// Rust struct uses raw u64, rather than union
29022902
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
29032903
s => s.to_string(),
29042904
}
@@ -2914,10 +2914,7 @@ fn test_emscripten(target: &str) {
29142914
// https://github.com/emscripten-core/emscripten/issues/5033
29152915
ty if ty.starts_with("epoll") => true,
29162916

2917-
// FIXME: The size has been changed due to musl's time64
2918-
"time_t" => true,
2919-
2920-
// LFS64 types have been removed in Emscripten 3.1.44+
2917+
// LFS64 types have been removed in Emscripten 3.1.44
29212918
// https://github.com/emscripten-core/emscripten/pull/19812
29222919
t => t.ends_with("64") || t.ends_with("64_t"),
29232920
}
@@ -2926,30 +2923,19 @@ fn test_emscripten(target: &str) {
29262923
cfg.skip_struct(move |ty| {
29272924
match ty {
29282925
// This is actually a union, not a struct
2929-
// FIXME: is this necessary?
29302926
"sigval" => true,
29312927

2932-
// FIXME: It was removed in
2933-
// emscripten-core/emscripten@953e414
2934-
"pthread_mutexattr_t" => true,
2935-
29362928
// FIXME: Investigate why the test fails.
29372929
// Skip for now to unblock CI.
29382930
"pthread_condattr_t" => true,
2939-
2940-
// FIXME: The size has been changed when upgraded to musl 1.2.2
2941-
"pthread_mutex_t" => true,
2931+
"pthread_mutexattr_t" => true,
29422932

29432933
// No epoll support
29442934
// https://github.com/emscripten-core/emscripten/issues/5033
29452935
ty if ty.starts_with("epoll") => true,
29462936
ty if ty.starts_with("signalfd") => true,
29472937

2948-
// FIXME: The size has been changed due to time64
2949-
"utimbuf" | "timeval" | "timespec" | "rusage" | "itimerval" | "sched_param"
2950-
| "stat" | "stat64" | "shmid_ds" | "msqid_ds" => true,
2951-
2952-
// LFS64 types have been removed in Emscripten 3.1.44+
2938+
// LFS64 types have been removed in Emscripten 3.1.44
29532939
// https://github.com/emscripten-core/emscripten/pull/19812
29542940
ty => ty.ends_with("64") || ty.ends_with("64_t"),
29552941
}
@@ -2958,12 +2944,9 @@ fn test_emscripten(target: &str) {
29582944
cfg.skip_fn(move |name| {
29592945
match name {
29602946
// Emscripten does not support fork/exec/wait or any kind of multi-process support
2961-
// 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
29622948
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" | "wait4" => true,
29632949

2964-
// FIXME: Remove after emscripten-core/emscripten#18492 is released (> 3.1.30).
2965-
"clearenv" => true,
2966-
29672950
_ => false,
29682951
}
29692952
});
@@ -2991,8 +2974,8 @@ fn test_emscripten(target: &str) {
29912974
"USRQUOTA" | "GRPQUOTA" | "Q_GETFMT" | "Q_GETINFO" | "Q_SETINFO" | "Q_SYNC"
29922975
| "Q_QUOTAON" | "Q_QUOTAOFF" | "Q_GETQUOTA" | "Q_SETQUOTA" => true,
29932976

2994-
// FIXME: `SYS_gettid` was removed in
2995-
// emscripten-core/emscripten@6d6474e
2977+
// `SYS_gettid` was removed in Emscripten v1.39.9
2978+
// https://github.com/emscripten-core/emscripten/pull/10439
29962979
"SYS_gettid" => true,
29972980

29982981
// No personality.h
@@ -3001,19 +2984,11 @@ fn test_emscripten(target: &str) {
30012984
| "ADDR_LIMIT_32BIT" | "SHORT_INODE" | "WHOLE_SECONDS" | "STICKY_TIMEOUTS"
30022985
| "ADDR_LIMIT_3GB" => true,
30032986

3004-
// FIXME: These values have been changed
3005-
| "POSIX_MADV_DONTNEED" // to 4
3006-
| "RLIMIT_NLIMITS" // to 16
3007-
| "RLIM_NLIMITS" // to 16
3008-
| "IPPROTO_MAX" // to 263
3009-
| "F_GETLK" // to 5
3010-
| "F_SETLK" // to 6
3011-
| "F_SETLKW" // to 7
3012-
| "O_TMPFILE" // to 65
3013-
| "SIG_IGN" // -1
3014-
=> true,
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,
30152990

3016-
// LFS64 types have been removed in Emscripten 3.1.44+
2991+
// LFS64 types have been removed in Emscripten 3.1.44
30172992
// https://github.com/emscripten-core/emscripten/pull/19812
30182993
n if n.starts_with("RLIM64") => true,
30192994

@@ -3023,23 +2998,18 @@ fn test_emscripten(target: &str) {
30232998

30242999
cfg.skip_field_type(move |struct_, field| {
30253000
// This is a weird union, don't check the type.
3026-
// FIXME: is this necessary?
30273001
(struct_ == "ifaddrs" && field == "ifa_ifu") ||
30283002
// sighandler_t type is super weird
3029-
// FIXME: is this necessary?
30303003
(struct_ == "sigaction" && field == "sa_sigaction") ||
30313004
// sigval is actually a union, but we pretend it's a struct
3032-
// FIXME: is this necessary?
30333005
(struct_ == "sigevent" && field == "sigev_value")
30343006
});
30353007

30363008
cfg.skip_field(move |struct_, field| {
30373009
// this is actually a union on linux, so we can't represent it well and
30383010
// just insert some padding.
3039-
// FIXME: is this necessary?
30403011
(struct_ == "siginfo_t" && field == "_pad") ||
30413012
// musl names this __dummy1 but it's still there
3042-
// FIXME: is this necessary?
30433013
(struct_ == "glob_t" && field == "gl_flags") ||
30443014
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
30453015
// while other fields become reserved.
@@ -3051,7 +3021,6 @@ fn test_emscripten(target: &str) {
30513021
].contains(&field))
30523022
});
30533023

3054-
// FIXME: test linux like
30553024
cfg.generate("../src/lib.rs", "main.rs");
30563025
}
30573026

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,
@@ -1048,11 +1042,11 @@ pub const PTHREAD_STACK_MIN: ::size_t = 2048;
10481042
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
10491043
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
10501044

1051-
pub const POSIX_MADV_DONTNEED: ::c_int = 0;
1045+
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
10521046

10531047
pub const RLIM_INFINITY: ::rlim_t = !0;
10541048
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
1055-
pub const RLIMIT_NLIMITS: ::c_int = 15;
1049+
pub const RLIMIT_NLIMITS: ::c_int = 16;
10561050
#[allow(deprecated)]
10571051
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
10581052
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
@@ -1067,7 +1061,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
10671061
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
10681062
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
10691063

1070-
pub const CPU_SETSIZE: ::c_int = 128;
1064+
pub const CPU_SETSIZE: ::c_int = 1024;
10711065

10721066
pub const TCSANOW: ::c_int = 0;
10731067
pub const TCSADRAIN: ::c_int = 1;
@@ -1169,14 +1163,14 @@ pub const B3500000: ::speed_t = 0o010016;
11691163
pub const B4000000: ::speed_t = 0o010017;
11701164

11711165
pub const SO_BINDTODEVICE: ::c_int = 25;
1172-
pub const SO_TIMESTAMP: ::c_int = 29;
1166+
pub const SO_TIMESTAMP: ::c_int = 63;
11731167
pub const SO_MARK: ::c_int = 36;
11741168
pub const SO_RXQ_OVFL: ::c_int = 40;
11751169
pub const SO_PEEK_OFF: ::c_int = 42;
11761170
pub const SO_BUSY_POLL: ::c_int = 46;
11771171

11781172
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
1179-
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
1173+
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
11801174

11811175
pub const O_DIRECT: ::c_int = 0x4000;
11821176
pub const O_DIRECTORY: ::c_int = 0x10000;
@@ -1227,7 +1221,7 @@ pub const SOCK_STREAM: ::c_int = 1;
12271221
pub const SOCK_DGRAM: ::c_int = 2;
12281222
pub const SOCK_SEQPACKET: ::c_int = 5;
12291223

1230-
pub const IPPROTO_MAX: ::c_int = 256;
1224+
pub const IPPROTO_MAX: ::c_int = 263;
12311225

12321226
pub const SOL_SOCKET: ::c_int = 1;
12331227

@@ -1244,8 +1238,8 @@ pub const SO_LINGER: ::c_int = 13;
12441238
pub const SO_REUSEPORT: ::c_int = 15;
12451239
pub const SO_RCVLOWAT: ::c_int = 18;
12461240
pub const SO_SNDLOWAT: ::c_int = 19;
1247-
pub const SO_RCVTIMEO: ::c_int = 20;
1248-
pub const SO_SNDTIMEO: ::c_int = 21;
1241+
pub const SO_RCVTIMEO: ::c_int = 66;
1242+
pub const SO_SNDTIMEO: ::c_int = 67;
12491243
pub const SO_ACCEPTCONN: ::c_int = 30;
12501244

12511245
pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
@@ -1347,7 +1341,7 @@ pub const TIOCM_RNG: ::c_int = 0x080;
13471341
pub const TIOCM_DSR: ::c_int = 0x100;
13481342
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
13491343
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
1350-
pub const O_TMPFILE: ::c_int = 0x400000;
1344+
pub const O_TMPFILE: ::c_int = 0x410000;
13511345

13521346
pub const MAX_ADDR_LEN: usize = 7;
13531347
pub const ARPD_UPDATE: ::c_ushort = 0x01;

0 commit comments

Comments
 (0)