Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to emscripten 3.1.41 #3307

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions ci/emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

set -ex

# FIXME: 3.1.21 removed a lot of header files (https://github.com/emscripten-core/emscripten/pull/17704).
# We have to tweak libc-test (and deprecate unsupported items, maybe) when updating emsdk.
EMSDK_VERSION=3.1.20
EMSDK_VERSION=3.1.41

git clone https://github.com/emscripten-core/emsdk.git /emsdk-portable
cd /emsdk-portable
Expand Down
79 changes: 48 additions & 31 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2553,7 +2553,6 @@ fn test_emscripten(target: &str) {
cfg.define("_GNU_SOURCE", None); // FIXME: ??

headers! { cfg:
"aio.h",
"ctype.h",
"dirent.h",
"dlfcn.h",
Expand Down Expand Up @@ -2593,32 +2592,21 @@ fn test_emscripten(target: &str) {
"stdio.h",
"stdlib.h",
"string.h",
"sys/epoll.h",
"sys/eventfd.h",
"sys/file.h",
"sys/ioctl.h",
"sys/ipc.h",
"sys/mman.h",
"sys/mount.h",
"sys/msg.h",
"sys/personality.h",
"sys/prctl.h",
"sys/ptrace.h",
"sys/quota.h",
"sys/reboot.h",
"sys/resource.h",
"sys/sem.h",
"sys/shm.h",
"sys/signalfd.h",
"sys/socket.h",
"sys/stat.h",
"sys/statvfs.h",
"sys/swap.h",
"sys/syscall.h",
"sys/sysctl.h",
"sys/sysinfo.h",
"sys/time.h",
"sys/timerfd.h",
"sys/times.h",
"sys/types.h",
"sys/uio.h",
Expand Down Expand Up @@ -2682,8 +2670,9 @@ fn test_emscripten(target: &str) {
// FIXME: is this necessary?
"sighandler_t" => true,

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

// LFS64 types have been removed in Emscripten 3.1.44+
// https://github.com/emscripten-core/emscripten/pull/19812
Expand Down Expand Up @@ -2712,9 +2701,16 @@ fn test_emscripten(target: &str) {
// llvm/llvm-project@d1a96e9
"max_align_t" => true,

// FIXME: The size has been changed due to time64
"utimbuf" | "timeval" | "timespec" | "rusage" | "itimerval" | "sched_param"
| "stat" | "stat64" | "shmid_ds" | "msqid_ds" => true,
// No quota.h
"dqblk" => true,

// No aio.h
"aiocb" => true,

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

// LFS64 types have been removed in Emscripten 3.1.44+
// https://github.com/emscripten-core/emscripten/pull/19812
Expand All @@ -2728,9 +2724,6 @@ fn test_emscripten(target: &str) {
// https://github.com/emscripten-core/emscripten/blob/3.1.30/tools/system_libs.py#L973
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" | "wait4" => true,

// FIXME: Remove after emscripten-core/emscripten#18492 is released (> 3.1.30).
"clearenv" => true,

_ => false,
}
});
Expand All @@ -2744,21 +2737,45 @@ fn test_emscripten(target: &str) {
// FIXME: emscripten uses different constants to constructs these
n if n.contains("__SIZEOF_PTHREAD") => true,

// No epoll support
// https://github.com/emscripten-core/emscripten/issues/5033
n if n.starts_with("EPOLL") => true,
n if n.starts_with("EFD_") => true,
n if n.starts_with("SFD_") => true,

// No reboot.h
n if n.starts_with("RB_") => true,

// No aio.h
n if n.starts_with("AIO_") => true,
n if n.starts_with("LIO_") => true,

// No prctrl.h
n if n.starts_with("PR_") => true,

// No quota.h
n if n.starts_with("QFMT_") => true,

// FIXME: `SYS_gettid` was removed in
// emscripten-core/emscripten@6d6474e
"SYS_gettid" => true,

// FIXME: These values have been changed
| "POSIX_MADV_DONTNEED" // to 4
| "RLIMIT_NLIMITS" // to 16
| "RLIM_NLIMITS" // to 16
| "IPPROTO_MAX" // to 263
| "F_GETLK" // to 5
| "F_SETLK" // to 6
| "F_SETLKW" // to 7
| "O_TMPFILE" // to 65
| "SIG_IGN" // -1
=> true,
// No personality.h etc.: https://github.com/emscripten-core/emscripten/pull/17704
// No sysctl.h: https://github.com/emscripten-core/emscripten/pull/18863
n if n.starts_with("PTRACE_") => true,
n if n.starts_with("QIF_") => true,
Comment on lines +2763 to +2766
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should just remove the declaration instead of skipping.


"ADDR_NO_RANDOMIZE" | "MMAP_PAGE_ZERO" | "ADDR_COMPAT_LAYOUT" | "READ_IMPLIES_EXEC"
| "ADDR_LIMIT_32BIT" | "SHORT_INODE" | "WHOLE_SECONDS" | "STICKY_TIMEOUTS"
| "ADDR_LIMIT_3GB" => true,

"USRQUOTA" | "GRPQUOTA" => true,

"Q_GETFMT" | "Q_GETINFO" | "Q_SETINFO" | "Q_SYNC" | "Q_QUOTAON" | "Q_QUOTAOFF"
| "Q_GETQUOTA" | "Q_SETQUOTA" => true,

// FIXME: https://github.com/emscripten-core/emscripten/pull/14883
"SIG_IGN" => true,

// LFS64 types have been removed in Emscripten 3.1.44+
// https://github.com/emscripten-core/emscripten/pull/19812
Expand Down
23 changes: 9 additions & 14 deletions src/unix/linux_like/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ pub type loff_t = i64;
pub type pthread_key_t = ::c_uint;

pub type clock_t = c_long;
pub type time_t = c_long;
// 64-bit time_t since July 2022: https://github.com/emscripten-core/emscripten/pull/17401
pub type time_t = i64;
pub type suseconds_t = c_long;
pub type ino_t = u64;
pub type off_t = i64;
Expand Down Expand Up @@ -288,11 +289,8 @@ s! {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_atime: ::time_t,
__unused1: ::c_int,
pub shm_dtime: ::time_t,
__unused2: ::c_int,
pub shm_ctime: ::time_t,
__unused3: ::c_int,
pub shm_cpid: ::pid_t,
pub shm_lpid: ::pid_t,
pub shm_nattch: ::c_ulong,
Expand All @@ -303,11 +301,8 @@ s! {
pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
pub msg_stime: ::time_t,
__unused1: ::c_int,
pub msg_rtime: ::time_t,
__unused2: ::c_int,
pub msg_ctime: ::time_t,
__unused3: ::c_int,
__msg_cbytes: ::c_ulong,
pub msg_qnum: ::msgqnum_t,
pub msg_qbytes: ::msglen_t,
Expand Down Expand Up @@ -1227,11 +1222,11 @@ pub const PTHREAD_STACK_MIN: ::size_t = 2048;
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
pub const POSIX_FADV_NOREUSE: ::c_int = 5;

pub const POSIX_MADV_DONTNEED: ::c_int = 0;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;

pub const RLIM_INFINITY: ::rlim_t = !0;
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = 15;
pub const RLIMIT_NLIMITS: ::c_int = 16;
#[allow(deprecated)]
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
Expand Down Expand Up @@ -1443,7 +1438,7 @@ pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_SEQPACKET: ::c_int = 5;

pub const IPPROTO_MAX: ::c_int = 256;
pub const IPPROTO_MAX: ::c_int = 263;

pub const SOL_SOCKET: ::c_int = 1;

Expand Down Expand Up @@ -1499,10 +1494,10 @@ pub const EXTPROC: ::tcflag_t = 0x00010000;

pub const MAP_HUGETLB: ::c_int = 0x040000;

pub const F_GETLK: ::c_int = 12;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETLK: ::c_int = 13;
pub const F_SETLKW: ::c_int = 14;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_SETOWN: ::c_int = 8;
pub const F_OFD_GETLK: ::c_int = 36;
pub const F_OFD_SETLK: ::c_int = 37;
Expand Down Expand Up @@ -1563,7 +1558,7 @@ pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_DSR: ::c_int = 0x100;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
pub const TIOCM_RI: ::c_int = TIOCM_RNG;
pub const O_TMPFILE: ::c_int = 0x400000;
pub const O_TMPFILE: ::c_int = 0x410000;

pub const MAX_ADDR_LEN: usize = 7;
pub const ARPD_UPDATE: ::c_ushort = 0x01;
Expand Down