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[] = {
1107
1107
static const char * valid_abis [] = {
1108
1108
"gnu" ,
1109
1109
"eabi" ,
1110
- "gnueabihf"
1110
+ "gnueabihf" ,
1111
+ "msvc"
1111
1112
};
1112
1113
1113
1114
static void
@@ -1335,9 +1336,32 @@ aot_create_comp_context(AOTCompData *comp_data,
1335
1336
1336
1337
if (arch ) {
1337
1338
/* 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
+
1341
1365
bh_assert (strlen (arch ) + strlen (vendor_sys ) + strlen (abi ) < sizeof (triple_buf ));
1342
1366
memcpy (triple_buf , arch , strlen (arch ));
1343
1367
memcpy (triple_buf + strlen (arch ), vendor_sys , strlen (vendor_sys ));
You can’t perform that action at this time.
0 commit comments