Last active
August 1, 2024 14:53
-
-
Save ichizok/f84bf43088068fe142355292802ae953 to your computer and use it in GitHub Desktop.
for Solaris/illumos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.cargo/config.toml b/.cargo/config.toml | |
index f5b2f124b..6cd093e8e 100644 | |
--- a/.cargo/config.toml | |
+++ b/.cargo/config.toml | |
@@ -23,6 +23,9 @@ rustflags = [ | |
"link-args=-fuse-ld=lld -weak_framework Metal -weak_framework MetalPerformanceShaders -weak_framework QuartzCore -weak_framework CoreGraphics", | |
] | |
+[target.x86_64-unknown-illumos] | |
+rustflags = ["-C", "link-args=-latomic -lffi -lstdc++"] | |
+ | |
[target.'cfg(all())'] | |
rustflags = [ | |
"-D", | |
@@ -36,3 +39,7 @@ rustflags = [ | |
"--cfg", | |
"tokio_unstable", | |
] | |
+ | |
+[env] | |
+V8_FROM_SOURCE = "1" | |
+CLANG_BASE_PATH = "/usr" | |
diff --git a/Cargo.toml b/Cargo.toml | |
index 6961b69bf..288943fa6 100644 | |
--- a/Cargo.toml | |
+++ b/Cargo.toml | |
@@ -387,3 +387,7 @@ opt-level = 3 | |
opt-level = 3 | |
[profile.release.package.zstd-sys] | |
opt-level = 3 | |
+ | |
+[replace] | |
+"deno_lint:0.61.0" = { path = "../deno_lint" } | |
+"v8:0.99.0" = { path = "../rusty_v8" } | |
diff --git a/cli/napi/generated_symbol_exports_list_illumos.def b/cli/napi/generated_symbol_exports_list_illumos.def | |
new file mode 100644 | |
index 000000000..e69de29bb | |
diff --git a/cli/napi/generated_symbol_exports_list_solaris.def b/cli/napi/generated_symbol_exports_list_solaris.def | |
new file mode 100644 | |
index 000000000..e69de29bb | |
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js | |
index 767ed11f4..65b3a4802 100644 | |
--- a/ext/fs/30_fs.js | |
+++ b/ext/fs/30_fs.js | |
@@ -301,7 +301,7 @@ function createByteStruct(types) { | |
// types can be "date", "bool" or "u64". | |
let offset = 0; | |
let str = | |
- 'const unix = Deno.build.os === "darwin" || Deno.build.os === "linux" || Deno.build.os === "android" || Deno.build.os === "openbsd" || Deno.build.os === "freebsd"; return {'; | |
+ 'const unix = Deno.build.os === "darwin" || Deno.build.os === "linux" || Deno.build.os === "android" || Deno.build.os === "openbsd" || Deno.build.os === "freebsd" || Deno.build.os === "solaris" || Deno.build.os === "illumos"; return {'; | |
const typeEntries = ObjectEntries(types); | |
for (let i = 0; i < typeEntries.length; ++i) { | |
let { 0: name, 1: type } = typeEntries[i]; | |
@@ -370,7 +370,9 @@ function parseFileInfo(response) { | |
core.build.os === "linux" || | |
core.build.os === "android" || | |
core.build.os === "freebsd" || | |
- core.build.os === "openbsd"; | |
+ core.build.os === "openbsd" || | |
+ core.build.os === "solaris" || | |
+ core.build.os === "illumos"; | |
return { | |
isFile: response.isFile, | |
isDirectory: response.isDirectory, | |
diff --git a/ext/fs/std_fs.rs b/ext/fs/std_fs.rs | |
index 3cbd154d5..b3e0ae2d8 100644 | |
--- a/ext/fs/std_fs.rs | |
+++ b/ext/fs/std_fs.rs | |
@@ -64,7 +64,12 @@ impl FileSystem for RealFs { | |
let _ = umask(prev); | |
prev | |
}; | |
- #[cfg(any(target_os = "android", target_os = "linux"))] | |
+ #[cfg(any( | |
+ target_os = "android", | |
+ target_os = "linux", | |
+ target_os = "solaris", | |
+ target_os = "illumos" | |
+ ))] | |
{ | |
Ok(r.bits()) | |
} | |
diff --git a/ext/net/ops.rs b/ext/net/ops.rs | |
index f28778d29..5743a80f2 100644 | |
--- a/ext/net/ops.rs | |
+++ b/ext/net/ops.rs | |
@@ -413,7 +413,14 @@ where | |
target_os = "linux" | |
))] | |
socket_tmp.set_reuse_address(true)?; | |
- #[cfg(all(unix, not(target_os = "linux")))] | |
+ #[cfg(all( | |
+ unix, | |
+ not(any( | |
+ target_os = "linux", | |
+ target_os = "solaris", | |
+ target_os = "illumos" | |
+ )) | |
+ ))] | |
socket_tmp.set_reuse_port(true)?; | |
} | |
let socket_addr = socket2::SockAddr::from(addr); | |
diff --git a/ext/net/tcp.rs b/ext/net/tcp.rs | |
index 63baa8e4b..aee38c64a 100644 | |
--- a/ext/net/tcp.rs | |
+++ b/ext/net/tcp.rs | |
@@ -157,7 +157,7 @@ fn bind_socket_and_listen( | |
} else { | |
socket2::Socket::new(Domain::IPV6, Type::STREAM, Some(Protocol::TCP))? | |
}; | |
- #[cfg(not(windows))] | |
+ #[cfg(not(any(windows, target_os = "solaris", target_os = "illumos")))] | |
if REUSE_PORT_LOAD_BALANCES && reuse_port { | |
socket.set_reuse_port(true)?; | |
} | |
diff --git a/ext/node/ops/fs.rs b/ext/node/ops/fs.rs | |
index 687903325..88b4cd699 100644 | |
--- a/ext/node/ops/fs.rs | |
+++ b/ext/node/ops/fs.rs | |
@@ -140,6 +140,7 @@ where | |
let path = OsStr::new(&path); | |
let mut cpath = path.as_bytes().to_vec(); | |
cpath.push(0); | |
+ #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] | |
if bigint { | |
#[cfg(not(target_os = "macos"))] | |
// SAFETY: `cpath` is NUL-terminated and result is pointer to valid statfs memory. | |
@@ -184,6 +185,27 @@ where | |
ffree: result.f_ffree as _, | |
}) | |
} | |
+ #[cfg(any(target_os = "solaris", target_os = "illumos"))] | |
+ { | |
+ let _ = bigint; | |
+ // SAFETY: `cpath` is NUL-terminated and result is pointer to valid statfs memory. | |
+ let (code, result) = unsafe { | |
+ let mut result: libc::statvfs = std::mem::zeroed(); | |
+ (libc::statvfs(cpath.as_ptr() as _, &mut result), result) | |
+ }; | |
+ if code == -1 { | |
+ return Err(std::io::Error::last_os_error().into()); | |
+ } | |
+ Ok(StatFs { | |
+ typ: 0, | |
+ bsize: result.f_bsize as _, | |
+ blocks: result.f_blocks as _, | |
+ bfree: result.f_bfree as _, | |
+ bavail: result.f_bavail as _, | |
+ files: result.f_files as _, | |
+ ffree: result.f_ffree as _, | |
+ }) | |
+ } | |
} | |
#[cfg(windows)] | |
{ | |
diff --git a/ext/node/ops/os/cpus.rs b/ext/node/ops/os/cpus.rs | |
index f57e84a1c..f155cbf65 100644 | |
--- a/ext/node/ops/os/cpus.rs | |
+++ b/ext/node/ops/os/cpus.rs | |
@@ -294,6 +294,13 @@ pub fn cpu_info() -> Option<Vec<CpuInfo>> { | |
Some(cpus) | |
} | |
+#[cfg(any(target_os = "solaris", target_os = "illumos"))] | |
+pub fn cpu_info() -> Option<Vec<CpuInfo>> { | |
+ // TODO | |
+ let cpus = vec![CpuInfo::new(); 0]; | |
+ Some(cpus) | |
+} | |
+ | |
#[cfg(test)] | |
mod tests { | |
use super::*; | |
diff --git a/ext/node/polyfills/_util/os.ts b/ext/node/polyfills/_util/os.ts | |
index 421d5d9da..cd088245c 100644 | |
--- a/ext/node/polyfills/_util/os.ts | |
+++ b/ext/node/polyfills/_util/os.ts | |
@@ -8,7 +8,9 @@ export type OSType = | |
| "android" | |
| "darwin" | |
| "freebsd" | |
- | "openbsd"; | |
+ | "openbsd" | |
+ | "solaris" | |
+ | "illumos"; | |
export const osType: OSType = op_node_build_os(); | |
diff --git a/ext/node/polyfills/internal_binding/uv.ts b/ext/node/polyfills/internal_binding/uv.ts | |
index aa468a0a5..38affb465 100644 | |
--- a/ext/node/polyfills/internal_binding/uv.ts | |
+++ b/ext/node/polyfills/internal_binding/uv.ts | |
@@ -487,6 +487,95 @@ const errorToCodeOpenBSD: CodeMapData = codeToErrorOpenBSD.map(( | |
[status, [code]], | |
) => [code, status]); | |
+const codeToErrorSunOS: ErrorMapData = [ | |
+ [-7, ["E2BIG", "argument list too long"]], | |
+ [-13, ["EACCES", "permission denied"]], | |
+ [-125, ["EADDRINUSE", "address already in use"]], | |
+ [-126, ["EADDRNOTAVAIL", "address not available"]], | |
+ [-124, ["EAFNOSUPPORT", "address family not supported"]], | |
+ [-11, ["EAGAIN", "resource temporarily unavailable"]], | |
+ [-3000, ["EAI_ADDRFAMILY", "address family not supported"]], | |
+ [-3001, ["EAI_AGAIN", "temporary failure"]], | |
+ [-3002, ["EAI_BADFLAGS", "bad ai_flags value"]], | |
+ [-3013, ["EAI_BADHINTS", "invalid value for hints"]], | |
+ [-3003, ["EAI_CANCELED", "request canceled"]], | |
+ [-3004, ["EAI_FAIL", "permanent failure"]], | |
+ [-3005, ["EAI_FAMILY", "ai_family not supported"]], | |
+ [-3006, ["EAI_MEMORY", "out of memory"]], | |
+ [-3007, ["EAI_NODATA", "no address"]], | |
+ [-3008, ["EAI_NONAME", "unknown node or service"]], | |
+ [-3009, ["EAI_OVERFLOW", "argument buffer overflow"]], | |
+ [-3014, ["EAI_PROTOCOL", "resolved protocol is unknown"]], | |
+ [-3010, ["EAI_SERVICE", "service not available for socket type"]], | |
+ [-3011, ["EAI_SOCKTYPE", "socket type not supported"]], | |
+ [-149, ["EALREADY", "connection already in progress"]], | |
+ [-9, ["EBADF", "bad file descriptor"]], | |
+ [-16, ["EBUSY", "resource busy or locked"]], | |
+ [-47, ["ECANCELED", "operation canceled"]], | |
+ [-4080, ["ECHARSET", "invalid Unicode character"]], | |
+ [-130, ["ECONNABORTED", "software caused connection abort"]], | |
+ [-146, ["ECONNREFUSED", "connection refused"]], | |
+ [-131, ["ECONNRESET", "connection reset by peer"]], | |
+ [-96, ["EDESTADDRREQ", "destination address required"]], | |
+ [-17, ["EEXIST", "file already exists"]], | |
+ [-14, ["EFAULT", "bad address in system call argument"]], | |
+ [-27, ["EFBIG", "file too large"]], | |
+ [-148, ["EHOSTUNREACH", "host is unreachable"]], | |
+ [-4, ["EINTR", "interrupted system call"]], | |
+ [-22, ["EINVAL", "invalid argument"]], | |
+ [-5, ["EIO", "i/o error"]], | |
+ [-133, ["EISCONN", "socket is already connected"]], | |
+ [-21, ["EISDIR", "illegal operation on a directory"]], | |
+ [-90, ["ELOOP", "too many symbolic links encountered"]], | |
+ [-24, ["EMFILE", "too many open files"]], | |
+ [-97, ["EMSGSIZE", "message too long"]], | |
+ [-78, ["ENAMETOOLONG", "name too long"]], | |
+ [-127, ["ENETDOWN", "network is down"]], | |
+ [-128, ["ENETUNREACH", "network is unreachable"]], | |
+ [-23, ["ENFILE", "file table overflow"]], | |
+ [-132, ["ENOBUFS", "no buffer space available"]], | |
+ [-19, ["ENODEV", "no such device"]], | |
+ [-2, ["ENOENT", "no such file or directory"]], | |
+ [-12, ["ENOMEM", "not enough memory"]], | |
+ [-64, ["ENONET", "machine is not on the network"]], | |
+ [-99, ["ENOPROTOOPT", "protocol not available"]], | |
+ [-28, ["ENOSPC", "no space left on device"]], | |
+ [-89, ["ENOSYS", "function not implemented"]], | |
+ [-134, ["ENOTCONN", "socket is not connected"]], | |
+ [-20, ["ENOTDIR", "not a directory"]], | |
+ [-93, ["ENOTEMPTY", "directory not empty"]], | |
+ [-95, ["ENOTSOCK", "socket operation on non-socket"]], | |
+ [-48, ["ENOTSUP", "operation not supported on socket"]], | |
+ [-79, ["EOVERFLOW", "value too large for defined data type"]], | |
+ [-1, ["EPERM", "operation not permitted"]], | |
+ [-32, ["EPIPE", "broken pipe"]], | |
+ [-71, ["EPROTO", "protocol error"]], | |
+ [-120, ["EPROTONOSUPPORT", "protocol not supported"]], | |
+ [-98, ["EPROTOTYPE", "protocol wrong type for socket"]], | |
+ [-34, ["ERANGE", "result too large"]], | |
+ [-30, ["EROFS", "read-only file system"]], | |
+ [-143, ["ESHUTDOWN", "cannot send after transport endpoint shutdown"]], | |
+ [-29, ["ESPIPE", "invalid seek"]], | |
+ [-3, ["ESRCH", "no such process"]], | |
+ [-145, ["ETIMEDOUT", "connection timed out"]], | |
+ [-26, ["ETXTBSY", "text file is busy"]], | |
+ [-18, ["EXDEV", "cross-device link not permitted"]], | |
+ [-4094, ["UNKNOWN", "unknown error"]], | |
+ [-1, ["EOF", "end of file"]], | |
+ [-6, ["ENXIO", "no such device or address"]], | |
+ [-31, ["EMLINK", "too many links"]], | |
+ [-147, ["EHOSTDOWN", "host is down"]], | |
+ [-4030, ["EREMOTEIO", "remote I/O error"]], | |
+ [-25, ["ENOTTY", "inappropriate ioctl for device"]], | |
+ [-4028, ["EFTYPE", "inappropriate file type or format"]], | |
+ [-88, ["EILSEQ", "illegal byte sequence"]], | |
+ [-121, ["ESOCKTNOSUPPORT", "socket type not supported"]], | |
+]; | |
+ | |
+const errorToCodeSunOS: CodeMapData = codeToErrorSunOS.map(( | |
+ [status, [code]], | |
+) => [code, status]); | |
+ | |
export const errorMap = new Map<number, [string, string]>( | |
osType === "windows" | |
? codeToErrorWindows | |
@@ -500,6 +589,8 @@ export const errorMap = new Map<number, [string, string]>( | |
? codeToErrorFreebsd | |
: osType === "openbsd" | |
? codeToErrorOpenBSD | |
+ : osType === "solaris" || osType === "illumos" | |
+ ? codeToErrorSunOS | |
: unreachable(), | |
); | |
@@ -516,6 +607,8 @@ export const codeMap = new Map<string, number>( | |
? errorToCodeFreebsd | |
: osType === "openbsd" | |
? errorToCodeOpenBSD | |
+ : osType === "solaris" || osType === "illumos" | |
+ ? errorToCodeSunOS | |
: unreachable(), | |
); | |
diff --git a/ext/node/polyfills/os.ts b/ext/node/polyfills/os.ts | |
index 1cd466ec2..41d3a54d4 100644 | |
--- a/ext/node/polyfills/os.ts | |
+++ b/ext/node/polyfills/os.ts | |
@@ -310,6 +310,9 @@ export function type(): string { | |
return "FreeBSD"; | |
case "openbsd": | |
return "OpenBSD"; | |
+ case "solaris": | |
+ case "illumos": | |
+ return "SunOS"; | |
default: | |
throw Error("unreachable"); | |
} | |
diff --git a/ext/webgpu/byow.rs b/ext/webgpu/byow.rs | |
index fa3ce2d96..8b57248e5 100644 | |
--- a/ext/webgpu/byow.rs | |
+++ b/ext/webgpu/byow.rs | |
@@ -10,7 +10,9 @@ use std::ffi::c_void; | |
target_os = "linux", | |
target_os = "macos", | |
target_os = "freebsd", | |
- target_os = "openbsd" | |
+ target_os = "openbsd", | |
+ target_os = "solaris", | |
+ target_os = "illumos" | |
))] | |
use std::ptr::NonNull; | |
@@ -110,7 +112,13 @@ fn raw_window( | |
Ok((win_handle, display_handle)) | |
} | |
-#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] | |
+#[cfg(any( | |
+ target_os = "linux", | |
+ target_os = "freebsd", | |
+ target_os = "openbsd", | |
+ target_os = "solaris", | |
+ target_os = "illumos" | |
+))] | |
fn raw_window( | |
system: &str, | |
window: *const c_void, | |
@@ -143,7 +151,13 @@ fn raw_window( | |
), | |
); | |
} else { | |
- return Err(type_error("Invalid system on Linux/BSD")); | |
+ #[cfg(target_os = "linux")] | |
+ let os = "Linux"; | |
+ #[cfg(any(target_os = "freebsd", target_os = "openbsd"))] | |
+ let os = "BSD"; | |
+ #[cfg(any(target_os = "solaris", target_os = "illumos"))] | |
+ let os = "SunOS"; | |
+ return Err(type_error(format!("Invalid system on {}", os))); | |
} | |
Ok((win_handle, display_handle)) | |
diff --git a/runtime/ops/os/mod.rs b/runtime/ops/os/mod.rs | |
index 544031dd7..8a9a13815 100644 | |
--- a/runtime/ops/os/mod.rs | |
+++ b/runtime/ops/os/mod.rs | |
@@ -485,6 +485,18 @@ fn rss() -> usize { | |
} | |
} | |
+#[cfg(any(target_os = "solaris", target_os = "illumos"))] | |
+fn rss() -> usize { | |
+ let psinfo_content = if let Ok(c) = std::fs::read("/proc/self/psinfo") { | |
+ c | |
+ } else { | |
+ return 0; | |
+ }; | |
+ // Obtain the field `pr_rssize` in psinfo_t; from 56..64 bytes | |
+ let b = psinfo_content[56..64].try_into().unwrap(); | |
+ usize::from_ne_bytes(b) * 1024 | |
+} | |
+ | |
fn os_uptime(state: &mut OpState) -> Result<u64, AnyError> { | |
state | |
.borrow_mut::<PermissionsContainer>() | |
diff --git a/runtime/ops/os/sys_info.rs b/runtime/ops/os/sys_info.rs | |
index e865bc8f9..f1e9b534c 100644 | |
--- a/runtime/ops/os/sys_info.rs | |
+++ b/runtime/ops/os/sys_info.rs | |
@@ -28,7 +28,9 @@ pub fn loadavg() -> LoadAvg { | |
#[cfg(any( | |
target_vendor = "apple", | |
target_os = "freebsd", | |
- target_os = "openbsd" | |
+ target_os = "openbsd", | |
+ target_os = "solaris", | |
+ target_os = "illumos" | |
))] | |
{ | |
let mut l: [f64; 3] = [0.; 3]; | |
@@ -133,6 +135,19 @@ pub fn os_release() -> String { | |
) | |
} | |
} | |
+ #[cfg(any(target_os = "solaris", target_os = "illumos"))] | |
+ { | |
+ let mut un = std::mem::MaybeUninit::<libc::utsname>::uninit(); | |
+ let res = unsafe { libc::uname(un.as_mut_ptr()) }; | |
+ if res >= 0 { | |
+ let un = unsafe { un.assume_init() }; | |
+ unsafe { std::ffi::CStr::from_ptr(un.release.as_ptr()) } | |
+ .to_string_lossy() | |
+ .to_string() | |
+ } else { | |
+ String::from("") | |
+ } | |
+ } | |
} | |
#[cfg(target_family = "windows")] | |
@@ -351,6 +366,13 @@ pub fn mem_info() -> Option<MemInfo> { | |
} | |
} | |
} | |
+ #[cfg(any(target_os = "solaris", target_os = "illumos"))] | |
+ { | |
+ // TODO | |
+ let pagesize = unsafe { libc::sysconf(libc::_SC_PAGESIZE) }; | |
+ let phys_pages = unsafe { libc::sysconf(libc::_SC_PHYS_PAGES) }; | |
+ mem_info.total = (phys_pages as u64) * (pagesize as u64); | |
+ } | |
Some(mem_info) | |
} | |
@@ -421,5 +443,63 @@ pub fn os_uptime() -> u64 { | |
uptime = winapi::um::sysinfoapi::GetTickCount64() / 1000; | |
} | |
+ #[cfg(any(target_os = "solaris", target_os = "illumos"))] | |
+ { | |
+ use std::io::Read; | |
+ use std::time::Duration; | |
+ use std::time::SystemTime; | |
+ #[repr(C)] | |
+ struct timeval { | |
+ pub tv_sec: i32, | |
+ pub tv_usec: i32, | |
+ } | |
+ #[repr(C)] | |
+ struct utmpx { | |
+ pub ut_user: [libc::c_char; 32usize], | |
+ pub ut_id: [libc::c_char; 4usize], | |
+ pub ut_line: [libc::c_char; 32usize], | |
+ pub ut_pid: libc::pid_t, | |
+ pub ut_type: libc::c_short, | |
+ pub ut_exit: [libc::c_short; 2usize], | |
+ pub ut_tv: timeval, | |
+ pub ut_session: libc::c_int, | |
+ pub pad: [libc::c_int; 5usize], | |
+ pub ut_syslen: libc::c_short, | |
+ pub ut_host: [libc::c_char; 257usize], | |
+ } | |
+ const BOOT_TIME: i16 = 2; | |
+ uptime = if let Ok(c) = std::fs::read("/var/adm/utmpx") { | |
+ let mut c = &c[..]; | |
+ loop { | |
+ let mut u = std::mem::MaybeUninit::<utmpx>::uninit(); | |
+ let b = unsafe { | |
+ std::slice::from_raw_parts_mut( | |
+ u.as_mut_ptr() as *mut u8, | |
+ std::mem::size_of::<utmpx>(), | |
+ ) | |
+ }; | |
+ if let Ok(()) = c.read_exact(b) { | |
+ let u = unsafe { u.assume_init() }; | |
+ if u.ut_type == BOOT_TIME { | |
+ break SystemTime::now() | |
+ .duration_since(SystemTime::UNIX_EPOCH) | |
+ .map(|d| { | |
+ (d - Duration::new( | |
+ u.ut_tv.tv_sec as u64, | |
+ u.ut_tv.tv_usec as u32 * 1000, | |
+ )) | |
+ .as_secs() | |
+ }) | |
+ .unwrap_or_default(); | |
+ }; | |
+ } else { | |
+ break 0; | |
+ } | |
+ } | |
+ } else { | |
+ 0 | |
+ } | |
+ } | |
+ | |
uptime | |
} | |
diff --git a/tests/wpt/runner/utils.ts b/tests/wpt/runner/utils.ts | |
index 1674419cd..d1eaed4e2 100644 | |
--- a/tests/wpt/runner/utils.ts | |
+++ b/tests/wpt/runner/utils.ts | |
@@ -178,6 +178,8 @@ export async function generateRunInfo(): Promise<unknown> { | |
"linux": "linux", | |
"freebsd": "freebsd", | |
"openbsd": "openbsd", | |
+ "solaris": "solaris", | |
+ "illumos": "illumos", | |
}; | |
const proc = await new Deno.Command("git", { | |
args: ["rev-parse", "HEAD"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/rules/no_compare_neg_zero.rs b/src/rules/no_compare_neg_zero.rs | |
index 71318d2..f77ef57 100644 | |
--- a/src/rules/no_compare_neg_zero.rs | |
+++ b/src/rules/no_compare_neg_zero.rs | |
@@ -19,15 +19,13 @@ const CODE: &str = "no-compare-neg-zero"; | |
#[derive(Display)] | |
enum NoCompareNegZeroMessage { | |
- #[display(fmt = NoCompareNegZeroMessage::Unexpected)] | |
+ #[display(fmt = "Unexpected")] | |
Unexpected, | |
} | |
#[derive(Display)] | |
enum NoCompareNegZeroHint { | |
- #[display( | |
- fmt = NoCompareNegZeroHint::ObjectIs | |
- )] | |
+ #[display(fmt = "ObjectIs")] | |
ObjectIs, | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.cargo/config.toml b/.cargo/config.toml | |
index 55a8e921..2815ab56 100644 | |
--- a/.cargo/config.toml | |
+++ b/.cargo/config.toml | |
@@ -3,3 +3,10 @@ linker = "./third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aa | |
[target.x86_64-linux-android] | |
linker = "./third_party/android_ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android24-clang++" | |
+ | |
+[target.x86_64-unknown-illumos] | |
+rustflags = ["-C", "link-args=-lffi -lstdc++"] | |
+ | |
+[env] | |
+V8_FROM_SOURCE = "1" | |
+CLANG_BASE_PATH = "/usr" | |
Submodule build contains modified content | |
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn | |
index f3aa55930..948f7ed03 100644 | |
--- a/build/config/BUILDCONFIG.gn | |
+++ b/build/config/BUILDCONFIG.gn | |
@@ -225,6 +225,12 @@ if (host_toolchain == "") { | |
host_toolchain = "//build/toolchain/aix:$host_cpu" | |
} else if (host_os == "zos") { | |
host_toolchain = "//build/toolchain/zos:$host_cpu" | |
+ } else if (host_os == "solaris") { | |
+ if (is_clang) { | |
+ host_toolchain = "//build/toolchain/solaris:clang_$host_cpu" | |
+ } else { | |
+ host_toolchain = "//build/toolchain/solaris:$host_cpu" | |
+ } | |
} else { | |
assert(false, "Unsupported host_os: $host_os") | |
} | |
@@ -268,6 +274,12 @@ if (target_os == "android") { | |
_default_toolchain = "//build/toolchain/aix:$target_cpu" | |
} else if (target_os == "zos") { | |
_default_toolchain = "//build/toolchain/zos:$target_cpu" | |
+} else if (target_os == "solaris") { | |
+ if (is_clang) { | |
+ _default_toolchain = "//build/toolchain/solaris:clang_$target_cpu" | |
+ } else { | |
+ _default_toolchain = "//build/toolchain/solaris:$target_cpu" | |
+ } | |
} else { | |
assert(false, "Unsupported target_os: $target_os") | |
} | |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn | |
index 2b95baafb..14280d0b8 100644 | |
--- a/build/config/compiler/BUILD.gn | |
+++ b/build/config/compiler/BUILD.gn | |
@@ -413,7 +413,7 @@ config("compiler") { | |
# compute, so only use it in the official build to avoid slowing down | |
# links. | |
ldflags += [ "-Wl,--build-id=sha1" ] | |
- } else if (current_os != "aix" && current_os != "zos") { | |
+ } else if (current_os != "aix" && current_os != "zos" && current_os != "solaris") { | |
ldflags += [ "-Wl,--build-id" ] | |
} | |
@@ -835,7 +835,7 @@ config("compiler") { | |
# * Apple platforms (e.g. MacOS, iPhone, iPad) aren't supported because xcode | |
# lldb doesn't have the needed changes yet. | |
# TODO(crbug.com/1379070): Remove if the upstream default ever changes. | |
- if (is_clang && !is_nacl && !is_win && !is_apple) { | |
+ if (is_clang && !is_nacl && !is_win && !is_apple && current_os != "solaris") { | |
cflags_cc += [ "-gsimple-template-names" ] | |
} | |
@@ -1405,7 +1405,7 @@ config("compiler_deterministic") { | |
# Tells the compiler not to use absolute paths when passing the default | |
# paths to the tools it invokes. We don't want this because we don't | |
# really need it and it can mess up the goma cache entries. | |
- if (is_clang && (!is_nacl || is_nacl_saigo)) { | |
+ if (is_clang && (!is_nacl || is_nacl_saigo) && current_os != "solaris") { | |
cflags += [ "-no-canonical-prefixes" ] | |
# Same for links: Let the compiler driver invoke the linker | |
@@ -2097,7 +2097,7 @@ if (is_win) { | |
"-Wl,-no_function_starts", | |
] | |
} | |
- } else if (current_os != "aix" && current_os != "zos") { | |
+ } else if (current_os != "aix" && current_os != "zos" && current_os != "solaris") { | |
# Non-Mac Posix flags. | |
# Aix does not support these. | |
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni | |
index 4738ee80d..458cb8cda 100644 | |
--- a/build/config/compiler/compiler.gni | |
+++ b/build/config/compiler/compiler.gni | |
@@ -35,7 +35,7 @@ declare_args() { | |
# In late bring-up on macOS (see docs/mac_lld.md). | |
# Tentatively used on iOS. | |
# The default linker everywhere else. | |
- use_lld = is_clang && current_os != "zos" | |
+ use_lld = is_clang && current_os != "zos" && current_os != "solaris" | |
# If true, optimize for size. | |
# Default to favoring speed over size for platforms not listed below. | |
diff --git a/build/print_clang_major_version.py b/build/print_clang_major_version.py | |
index 2f7b04ce5..43898728d 100755 | |
--- a/build/print_clang_major_version.py | |
+++ b/build/print_clang_major_version.py | |
@@ -8,7 +8,7 @@ import sys | |
def main(): | |
clang_bin = sys.argv[1] | |
output = subprocess.check_output([clang_bin, "--version"]) | |
- major_version = int(re.search(b"version (\d+)\.\d+\.\d+", output)[1]) | |
+ major_version = int(re.search(b"version (\d+)\.\d+\.\d+", output).group(1)) | |
print(major_version) | |
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni | |
index ad994319c..7a359ec31 100644 | |
--- a/build/toolchain/gcc_toolchain.gni | |
+++ b/build/toolchain/gcc_toolchain.gni | |
@@ -413,6 +413,8 @@ template("single_gcc_toolchain") { | |
# AIX does not support either -D (deterministic output) or response | |
# files. | |
command = "$ar -X64 {{arflags}} -r -c -s {{output}} {{inputs}}" | |
+ } else if (current_os == "solaris") { | |
+ command = "$ar {{arflags}} -r -c -s {{output}} {{inputs}}" | |
} else { | |
rspfile = "{{output}}.rsp" | |
rspfile_content = "{{inputs}}" | |
diff --git a/build/toolchain/solaris/BUILD.gn b/build/toolchain/solaris/BUILD.gn | |
new file mode 100644 | |
index 000000000..202e8b3e2 | |
--- /dev/null | |
+++ b/build/toolchain/solaris/BUILD.gn | |
@@ -0,0 +1,45 @@ | |
+# Copyright 2022 The Chromium Authors. All rights reserved. | |
+# Use of this source code is governed by a BSD-style license that can be | |
+# found in the LICENSE file. | |
+ | |
+import("//build/toolchain/gcc_toolchain.gni") | |
+ | |
+gcc_toolchain("clang_x64") { | |
+ prefix = rebase_path("${clang_base_path}/bin", root_build_dir) | |
+ cc = "${prefix}/clang" | |
+ cxx = "${prefix}/clang++" | |
+ readelf = "readelf" | |
+ nm = "/usr/bin/nm" | |
+ ar = "/usr/bin/ar" | |
+ ld = cxx | |
+ | |
+ # Output linker map files for binary size analysis. | |
+ enable_linker_map = true | |
+ | |
+ toolchain_args = { | |
+ current_cpu = "x64" | |
+ current_os = "solaris" | |
+ | |
+ is_clang = true | |
+ } | |
+} | |
+ | |
+gcc_toolchain("x64") { | |
+ cc = "gcc" | |
+ cxx = "g++" | |
+ readelf = "readelf" | |
+ nm = "/usr/bin/nm" | |
+ ar = "/usr/bin/ar" | |
+ ld = cxx | |
+ | |
+ # Output linker map files for binary size analysis. | |
+ enable_linker_map = true | |
+ | |
+ toolchain_args = { | |
+ current_cpu = "x64" | |
+ current_os = "solaris" | |
+ | |
+ # reclient does not support gcc. | |
+ is_clang = false | |
+ } | |
+} | |
diff --git a/build.rs b/build.rs | |
index 48221b6e..470c28af 100644 | |
--- a/build.rs | |
+++ b/build.rs | |
@@ -326,6 +326,8 @@ fn host_platform() -> String { | |
"mac" | |
} else if cfg!(target_os = "windows") { | |
"windows" | |
+ } else if cfg!(target_os = "solaris") || cfg!(target_os = "illumos") { | |
+ "solaris" | |
} else { | |
"unknown" | |
}; | |
Submodule v8 contains modified content | |
diff --git a/v8/BUILD.gn b/v8/BUILD.gn | |
index c2c11c24ac..77bad0104e 100644 | |
--- a/v8/BUILD.gn | |
+++ b/v8/BUILD.gn | |
@@ -6487,7 +6487,7 @@ v8_component("v8_libbase") { | |
"src/base/platform/platform-posix.cc", | |
"src/base/platform/platform-posix.h", | |
] | |
- if (current_os != "aix") { | |
+ if (current_os != "aix" && current_os != "solaris") { | |
sources += [ | |
"src/base/platform/platform-posix-time.cc", | |
"src/base/platform/platform-posix-time.h", | |
@@ -6513,6 +6513,18 @@ v8_component("v8_libbase") { | |
] | |
libs = [ "dl" ] | |
+ } else if (current_os == "solaris") { | |
+ sources += [ | |
+ "src/base/debug/stack_trace_posix.cc", | |
+ "src/base/platform/platform-solaris.cc", | |
+ ] | |
+ | |
+ libs = [ | |
+ "atomic", | |
+ "dl", | |
+ "socket", | |
+ "rt", | |
+ ] | |
} else if (is_android) { | |
if (current_toolchain == host_toolchain) { | |
libs = [ | |
diff --git a/v8/src/base/platform/platform-posix.cc b/v8/src/base/platform/platform-posix.cc | |
index 8ba545a93a..f11b7904a6 100644 | |
--- a/v8/src/base/platform/platform-posix.cc | |
+++ b/v8/src/base/platform/platform-posix.cc | |
@@ -78,9 +78,9 @@ | |
#if defined(V8_OS_SOLARIS) | |
#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__) | |
-extern "C" int madvise(caddr_t, size_t, int); | |
+extern "C" int madvise(void*, size_t, int); | |
#else | |
-extern int madvise(caddr_t, size_t, int); | |
+extern int madvise(void*, size_t, int); | |
#endif | |
#endif | |
@@ -563,7 +563,7 @@ bool OS::DiscardSystemPages(void* address, size_t size) { | |
// MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED. | |
ret = madvise(address, size, MADV_DONTNEED); | |
} | |
-#elif defined(_AIX) || defined(V8_OS_SOLARIS) | |
+#elif defined(_AIX) | |
int ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_FREE); | |
if (ret != 0 && errno == ENOSYS) { | |
return true; // madvise is not available on all systems. | |
@@ -571,6 +571,11 @@ bool OS::DiscardSystemPages(void* address, size_t size) { | |
if (ret != 0 && errno == EINVAL) { | |
ret = madvise(reinterpret_cast<caddr_t>(address), size, MADV_DONTNEED); | |
} | |
+#elif defined(V8_OS_SOLARIS) | |
+ int ret = madvise(address, size, MADV_FREE); | |
+ if (ret != 0 && errno == EINVAL) { | |
+ ret = madvise(address, size, MADV_DONTNEED); | |
+ } | |
#else | |
int ret = madvise(address, size, MADV_DONTNEED); | |
#endif |
I appreciate that! What distribution / version of illumos are you running?
Also, I started a little conversation in the deno dev discord channel about potentially upstreaming this support. See https://discord.com/channels/684898665143206084/684911491035430919/1183076643607171092. If you would be interested, I'd be happy to work with you on that. It also seems like we can get some maintainer support with the initiative.
I use OpenIndiana Hipster and up to date monthly, current is
$ uname -a
SunOS openindiana-dev 5.11 illumos-6a72ec1a15 i86pc i386 i86pc illumos
$ pkg list system/kernel
NAME (PUBLISHER) VERSION IFO
system/kernel 0.5.11-2023.0.0.21913 i--
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI: my procedure,