File tree Expand file tree Collapse file tree 1 file changed +28
-4
lines changed
Expand file tree Collapse file tree 1 file changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -1107,7 +1107,8 @@ static ArchItem valid_archs[] = {
11071107static const char * valid_abis [] = {
11081108 "gnu" ,
11091109 "eabi" ,
1110- "gnueabihf"
1110+ "gnueabihf" ,
1111+ "msvc"
11111112};
11121113
11131114static void
@@ -1335,9 +1336,32 @@ aot_create_comp_context(AOTCompData *comp_data,
13351336
13361337 if (arch ) {
13371338 /* Construct target triple: <arch>-<vendor>-<sys>-<abi> */
1338- const char * vendor_sys = "-pc-linux-" ;
1339- if (!abi )
1340- abi = "gnu" ;
1339+ const char * vendor_sys ;
1340+ char * default_triple = LLVMGetDefaultTargetTriple ();
1341+
1342+ if (!default_triple ) {
1343+ aot_set_last_error ("llvm get default target triple failed." );
1344+ goto fail ;
1345+ }
1346+
1347+ if (strstr (default_triple , "windows" )) {
1348+ vendor_sys = "-pc-windows-" ;
1349+ if (!abi )
1350+ abi = "msvc" ;
1351+ }
1352+ else if (strstr (default_triple , "win32" )) {
1353+ vendor_sys = "-pc-win32-" ;
1354+ if (!abi )
1355+ abi = "msvc" ;
1356+ }
1357+ else {
1358+ vendor_sys = "-pc-linux-" ;
1359+ if (!abi )
1360+ abi = "gnu" ;
1361+ }
1362+
1363+ LLVMDisposeMessage (default_triple );
1364+
13411365 bh_assert (strlen (arch ) + strlen (vendor_sys ) + strlen (abi ) < sizeof (triple_buf ));
13421366 memcpy (triple_buf , arch , strlen (arch ));
13431367 memcpy (triple_buf + strlen (arch ), vendor_sys , strlen (vendor_sys ));
You can’t perform that action at this time.
0 commit comments