This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -314,6 +314,17 @@ than building it.
314
314
. entry ( * target)
315
315
. or_insert_with ( || Target :: from_triple ( & target. triple ) ) ;
316
316
317
+ // compiler-rt c fallbacks for wasm cannot be built with gcc
318
+ if ( target. triple == "wasm32-unknown-unknown" || target. triple == "wasm32v1-none" ) // bare metal targets without wasi sdk
319
+ && ( build. config . optimized_compiler_builtins ( * target)
320
+ || build. config . rust_std_features . contains ( "compiler-builtins-c" ) )
321
+ {
322
+ let is_gcc = is_gcc_compiler ( build. cc ( * target) , build) ;
323
+ if is_gcc {
324
+ panic ! ( "GCC does not support building c code for bare wasm" ) ;
325
+ }
326
+ }
327
+
317
328
if ( target. contains ( "-none-" ) || target. contains ( "nvptx" ) )
318
329
&& build. no_std ( * target) == Some ( false )
319
330
{
@@ -376,3 +387,8 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
376
387
cmd_finder. must_have ( s) ;
377
388
}
378
389
}
390
+
391
+ fn is_gcc_compiler ( path : PathBuf , build : & Build ) -> bool {
392
+ let cc_output = command ( & path) . arg ( "--version" ) . run_capture_stdout ( build) . stdout ( ) ;
393
+ cc_output. contains ( "GCC" )
394
+ }
You can’t perform that action at this time.
0 commit comments