From 2de980c6055e4a74603cd6d29546f587a31c905a Mon Sep 17 00:00:00 2001 From: ntjohnson1 <24689722+ntjohnson1@users.noreply.github.com> Date: Wed, 6 Aug 2025 18:28:42 -0400 Subject: [PATCH 1/9] Add bytes to be divisible by 8, add mac test support --- .cargo/config.toml | 2 ++ psm/.cargo/config.toml | 2 ++ psm/Cargo.toml | 3 +++ psm/src/arch/wasm32.o | Bin 389 -> 488 bytes psm/src/arch/wasm32.s | 7 +++++++ 5 files changed, 14 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 psm/.cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..fbd86dc --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.wasm32-unknown-unknown] +runner = "wasmtime" diff --git a/psm/.cargo/config.toml b/psm/.cargo/config.toml new file mode 100644 index 0000000..fbd86dc --- /dev/null +++ b/psm/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.wasm32-unknown-unknown] +runner = "wasmtime" diff --git a/psm/Cargo.toml b/psm/Cargo.toml index af561b3..98b817b 100644 --- a/psm/Cargo.toml +++ b/psm/Cargo.toml @@ -15,3 +15,6 @@ readme = "README.mkd" [build-dependencies] cc = "1.1.22" + +[target.'cfg(osx)'.dev-dependencies] +wasmtime-cli = "35.0.0" \ No newline at end of file diff --git a/psm/src/arch/wasm32.o b/psm/src/arch/wasm32.o index 298cdaa862364c5ff055f57e56a739d2da0d41d3..2a7ab5bc19651e78a497a375c4632d7ddd24a53e 100644 GIT binary patch delta 254 zcmZo=e!)D!O@fg*HLr|6KEAjlF*!TFAU`v&B(;dSo^hhPvO;S^LjwZ~0|O&7Pa}xQ z$aM)U!olDOq#GC}PV-FS?gh&*I5KdvGeE&kplSy8oXouJ%)E3aj+tOCP)?$#w74X` zpg0$5TS{h8YH~?tejcNMRB(u+vv<6UXOOFNh^N0_yo+nFv#Xzrr=R;|K}MedMkd~Z z#FP}EdGSe=C8@;>4D77kV4K+RF9Qj16{Y6nC+j);ySTD&u&^*Pu=6sr WOE9x5Fth0}v70ipJ210(u>b(@I7D>- delta 155 zcmaFC+{!$`jgetuoU%@8UKxLUd~r!)a&~+{er8@tY7uiiBXes*LjwZ~0|O&7*Eukg zg~5?&;zCa&h94j-eey} s9}R{@Aaz_tsX6({dd~hXuFUN0oJ{N@OzbjDY#L1LhD_`>Ol)o}0NYk9KmY&$ diff --git a/psm/src/arch/wasm32.s b/psm/src/arch/wasm32.s index e3364e7..fbd3f27 100644 --- a/psm/src/arch/wasm32.s +++ b/psm/src/arch/wasm32.s @@ -58,3 +58,10 @@ rust_psm_replace_stack: call_indirect (i32) -> () unreachable end_function + +# Add 7 bytes of padding to make total size divisible by 8 (prevents ar padding) +.section .rodata,"",@ +.p2align 0 +padding_bytes: + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +.size padding_bytes, 7 From 8340269754432771c9b4a532a3c3550191b94434 Mon Sep 17 00:00:00 2001 From: ntjohnson1 <24689722+ntjohnson1@users.noreply.github.com> Date: Thu, 7 Aug 2025 08:06:57 -0400 Subject: [PATCH 2/9] Revert changes to base object file and make pad dependent on ar --- psm/build.rs | 18 ++++++++++++++++-- psm/src/arch/wasm32.o | Bin 488 -> 389 bytes psm/src/arch/wasm32.s | 7 ------- psm/src/arch/wasm32_pad.o | Bin 0 -> 408 bytes 4 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 psm/src/arch/wasm32_pad.o diff --git a/psm/build.rs b/psm/build.rs index 1747466..053bb23 100644 --- a/psm/build.rs +++ b/psm/build.rs @@ -4,6 +4,7 @@ fn find_assembly( os: &str, env: &str, masm: bool, + llvm_ar: bool, ) -> Option<(&'static str, bool)> { match (arch, endian, os, env) { // The implementations for stack switching exist, but, officially, doing so without Fibers @@ -51,7 +52,14 @@ fn find_assembly( ("sparc", _, _, _) => Some(("src/arch/sparc_sysv.s", true)), ("riscv32", _, _, _) => Some(("src/arch/riscv.s", true)), ("riscv64", _, _, _) => Some(("src/arch/riscv64.s", true)), - ("wasm32", _, _, _) => Some(("src/arch/wasm32.o", true)), + ("wasm32", _, _, _) => { + if llvm_ar { + // For wasm32 we ship a precompiled object file. + return Some(("src/arch/wasm32.o", true)); + } else { + return Some(("src/arch/wasm32_pad.o", true)); + } + }, ("loongarch64", _, _, _) => Some(("src/arch/loongarch64.s", true)), _ => None, } @@ -59,6 +67,7 @@ fn find_assembly( fn main() { use std::env::var; + use std::process::Command; println!("cargo:rustc-check-cfg=cfg(switchable_stack,asm,link_asm)"); @@ -84,7 +93,12 @@ fn main() { // supports compiling MASM, but that is not stable yet let masm = msvc && var("HOST").expect("HOST env not set").contains("windows"); - let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm) { + let llvm_ar = Command::new("llvm-ar") + .arg("--version") + .output() + .is_ok(); + + let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm, llvm_ar) { println!("cargo:rustc-cfg=asm"); println!("cargo:rustc-cfg=link_asm"); if canswitch { diff --git a/psm/src/arch/wasm32.o b/psm/src/arch/wasm32.o index 2a7ab5bc19651e78a497a375c4632d7ddd24a53e..298cdaa862364c5ff055f57e56a739d2da0d41d3 100644 GIT binary patch delta 155 zcmaFC+{!$`jgetuoU%@8UKxLUd~r!)a&~+{er8@tY7uiiBXes*LjwZ~0|O&7*Eukg zg~5?&;zCa&h94j-eey} s9}R{@Aaz_tsX6({dd~hXuFUN0oJ{N@OzbjDY#L1LhD_`>Ol)o}0NYk9KmY&$ delta 254 zcmZo=e!)D!O@fg*HLr|6KEAjlF*!TFAU`v&B(;dSo^hhPvO;S^LjwZ~0|O&7Pa}xQ z$aM)U!olDOq#GC}PV-FS?gh&*I5KdvGeE&kplSy8oXouJ%)E3aj+tOCP)?$#w74X` zpg0$5TS{h8YH~?tejcNMRB(u+vv<6UXOOFNh^N0_yo+nFv#Xzrr=R;|K}MedMkd~Z z#FP}EdGSe=C8@;>4D77kV4K+RF9Qj16{Y6nC+j);ySTD&u&^*Pu=6sr WOE9x5Fth0}v70ipJ210(u>b(@I7D>- diff --git a/psm/src/arch/wasm32.s b/psm/src/arch/wasm32.s index fbd3f27..e3364e7 100644 --- a/psm/src/arch/wasm32.s +++ b/psm/src/arch/wasm32.s @@ -58,10 +58,3 @@ rust_psm_replace_stack: call_indirect (i32) -> () unreachable end_function - -# Add 7 bytes of padding to make total size divisible by 8 (prevents ar padding) -.section .rodata,"",@ -.p2align 0 -padding_bytes: - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.size padding_bytes, 7 diff --git a/psm/src/arch/wasm32_pad.o b/psm/src/arch/wasm32_pad.o new file mode 100644 index 0000000000000000000000000000000000000000..d6980849a60545d162249d281221c21f5dd47e1e GIT binary patch literal 408 zcmZ8cO-sZu5S>iAn{|88f-DLiDhhg9@a{$YxcU>au^T09o0c>ycxn;-72fH}mFA-UC$^3;@_i+qN)T0BaUeLj?;A5APsr0KdZm=h{B+N|_t0m6L@o zO80^QVSFg1u}kB0=H=tsX5N%mdi9WNR`nYsti8%svMP=B+VO_*_i#2M1AO|`!3eG} zp1=t;EyQP#@*W=Z({7YP%2G^T15IQx%C=QFUF9m%1M?Zan>wAB+5Gzc=9UYwgJK`W X5suGMT%fqb@m&N-G_TZ>&Tr}u Date: Thu, 7 Aug 2025 09:07:46 -0400 Subject: [PATCH 3/9] Minor cleanup and make padding selection narrower --- psm/build.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/psm/build.rs b/psm/build.rs index 053bb23..6a3b2e9 100644 --- a/psm/build.rs +++ b/psm/build.rs @@ -4,7 +4,7 @@ fn find_assembly( os: &str, env: &str, masm: bool, - llvm_ar: bool, + pad_wasm: bool, ) -> Option<(&'static str, bool)> { match (arch, endian, os, env) { // The implementations for stack switching exist, but, officially, doing so without Fibers @@ -53,11 +53,12 @@ fn find_assembly( ("riscv32", _, _, _) => Some(("src/arch/riscv.s", true)), ("riscv64", _, _, _) => Some(("src/arch/riscv64.s", true)), ("wasm32", _, _, _) => { - if llvm_ar { + if pad_wasm { // For wasm32 we ship a precompiled object file. - return Some(("src/arch/wasm32.o", true)); + // Under some conditions we pad the byte count to be divisible by 8 + Some(("src/arch/wasm32_pad.o", true)) } else { - return Some(("src/arch/wasm32_pad.o", true)); + Some(("src/arch/wasm32.o", true)) } }, ("loongarch64", _, _, _) => Some(("src/arch/loongarch64.s", true)), @@ -93,12 +94,9 @@ fn main() { // supports compiling MASM, but that is not stable yet let masm = msvc && var("HOST").expect("HOST env not set").contains("windows"); - let llvm_ar = Command::new("llvm-ar") - .arg("--version") - .output() - .is_ok(); + let pad_wasm = Command::new("clang").arg("--version").output().is_ok() && Command::new("llvm-ar").arg("--version").output().is_err(); - let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm, llvm_ar) { + let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm, pad_wasm) { println!("cargo:rustc-cfg=asm"); println!("cargo:rustc-cfg=link_asm"); if canswitch { From 8a68c7eb7e777e1c584a69a15bfce15adbeedd61 Mon Sep 17 00:00:00 2001 From: ntjohnson1 <24689722+ntjohnson1@users.noreply.github.com> Date: Thu, 7 Aug 2025 09:20:46 -0400 Subject: [PATCH 4/9] Try one more time with wasmtime 34 before removing and just adding macos wasmtime ci test to match ubuntu --- psm/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psm/Cargo.toml b/psm/Cargo.toml index 98b817b..eb2a11b 100644 --- a/psm/Cargo.toml +++ b/psm/Cargo.toml @@ -17,4 +17,4 @@ readme = "README.mkd" cc = "1.1.22" [target.'cfg(osx)'.dev-dependencies] -wasmtime-cli = "35.0.0" \ No newline at end of file +wasmtime-cli = "34.0.0" \ No newline at end of file From 8d026cc44d500f087c887c8e557e748f551a87c3 Mon Sep 17 00:00:00 2001 From: ntjohnson1 <24689722+ntjohnson1@users.noreply.github.com> Date: Thu, 7 Aug 2025 09:32:29 -0400 Subject: [PATCH 5/9] Prune wasmtime dep because CI unhappy --- .cargo/config.toml | 2 -- psm/.cargo/config.toml | 2 -- psm/Cargo.toml | 3 --- 3 files changed, 7 deletions(-) delete mode 100644 .cargo/config.toml delete mode 100644 psm/.cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index fbd86dc..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.wasm32-unknown-unknown] -runner = "wasmtime" diff --git a/psm/.cargo/config.toml b/psm/.cargo/config.toml deleted file mode 100644 index fbd86dc..0000000 --- a/psm/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[target.wasm32-unknown-unknown] -runner = "wasmtime" diff --git a/psm/Cargo.toml b/psm/Cargo.toml index eb2a11b..af561b3 100644 --- a/psm/Cargo.toml +++ b/psm/Cargo.toml @@ -15,6 +15,3 @@ readme = "README.mkd" [build-dependencies] cc = "1.1.22" - -[target.'cfg(osx)'.dev-dependencies] -wasmtime-cli = "34.0.0" \ No newline at end of file From bf3561f892204547ada025211061ff5980bd92a7 Mon Sep 17 00:00:00 2001 From: ntjohnson1 <24689722+ntjohnson1@users.noreply.github.com> Date: Sun, 10 Aug 2025 07:28:14 -0400 Subject: [PATCH 6/9] Revert build changes --- psm/build.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/psm/build.rs b/psm/build.rs index 6a3b2e9..1747466 100644 --- a/psm/build.rs +++ b/psm/build.rs @@ -4,7 +4,6 @@ fn find_assembly( os: &str, env: &str, masm: bool, - pad_wasm: bool, ) -> Option<(&'static str, bool)> { match (arch, endian, os, env) { // The implementations for stack switching exist, but, officially, doing so without Fibers @@ -52,15 +51,7 @@ fn find_assembly( ("sparc", _, _, _) => Some(("src/arch/sparc_sysv.s", true)), ("riscv32", _, _, _) => Some(("src/arch/riscv.s", true)), ("riscv64", _, _, _) => Some(("src/arch/riscv64.s", true)), - ("wasm32", _, _, _) => { - if pad_wasm { - // For wasm32 we ship a precompiled object file. - // Under some conditions we pad the byte count to be divisible by 8 - Some(("src/arch/wasm32_pad.o", true)) - } else { - Some(("src/arch/wasm32.o", true)) - } - }, + ("wasm32", _, _, _) => Some(("src/arch/wasm32.o", true)), ("loongarch64", _, _, _) => Some(("src/arch/loongarch64.s", true)), _ => None, } @@ -68,7 +59,6 @@ fn find_assembly( fn main() { use std::env::var; - use std::process::Command; println!("cargo:rustc-check-cfg=cfg(switchable_stack,asm,link_asm)"); @@ -94,9 +84,7 @@ fn main() { // supports compiling MASM, but that is not stable yet let masm = msvc && var("HOST").expect("HOST env not set").contains("windows"); - let pad_wasm = Command::new("clang").arg("--version").output().is_ok() && Command::new("llvm-ar").arg("--version").output().is_err(); - - let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm, pad_wasm) { + let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm) { println!("cargo:rustc-cfg=asm"); println!("cargo:rustc-cfg=link_asm"); if canswitch { From 72063f2afb96ea5f8f60d3091e09fbb979ab39c4 Mon Sep 17 00:00:00 2001 From: ntjohnson1 <24689722+ntjohnson1@users.noreply.github.com> Date: Sun, 10 Aug 2025 07:30:27 -0400 Subject: [PATCH 7/9] Just update assembly and use single padded object --- psm/src/arch/wasm32.o | Bin 389 -> 392 bytes psm/src/arch/wasm32.s | 3 +++ psm/src/arch/wasm32_pad.o | Bin 408 -> 0 bytes 3 files changed, 3 insertions(+) delete mode 100644 psm/src/arch/wasm32_pad.o diff --git a/psm/src/arch/wasm32.o b/psm/src/arch/wasm32.o index 298cdaa862364c5ff055f57e56a739d2da0d41d3..d76158f9928dc2fead58ce8ac0d96ac44a9a39dc 100644 GIT binary patch delta 75 zcmZo=?qHtaEzBPuUtE%yoE=|~pP5&ZTEtw>IMH31r?sJ>fq{jAfsvW(;>2ESDMe6ki{ diff --git a/psm/src/arch/wasm32.s b/psm/src/arch/wasm32.s index e3364e7..44ed163 100644 --- a/psm/src/arch/wasm32.s +++ b/psm/src/arch/wasm32.s @@ -58,3 +58,6 @@ rust_psm_replace_stack: call_indirect (i32) -> () unreachable end_function + +# Fill bytes to align to 8 byte boundary +.fill 3, 1, 0 diff --git a/psm/src/arch/wasm32_pad.o b/psm/src/arch/wasm32_pad.o deleted file mode 100644 index d6980849a60545d162249d281221c21f5dd47e1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 408 zcmZ8cO-sZu5S>iAn{|88f-DLiDhhg9@a{$YxcU>au^T09o0c>ycxn;-72fH}mFA-UC$^3;@_i+qN)T0BaUeLj?;A5APsr0KdZm=h{B+N|_t0m6L@o zO80^QVSFg1u}kB0=H=tsX5N%mdi9WNR`nYsti8%svMP=B+VO_*_i#2M1AO|`!3eG} zp1=t;EyQP#@*W=Z({7YP%2G^T15IQx%C=QFUF9m%1M?Zan>wAB+5Gzc=9UYwgJK`W X5suGMT%fqb@m&N-G_TZ>&Tr}u Date: Tue, 12 Aug 2025 08:53:01 -0400 Subject: [PATCH 8/9] Try using rust archiver tool for better portability --- psm/Cargo.toml | 1 + psm/build.rs | 38 +++++++++++++++++++++++++++++++++++--- psm/src/arch/wasm32.o | Bin 392 -> 389 bytes psm/src/arch/wasm32.s | 3 --- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/psm/Cargo.toml b/psm/Cargo.toml index af561b3..4e7a396 100644 --- a/psm/Cargo.toml +++ b/psm/Cargo.toml @@ -15,3 +15,4 @@ readme = "README.mkd" [build-dependencies] cc = "1.1.22" +ar_archive_writer = "0.4.2" diff --git a/psm/build.rs b/psm/build.rs index 1747466..65785c8 100644 --- a/psm/build.rs +++ b/psm/build.rs @@ -110,10 +110,42 @@ fn main() { // directly to `ar` to assemble an archive. Otherwise we're actually // compiling the source assembly file. if asm.ends_with(".o") { - cfg.object(asm); + use ar_archive_writer::{write_archive_to_stream, NewArchiveMember, ArchiveKind, DEFAULT_OBJECT_READER}; + use std::fs::read; + use std::path::PathBuf; + use std::io::Cursor; + + let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR environment variable not set"); + let output_path = PathBuf::from(&out_dir).join("libpsm_s.a"); + + let object_data = read(asm).expect("Failed to read object file"); + + let filename = asm.rsplit('/').next().unwrap_or(asm); + let member = NewArchiveMember::new( + object_data, + &DEFAULT_OBJECT_READER, + filename.to_string(), + ); + + let mut output_bytes = Cursor::new(Vec::new()); + write_archive_to_stream( + &mut output_bytes, + &[member], + // Unfortunately, getDefaultKind() is not available in ar_archive_writer 0.4.2 + // however looking at the llvm-ar source it looks like for wasm32-any-any + // it falls through to Gnu https://llvm.org/doxygen/Object_2Archive_8cpp_source.html + ArchiveKind::Gnu, + false, + false, + ).expect("Failed to write archive"); + + std::fs::write(&output_path, output_bytes.into_inner()).expect("Failed to write archive file"); + + println!("cargo:rustc-link-search=native={}", out_dir); + println!("cargo:rustc-link-lib=static=psm_s"); } else { cfg.file(asm); + cfg.compile("libpsm_s.a"); } - cfg.compile("libpsm_s.a"); -} +} \ No newline at end of file diff --git a/psm/src/arch/wasm32.o b/psm/src/arch/wasm32.o index d76158f9928dc2fead58ce8ac0d96ac44a9a39dc..298cdaa862364c5ff055f57e56a739d2da0d41d3 100644 GIT binary patch delta 75 zcmeBRZe^a}JuyjMIW@10KR&*=Br!QVz92s{uOzjIxt@`^wV|PbfrWvAk(uk<#9nK0 bF$M)D6`)uHg93vBqhJe&#lXNl@zF8>e6ki{ delta 75 zcmZo=?qHtaEzBPuUtE%yoE=|~pP5&ZTEtw>IMH31r?sJ>fq{jAfsvW(;>2ESDM () unreachable end_function - -# Fill bytes to align to 8 byte boundary -.fill 3, 1, 0 From fc990744ebbf4872401fbafcc3f37bc99a41712a Mon Sep 17 00:00:00 2001 From: ntjohnson1 <24689722+ntjohnson1@users.noreply.github.com> Date: Tue, 12 Aug 2025 09:21:01 -0400 Subject: [PATCH 9/9] Downgrade ar_archiver to meet rust 1.63 requirements --- psm/Cargo.toml | 2 +- psm/build.rs | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/psm/Cargo.toml b/psm/Cargo.toml index 4e7a396..30dc745 100644 --- a/psm/Cargo.toml +++ b/psm/Cargo.toml @@ -15,4 +15,4 @@ readme = "README.mkd" [build-dependencies] cc = "1.1.22" -ar_archive_writer = "0.4.2" +ar_archive_writer = "0.2.0" diff --git a/psm/build.rs b/psm/build.rs index 65785c8..1a5c7e7 100644 --- a/psm/build.rs +++ b/psm/build.rs @@ -110,8 +110,8 @@ fn main() { // directly to `ar` to assemble an archive. Otherwise we're actually // compiling the source assembly file. if asm.ends_with(".o") { - use ar_archive_writer::{write_archive_to_stream, NewArchiveMember, ArchiveKind, DEFAULT_OBJECT_READER}; - use std::fs::read; + use ar_archive_writer::{write_archive_to_stream, NewArchiveMember, ArchiveKind}; + use std::fs::{read, metadata}; use std::path::PathBuf; use std::io::Cursor; @@ -119,24 +119,43 @@ fn main() { let output_path = PathBuf::from(&out_dir).join("libpsm_s.a"); let object_data = read(asm).expect("Failed to read object file"); + let file_metadata = metadata(asm).expect("Failed to read file metadata"); + + // Extract file metadata + let mtime = file_metadata.modified().ok() + .and_then(|time| time.duration_since(std::time::UNIX_EPOCH).ok()) + .map(|duration| duration.as_secs()) + .unwrap_or(0); + + #[cfg(unix)] + let (uid, gid, perms) = { + use std::os::unix::fs::MetadataExt; + (file_metadata.uid(), file_metadata.gid(), file_metadata.mode()) + }; + + #[cfg(not(unix))] + let (uid, gid, perms) = (0, 0, 0o644); let filename = asm.rsplit('/').next().unwrap_or(asm); - let member = NewArchiveMember::new( - object_data, - &DEFAULT_OBJECT_READER, - filename.to_string(), - ); + let member = NewArchiveMember { + buf: Box::new(object_data), + get_symbols: |_data: &[u8], _callback: &mut dyn FnMut(&[u8]) -> Result<(), std::io::Error>| Ok(true), + member_name: filename.to_string(), + mtime, + uid, + gid, + perms, + }; let mut output_bytes = Cursor::new(Vec::new()); write_archive_to_stream( &mut output_bytes, &[member], - // Unfortunately, getDefaultKind() is not available in ar_archive_writer 0.4.2 + // Unfortunately, getDefaultKind() is not available in ar_archive_writer // however looking at the llvm-ar source it looks like for wasm32-any-any // it falls through to Gnu https://llvm.org/doxygen/Object_2Archive_8cpp_source.html ArchiveKind::Gnu, false, - false, ).expect("Failed to write archive"); std::fs::write(&output_path, output_bytes.into_inner()).expect("Failed to write archive file");