@@ -956,14 +956,16 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
956956 }
957957
958958 var format = _configuration.genSnapshotFormat! ;
959- var basename = (format == GenSnapshotFormat .assembly) ? 'out.S' : 'out.aotsnapshot' ;
959+ var output = (format == GenSnapshotFormat .assembly)
960+ ? tempAssemblyFile (tempDir)
961+ : tempAOTFile (tempDir);
960962 // Whether or not loading units are used. Mach-O doesn't currently support
961963 // this, and this isn't done for assembly output to avoid having to handle
962964 // the assembly of multiple assembly output files.
963965 var split = format == GenSnapshotFormat .elf;
964966 var args = [
965967 "--snapshot-kind=${format .snapshotType }" ,
966- "--${format .fileOption }=$tempDir /$ basename " ,
968+ "--${format .fileOption }=$output " ,
967969 if (split) "--loading-unit-manifest=$tempDir /ignored.json" ,
968970 if (_isAndroid && (_isArm || _isArmX64)) ...[
969971 '--no-sim-use-hardfp' ,
@@ -1074,6 +1076,8 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
10741076 case Architecture .arm_x64:
10751077 target = ['-arch' , 'armv7' ];
10761078 break ;
1079+ case Architecture .arm64:
1080+ case Architecture .arm64c:
10771081 case Architecture .simarm64:
10781082 case Architecture .simarm64c:
10791083 target = ['-arch' , 'arm64' ];
@@ -1087,6 +1091,25 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
10871091 target = ['-arch' , 'riscv64' ];
10881092 break ;
10891093 }
1094+ } else if (Platform .isWindows) {
1095+ cc = 'buildtools\\ win-x64\\ clang\\ bin\\ clang.exe' ;
1096+ shared = '-shared' ;
1097+ switch (_configuration.architecture) {
1098+ case Architecture .x64:
1099+ case Architecture .x64c:
1100+ case Architecture .simx64:
1101+ case Architecture .simx64c:
1102+ target = ['--target=x86_64-windows' ];
1103+ break ;
1104+ case Architecture .arm64:
1105+ case Architecture .arm64c:
1106+ case Architecture .simarm64:
1107+ case Architecture .simarm64c:
1108+ target = ['--target=arm64-windows' ];
1109+ break ;
1110+ }
1111+ ldFlags.add ('-nostdlib' );
1112+ ldFlags.add ('-Wl,/NOENTRY' );
10901113 } else {
10911114 throw "Platform not supported: ${Platform .operatingSystem }" ;
10921115 }
@@ -1096,8 +1119,8 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
10961119 ...ldFlags,
10971120 shared,
10981121 '-o' ,
1099- '$ tempDir /out.aotsnapshot' ,
1100- '$ tempDir /out.S'
1122+ tempAOTFile ( tempDir) ,
1123+ tempAssemblyFile ( tempDir),
11011124 ];
11021125
11031126 return CompilationCommand ('assemble' , tempDir, bootstrapDependencies (), cc,
@@ -1109,7 +1132,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
11091132 String tempDir, Map <String , String > environmentOverrides) {
11101133 var stripTool = "$ndkPath /toolchains/llvm/prebuilt/"
11111134 "$host -x86_64/bin/llvm-strip" ;
1112- var args = ['--strip-unneeded' , "$ tempDir /out.aotsnapshot" ];
1135+ var args = ['--strip-unneeded' , tempAOTFile ( tempDir) ];
11131136 return CompilationCommand ('strip' , tempDir, bootstrapDependencies (),
11141137 stripTool, args, environmentOverrides,
11151138 alwaysCompile: ! _useSdk);
@@ -1124,8 +1147,19 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
11241147 /// almost identical configurations are tested simultaneously.
11251148 Command computeRemoveAssemblyCommand (String tempDir, List arguments,
11261149 Map <String , String > environmentOverrides) {
1127- return CompilationCommand ('remove_assembly' , tempDir,
1128- bootstrapDependencies (), 'rm' , ['$tempDir /out.S' ], environmentOverrides,
1150+ String exec;
1151+ List <String > args;
1152+
1153+ if (Platform .isWindows) {
1154+ exec = "cmd.exe" ;
1155+ args = ["/c" , "del" , tempAssemblyFile (tempDir)];
1156+ } else {
1157+ exec = "rm" ;
1158+ args = [tempAssemblyFile (tempDir)];
1159+ }
1160+
1161+ return CompilationCommand ("remove_assembly" , tempDir,
1162+ bootstrapDependencies (), exec, args, environmentOverrides,
11291163 alwaysCompile: ! _useSdk);
11301164 }
11311165
@@ -1169,8 +1203,7 @@ class PrecompilerCompilerConfiguration extends CompilerConfiguration
11691203 // directory on the device, use that one instead.
11701204 dir = DartPrecompiledAdbRuntimeConfiguration .deviceTestDir;
11711205 }
1172- originalArguments =
1173- _replaceDartFiles (originalArguments, "$dir /out.aotsnapshot" );
1206+ originalArguments = _replaceDartFiles (originalArguments, tempAOTFile (dir));
11741207
11751208 return [
11761209 if (_enableAsserts) '--enable_asserts' ,
@@ -1373,6 +1406,21 @@ abstract mixin class VMKernelCompilerMixin {
13731406
13741407 String tempKernelFile (String tempDir) =>
13751408 Path ('$tempDir /out.dill' ).toNativePath ();
1409+ String tempAssemblyFile (String tempDir) =>
1410+ Path ('$tempDir /out.S' ).toNativePath ();
1411+ String tempAOTFile (String tempDir) {
1412+ switch (_configuration.system) {
1413+ case System .android:
1414+ case System .fuchsia:
1415+ case System .linux:
1416+ return Path ('$tempDir /libout.so' ).toNativePath ();
1417+ case System .mac:
1418+ return Path ('$tempDir /libout.dylib' ).toNativePath ();
1419+ case System .win:
1420+ return Path ('$tempDir /out.dll' ).toNativePath ();
1421+ }
1422+ return Path ('$tempDir /out.aotsnapshot' ).toNativePath ();
1423+ }
13761424
13771425 Command computeCompileToKernelCommand (String tempDir, List <String > arguments,
13781426 Map <String , String > environmentOverrides) {
0 commit comments