@@ -4,7 +4,7 @@ fn find_assembly(
44 os : & str ,
55 env : & str ,
66 masm : bool ,
7- llvm_ar : bool ,
7+ pad_wasm : bool ,
88) -> Option < ( & ' static str , bool ) > {
99 match ( arch, endian, os, env) {
1010 // The implementations for stack switching exist, but, officially, doing so without Fibers
@@ -53,11 +53,12 @@ fn find_assembly(
5353 ( "riscv32" , _, _, _) => Some ( ( "src/arch/riscv.s" , true ) ) ,
5454 ( "riscv64" , _, _, _) => Some ( ( "src/arch/riscv64.s" , true ) ) ,
5555 ( "wasm32" , _, _, _) => {
56- if llvm_ar {
56+ if pad_wasm {
5757 // For wasm32 we ship a precompiled object file.
58- return Some ( ( "src/arch/wasm32.o" , true ) ) ;
58+ // Under some conditions we pad the byte count to be divisible by 8
59+ Some ( ( "src/arch/wasm32_pad.o" , true ) )
5960 } else {
60- return Some ( ( "src/arch/wasm32_pad .o" , true ) ) ;
61+ Some ( ( "src/arch/wasm32 .o" , true ) )
6162 }
6263 } ,
6364 ( "loongarch64" , _, _, _) => Some ( ( "src/arch/loongarch64.s" , true ) ) ,
@@ -93,12 +94,9 @@ fn main() {
9394 // supports compiling MASM, but that is not stable yet
9495 let masm = msvc && var ( "HOST" ) . expect ( "HOST env not set" ) . contains ( "windows" ) ;
9596
96- let llvm_ar = Command :: new ( "llvm-ar" )
97- . arg ( "--version" )
98- . output ( )
99- . is_ok ( ) ;
97+ let pad_wasm = Command :: new ( "clang" ) . arg ( "--version" ) . output ( ) . is_ok ( ) && Command :: new ( "llvm-ar" ) . arg ( "--version" ) . output ( ) . is_err ( ) ;
10098
101- let asm = if let Some ( ( asm, canswitch) ) = find_assembly ( & arch, & endian, & os, & env, masm, llvm_ar ) {
99+ let asm = if let Some ( ( asm, canswitch) ) = find_assembly ( & arch, & endian, & os, & env, masm, pad_wasm ) {
102100 println ! ( "cargo:rustc-cfg=asm" ) ;
103101 println ! ( "cargo:rustc-cfg=link_asm" ) ;
104102 if canswitch {
0 commit comments