Compare commits

...

10 Commits

Author SHA1 Message Date
23a37fdfda nac3ld: discard NONE relocations 2025-03-21 16:21:53 +08:00
0bbe5a63b5 msys2: fix llvm build 2025-03-14 14:21:16 +08:00
d119b0dc8b msys2: update 2025-03-14 12:13:14 +08:00
d986449c63 update dependencies 2025-03-14 12:05:06 +08:00
1a1713af5a Revert "Update nac3artiq/src/codegen.rs"
This reverts commit c70923f0fedeb0f8e45cf7cb22a319ec0bb88cf0.
2025-03-07 16:23:04 +08:00
f501269ae0 Revert "Update nac3artiq/src/codegen.rs"
This reverts commit 24d2b34dcc6f6054071c5908d799d74951a3e4be.
2025-03-07 16:23:02 +08:00
24d2b34dcc Update nac3artiq/src/codegen.rs 2025-03-06 23:14:58 +08:00
c70923f0fe Update nac3artiq/src/codegen.rs 2025-03-06 23:10:17 +08:00
77c975ead4 [core] codegen/irrt: Update IRRT implementation for gamma
SciPy 1.15 fixed the behavior of gamma and aligns its behavior to that
of tgamma in C.

All custom handling in __nac3_gamma is removed and the function
definition is moved to cc-builtins.hpp.
2025-03-04 15:40:51 +08:00
7a05bba99c [meta] Apply clippy changes 2025-03-04 15:38:57 +08:00
14 changed files with 176 additions and 183 deletions

166
Cargo.lock generated
View File

@ -12,7 +12,7 @@ dependencies = [
"getrandom 0.2.15",
"once_cell",
"version_check",
"zerocopy",
"zerocopy 0.7.35",
]
[[package]]
@ -142,9 +142,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.5.31"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "027bb0d98429ae334a8698531da7077bdf906419543a35a55c2cb1b66437d767"
checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83"
dependencies = [
"clap_builder",
"clap_derive",
@ -152,9 +152,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.31"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5589e0cba072e0f3d23791efac0fd8627b49c829c196a492e88168e6a669d863"
checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8"
dependencies = [
"anstream",
"anstyle",
@ -164,14 +164,14 @@ dependencies = [
[[package]]
name = "clap_derive"
version = "4.5.28"
version = "4.5.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed"
checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -285,15 +285,15 @@ dependencies = [
[[package]]
name = "dissimilar"
version = "1.0.9"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59f8e79d1fbf76bdfbde321e902714bf6c49df88a7dda6fc682fc2979226962d"
checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921"
[[package]]
name = "either"
version = "1.14.0"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7914353092ddf589ad78f25c5c1c21b7f80b0ff8621e7c814c3485b5306da9d"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "ena"
@ -448,9 +448,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.7.1"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652"
checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058"
dependencies = [
"equivalent",
"hashbrown",
@ -458,9 +458,9 @@ dependencies = [
[[package]]
name = "indoc"
version = "2.0.5"
version = "2.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
[[package]]
name = "inkwell"
@ -482,7 +482,7 @@ source = "git+https://github.com/Derppening/inkwell?tag=0.5.0_llvm15-typed-ptr#9
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -515,9 +515,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.14"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
[[package]]
name = "keccak"
@ -568,9 +568,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libc"
version = "0.2.170"
version = "0.2.171"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
[[package]]
name = "libloading"
@ -590,9 +590,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]]
name = "linux-raw-sys"
version = "0.4.15"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9"
[[package]]
name = "llvm-sys"
@ -688,7 +688,7 @@ dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
"trybuild",
]
@ -732,9 +732,9 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
[[package]]
name = "once_cell"
version = "1.20.3"
version = "1.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc"
[[package]]
name = "parking_lot"
@ -809,7 +809,7 @@ dependencies = [
"phf_shared",
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -829,22 +829,22 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
[[package]]
name = "pin-project"
version = "1.1.9"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfe2e71e1471fe07709406bf725f710b02927c9c54b2b5b2ec0e8087d97c327d"
checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.9"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6e859e6e5bd50440ab63c47e3ebabc90f26251f7c73c3d3e837b74a1cc3fa67"
checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -855,11 +855,11 @@ checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
[[package]]
name = "ppv-lite86"
version = "0.2.20"
version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
dependencies = [
"zerocopy",
"zerocopy 0.8.23",
]
[[package]]
@ -948,7 +948,7 @@ dependencies = [
"proc-macro2",
"pyo3-macros-backend",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -961,14 +961,14 @@ dependencies = [
"proc-macro2",
"pyo3-build-config",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
name = "quote"
version = "1.0.39"
version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
dependencies = [
"proc-macro2",
]
@ -1005,9 +1005,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.5.9"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b568323e98e49e2a0899dcee453dd679fae22d69adf9b11dd508d1549b7e2f"
checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1"
dependencies = [
"bitflags",
]
@ -1050,9 +1050,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.38.44"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825"
dependencies = [
"bitflags",
"errno",
@ -1063,15 +1063,15 @@ dependencies = [
[[package]]
name = "rustversion"
version = "1.0.19"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4"
checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2"
[[package]]
name = "ryu"
version = "1.0.19"
version = "1.0.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd"
checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
[[package]]
name = "same-file"
@ -1090,28 +1090,28 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "semver"
version = "1.0.25"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0"
[[package]]
name = "serde"
version = "1.0.218"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.218"
version = "1.0.219"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -1213,7 +1213,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -1228,9 +1228,9 @@ dependencies = [
[[package]]
name = "syn"
version = "2.0.99"
version = "2.0.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e02e925281e18ffd9d640e234264753c43edc62d64b2d4cf898f1bc5e75f3fc2"
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
dependencies = [
"proc-macro2",
"quote",
@ -1251,11 +1251,10 @@ checksum = "1ac9aa371f599d22256307c24a9d748c041e548cbf599f35d890f9d365361790"
[[package]]
name = "tempfile"
version = "3.17.1"
version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230"
checksum = "488960f40a3fd53d72c2a29a58722561dee8afdd175bd88e3db4677d7b2ba600"
dependencies = [
"cfg-if",
"fastrand",
"getrandom 0.3.1",
"once_cell",
@ -1300,7 +1299,7 @@ dependencies = [
"cfg-if",
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -1311,7 +1310,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
"test-case-core",
]
@ -1332,7 +1331,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
@ -1371,9 +1370,9 @@ dependencies = [
[[package]]
name = "trybuild"
version = "1.0.103"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b812699e0c4f813b872b373a4471717d9eb550da14b311058a4d9cf4173cbca6"
checksum = "6ae08be68c056db96f0e6c6dd820727cca756ced9e1f4cc7fdd20e2a55e23898"
dependencies = [
"dissimilar",
"glob",
@ -1445,9 +1444,9 @@ dependencies = [
[[package]]
name = "unicode-ident"
version = "1.0.17"
version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "unicode-width"
@ -1485,9 +1484,9 @@ dependencies = [
[[package]]
name = "unindent"
version = "0.2.3"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
[[package]]
name = "utf8parse"
@ -1619,9 +1618,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
version = "0.7.3"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7f4ea97f6f78012141bcdb6a216b2609f0979ada50b20ca5b52dde2eac2bb1"
checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36"
dependencies = [
"memchr",
]
@ -1641,8 +1640,16 @@ version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
"zerocopy-derive 0.7.35",
]
[[package]]
name = "zerocopy"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6"
dependencies = [
"zerocopy-derive 0.8.23",
]
[[package]]
@ -1653,5 +1660,16 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.99",
"syn 2.0.100",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.100",
]

6
flake.lock generated
View File

@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1740828860,
"narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=",
"lastModified": 1741851582,
"narHash": "sha256-cPfs8qMccim2RBgtKGF+x9IBCduRvd/N5F4nYpU0TVE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "303bd8071377433a2d8f76e684ec773d70c5b642",
"rev": "6607cf789e541e7873d40d3a8f7815ea92204f32",
"type": "github"
},
"original": {

View File

@ -560,7 +560,7 @@ impl Nac3 {
match &stmt.node {
StmtKind::FunctionDef { decorator_list, .. } => {
for decorator in decorator_list.iter() {
for decorator in decorator_list {
if let Some(decorator_str) = decorator_id_string(decorator) {
if decorator_str == "rpc" {
store_fun
@ -595,7 +595,7 @@ impl Nac3 {
let class_obj = module.getattr(py, class_name.as_str()).unwrap();
for stmt in body {
if let StmtKind::FunctionDef { name, decorator_list, .. } = &stmt.node {
for decorator in decorator_list.iter() {
for decorator in decorator_list {
if let Some(decorator_str) = decorator_id_string(decorator) {
if decorator_str == "rpc" {
let is_async = decorator_list.iter().any(|decorator| {

View File

@ -23,6 +23,10 @@ DEF_builtin_unary(double, cbrt, double);
DEF_builtin_unary(double, erf, double);
DEF_builtin_unary(double, erfc, double);
#define __builtin_gamma __builtin_tgamma
DEF_builtin_unary(double, gamma, double);
#undef __builtin_gamma
DEF_builtin_binary(double, atan2, double, double);
DEF_builtin_binary(double, hypot, double, double);
DEF_builtin_binary(double, nextafter, double, double);

View File

@ -34,27 +34,6 @@ DEF_nac3_int_exp_(int64_t);
DEF_nac3_int_exp_(uint32_t);
DEF_nac3_int_exp_(uint64_t);
double __nac3_gamma(double z) {
// Handling for denormals
// | x | Python gamma(x) | C tgamma(x) |
// --- | ----------------- | --------------- | ----------- |
// (1) | nan | nan | nan |
// (2) | -inf | -inf | inf |
// (3) | inf | inf | inf |
// (4) | 0.0 | inf | inf |
// (5) | {-1.0, -2.0, ...} | inf | nan |
// (1)-(3)
if (__builtin_isinf(z) || __builtin_isnan(z)) {
return z;
}
double v = __builtin_tgamma(z);
// (4)-(5)
return __builtin_isinf(v) || __builtin_isnan(v) ? __builtin_inf() : v;
}
double __nac3_gammaln(double x) {
// libm's handling of value overflows differs from scipy:
// - scipy: gammaln(-inf) -> -inf

View File

@ -1381,7 +1381,7 @@ create_helper_call_numpy_unary_elementwise_float_to_float!(
create_helper_call_numpy_unary_elementwise_float_to_float!(
call_scipy_special_gamma,
"sp_spec_gamma",
|ctx, val, _| irrt::call_gamma(ctx, val)
irrt::call_gamma
);
create_helper_call_numpy_unary_elementwise_float_to_float!(
call_scipy_special_gammaln,

View File

@ -958,7 +958,7 @@ pub fn gen_call<'ctx, G: CodeGenerator>(
} else {
Some(ctx.get_llvm_abi_type(generator, fun.0.ret))
};
let has_sret = ret_type.map_or(false, |ret_type| need_sret(ret_type));
let has_sret = ret_type.is_some_and(|ret_type| need_sret(ret_type));
let mut byrefs = Vec::new();
let mut params = args
.iter()

View File

@ -94,6 +94,7 @@ generate_f64_nary_fn!(call_expm1, expm1, arg);
generate_f64_nary_fn!(call_cbrt, cbrt, arg);
generate_f64_nary_fn!(call_erf, erf, arg);
generate_f64_nary_fn!(call_erfc, erfc, arg);
generate_f64_nary_fn!(call_gamma, gamma, z);
generate_f64_nary_fn!(call_atan2, atan2, y, x);
generate_f64_nary_fn!(call_hypot, hypot, x, y);
generate_f64_nary_fn!(call_nextafter, nextafter, from, to);

View File

@ -59,24 +59,6 @@ pub fn integer_power<'ctx, G: CodeGenerator + ?Sized>(
.unwrap()
}
/// Generates a call to `gamma` in IR. Returns an `f64` representing the result.
pub fn call_gamma<'ctx>(ctx: &CodeGenContext<'ctx, '_>, v: FloatValue<'ctx>) -> FloatValue<'ctx> {
let llvm_f64 = ctx.ctx.f64_type();
assert_eq!(v.get_type(), llvm_f64);
infer_and_call_function(
ctx,
"__nac3_gamma",
Some(llvm_f64.into()),
&[v.into()],
Some("gamma"),
None,
)
.map(BasicValueEnum::into_float_value)
.unwrap()
}
/// Generates a call to `gammaln` in IR. Returns an `f64` representing the result.
pub fn call_gammaln<'ctx>(ctx: &CodeGenContext<'ctx, '_>, v: FloatValue<'ctx>) -> FloatValue<'ctx> {
let llvm_f64 = ctx.ctx.f64_type();

View File

@ -832,7 +832,7 @@ pub fn gen_func_impl<
))
};
let has_sret = ret_type.map_or(false, |ty| need_sret(ty));
let has_sret = ret_type.is_some_and(|ty| need_sret(ty));
let mut params = args
.iter()
.filter(|arg| !arg.is_vararg)

View File

@ -1234,7 +1234,7 @@ impl TopLevelComposer {
ExprKind::Subscript { value, slice, .. }
if matches!(
&value.node,
ast::ExprKind::Name { id, .. } if core_config.kernel_ann.map_or(false, |c| id == &c.into())
ast::ExprKind::Name { id, .. } if core_config.kernel_ann.is_some_and(|c| id == &c.into())
) =>
{
(slice, true)
@ -2001,7 +2001,7 @@ impl TopLevelComposer {
ExprKind::Subscript { value, slice, .. }
if matches!(
&value.node,
ast::ExprKind::Name { id, .. } if self.core_config.kernel_ann.map_or(false, |c| id == &c.into())
ast::ExprKind::Name { id, .. } if self.core_config.kernel_ann.is_some_and(|c| id == &c.into())
) =>
{
slice

View File

@ -228,6 +228,11 @@ impl<'a> Linker<'a> {
}
for reloc in relocs {
// Skip NONE type relocations. It is 0 across all targets.
if reloc.type_info() == 0 {
continue;
}
let sym = match reloc.sym_info() as usize {
STN_UNDEF => None,
sym_index => {
@ -670,6 +675,9 @@ impl<'a> Linker<'a> {
}
}
// Discard NONE relocations
(Isa::CortexA9, R_ARM_NONE) | (Isa::RiscV32, R_RISCV_NONE) => (),
_ => {
println!("Relocation type 0x{:X?} is not supported", reloc.type_info());
unimplemented!()

View File

@ -50,6 +50,7 @@ in rec {
cd llvm
# build of llvm-lto fails and -DLLVM_BUILD_TOOLS=OFF does not disable it reliably because cmake
rm -rf tools/lto
rm -rf tools/sancov
'';
configurePhase =
''

View File

@ -1,15 +1,15 @@
{ pkgs } : [
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libunwind-19.1.7-1-any.pkg.tar.zst";
sha256 = "0yhxd3hix069gy2gh69vbyg95m6x5nar1r9rm3rb8459nlhqxid5";
name = "mingw-w64-clang-x86_64-libunwind-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libunwind-20.1.0-1-any.pkg.tar.zst";
sha256 = "1b70xj60kbnydmgvncav5hyg0n2i16i4hvkkqwnv8d5fkdc74sv2";
name = "mingw-w64-clang-x86_64-libunwind-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libc++-19.1.7-1-any.pkg.tar.zst";
sha256 = "09gbfk91j07a7pxqmama9rjnqdzr3nw9v92b865mrgbn3lz8p5a3";
name = "mingw-w64-clang-x86_64-libc++-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libc++-20.1.0-1-any.pkg.tar.zst";
sha256 = "1mrmwjx769zqq1qd7smf4ma7ggmqx46f47vypwmh3vzg266h1hzl";
name = "mingw-w64-clang-x86_64-libc++-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
@ -25,9 +25,9 @@
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-gettext-runtime-0.23.1-1-any.pkg.tar.zst";
sha256 = "0wbp5pmrr0rk4mx7d1frvqlk4a061zw31zscs57srmvl0wv3pi2a";
name = "mingw-w64-clang-x86_64-gettext-runtime-0.23.1-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-gettext-runtime-0.24-1-any.pkg.tar.zst";
sha256 = "1d9mhn6sh3baj8zibkravgycqxr0lfargjwg3l7rc1k464dl7a22";
name = "mingw-w64-clang-x86_64-gettext-runtime-0.24-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
@ -49,75 +49,75 @@
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-zstd-1.5.6-2-any.pkg.tar.zst";
sha256 = "02cp5ci8w50k7xn38mpkwnr8sn898v18wcc07y8f9sfla7vcyfix";
name = "mingw-w64-clang-x86_64-zstd-1.5.6-2-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-zstd-1.5.7-1-any.pkg.tar.zst";
sha256 = "1hrx54k2s3dcs8fhwdwms5amr4gjid1d20b2b4302xyjg9yyvpxl";
name = "mingw-w64-clang-x86_64-zstd-1.5.7-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-llvm-libs-19.1.7-1-any.pkg.tar.zst";
sha256 = "1688sknvlk8qy3zxh717pzdy882l5cmpbhyq8bg950hzvf1lpg79";
name = "mingw-w64-clang-x86_64-llvm-libs-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-llvm-libs-20.1.0-1-any.pkg.tar.zst";
sha256 = "1amply0fpympi028jdblzfp2cv87l569gi0d2gwhbdd5yq8ga8rp";
name = "mingw-w64-clang-x86_64-llvm-libs-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-llvm-19.1.7-1-any.pkg.tar.zst";
sha256 = "0c02mphj003s6k92nxkcvih3m7lj16wi0hwf17qr6m69b0dv691p";
name = "mingw-w64-clang-x86_64-llvm-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-llvm-20.1.0-1-any.pkg.tar.zst";
sha256 = "0p53l7jawgflpfrqdhgc8q9frzrm8liyyxbkxzzs5h79b835yvxp";
name = "mingw-w64-clang-x86_64-llvm-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-clang-libs-19.1.7-1-any.pkg.tar.zst";
sha256 = "08ksr9jvbqb3shrixgjazrq0v3ag3g9ysqc93miwj57z7g75z8j4";
name = "mingw-w64-clang-x86_64-clang-libs-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-clang-libs-20.1.0-1-any.pkg.tar.zst";
sha256 = "16c1cn7blfig75k8fd57ssrbnrl2ww20sb42n1c6sfxd1bivmz7b";
name = "mingw-w64-clang-x86_64-clang-libs-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-compiler-rt-19.1.7-1-any.pkg.tar.zst";
sha256 = "04icdns7wydlagc2h9m587859x0pad62gkqg12vcc2nwgl485lz0";
name = "mingw-w64-clang-x86_64-compiler-rt-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-compiler-rt-20.1.0-1-any.pkg.tar.zst";
sha256 = "1lg836llv1qlaiqsw0c5amf399qfqaqxm1bgjk4ac02a397dm7k0";
name = "mingw-w64-clang-x86_64-compiler-rt-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-headers-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
sha256 = "0zmwqbmdhgkr8qpyxad64ks9p8lxw9mkr2hj7v5fnqcnsswlj8c6";
name = "mingw-w64-clang-x86_64-headers-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-headers-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
sha256 = "00j7bbj7w9irri90bsxdk5v15kpjk3af3w2xa9i83rrp9ipgclm9";
name = "mingw-w64-clang-x86_64-headers-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-crt-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
sha256 = "14nmaw2rjs1818b8gi0n227ifcwi9s4sg9d6kv5yivpvn6pxyrvl";
name = "mingw-w64-clang-x86_64-crt-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-crt-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
sha256 = "0yrr4yabjkd9nkg78xcmav5gq0xjs8hrwxm22481lj5cvy1r7j70";
name = "mingw-w64-clang-x86_64-crt-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-lld-19.1.7-1-any.pkg.tar.zst";
sha256 = "1z1h40yfllns0n679j9s98r0hvg7i67kmhhf7iw97kz66jc1dkfy";
name = "mingw-w64-clang-x86_64-lld-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-lld-20.1.0-1-any.pkg.tar.zst";
sha256 = "1wbj7m3310y2vja4yxac8akhh60csa5vdwj7dgvzsf511sr05kiz";
name = "mingw-w64-clang-x86_64-lld-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libwinpthread-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
sha256 = "0bk73xy9hgffc2pvainwvnprcxngx8y7af8w72i279cdd5f9xx1f";
name = "mingw-w64-clang-x86_64-libwinpthread-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libwinpthread-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
sha256 = "1kgchzv0vihwahrq6jgs1bg14wx0shqp15wrkn45m124m26kb4kd";
name = "mingw-w64-clang-x86_64-libwinpthread-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-winpthreads-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
sha256 = "18y196l9dhqdqmjvs7g2jzdm8rrbrr5rqff7l30a9hpgwmra2xgv";
name = "mingw-w64-clang-x86_64-winpthreads-git-12.0.0.r509.g079e6092b-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-winpthreads-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
sha256 = "13kj1sd5i4qdqqfqxlj06q52rj6lwg18yi6y7xa0a2yng4i50qrq";
name = "mingw-w64-clang-x86_64-winpthreads-git-12.0.0.r576.g49111ba98-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-clang-19.1.7-1-any.pkg.tar.zst";
sha256 = "1cgm8mdlfi18494zqz88gkgxagqhb82ls5hlgn07r3xldcwz4dma";
name = "mingw-w64-clang-x86_64-clang-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-clang-20.1.0-1-any.pkg.tar.zst";
sha256 = "16bwq1bmk7q4dwwdhcv82y7c23xwgphlzq77siyax4rkp63dk7cd";
name = "mingw-w64-clang-x86_64-clang-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-rust-1.84.1-1-any.pkg.tar.zst";
sha256 = "064l3kxrmx2fj19ljq0xv3cpb24spg2a33lk13z90fzymivwxsab";
name = "mingw-w64-clang-x86_64-rust-1.84.1-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-rust-1.85.0-1-any.pkg.tar.zst";
sha256 = "0wwpmyc0sj3qzafg4c68nx23lw7y80g6awz3sj24zf5cjmwrrv53";
name = "mingw-w64-clang-x86_64-rust-1.85.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
@ -187,15 +187,15 @@
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-nghttp2-1.64.0-1-any.pkg.tar.zst";
sha256 = "1hv8fp496l018s5dx5v8nvxc0a6rswskwk1jsrfd94rh3kbq2ilc";
name = "mingw-w64-clang-x86_64-nghttp2-1.64.0-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-nghttp2-1.65.0-1-any.pkg.tar.zst";
sha256 = "14l9l6x5wijyz5r06n2almkk0pq413909in40pdbmnwy2cnd531h";
name = "mingw-w64-clang-x86_64-nghttp2-1.65.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-nghttp3-1.7.0-1-any.pkg.tar.zst";
sha256 = "0kd2f7yh90815kyldxvdy8c6jyxyw0wv4f7k3shwp98w874m0mxd";
name = "mingw-w64-clang-x86_64-nghttp3-1.7.0-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-nghttp3-1.8.0-1-any.pkg.tar.zst";
sha256 = "0xwhnfhhh7xyf2zhpxzi441b1c6vil321r0rsxyr8bqyq4l0marz";
name = "mingw-w64-clang-x86_64-nghttp3-1.8.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
@ -253,9 +253,9 @@
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libuv-1.50.0-1-any.pkg.tar.zst";
sha256 = "1qwds9kl6x1afqwpqkha1my7xzwh39q5v0rrkj997i2wa1xgpr5c";
name = "mingw-w64-clang-x86_64-libuv-1.50.0-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-libuv-1.50.0-2-any.pkg.tar.zst";
sha256 = "0jwwm5hbcq7652fr0187jrl2iwiakjchzzxxzdgpm33an5dinsd0";
name = "mingw-w64-clang-x86_64-libuv-1.50.0-2-any.pkg.tar.zst";
})
(pkgs.fetchurl {
@ -277,9 +277,9 @@
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-cmake-3.31.5-1-any.pkg.tar.zst";
sha256 = "04zyhhi3a58y5fy8l9nnsmn1qh5h1n02czh9d81f4fcnjs9fs4rj";
name = "mingw-w64-clang-x86_64-cmake-3.31.5-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-cmake-3.31.6-1-any.pkg.tar.zst";
sha256 = "111fs7i69f6xwjnsl4v3ca38wig2047ri8j0s8mmsc50dgzcdcc2";
name = "mingw-w64-clang-x86_64-cmake-3.31.6-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {
@ -337,9 +337,9 @@
})
(pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-llvm-openmp-19.1.7-1-any.pkg.tar.zst";
sha256 = "05qz2niykj5azx3n3wr2h48152ahcfcj9xsdpdqqvada1hh4c6cx";
name = "mingw-w64-clang-x86_64-llvm-openmp-19.1.7-1-any.pkg.tar.zst";
url = "https://mirror.msys2.org/mingw/clang64/mingw-w64-clang-x86_64-llvm-openmp-20.1.0-1-any.pkg.tar.zst";
sha256 = "1bhz2hpyzklf7pfdcbmmqgqglm912w444ic2x7nvg862b8rxax8z";
name = "mingw-w64-clang-x86_64-llvm-openmp-20.1.0-1-any.pkg.tar.zst";
})
(pkgs.fetchurl {