mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-15 06:01:14 +00:00
Fix llvm target vendor-sys-abi not correctly set issue on windows platform (#606)
This commit is contained in:
parent
09eb858a02
commit
ee97618bdb
|
@ -1107,7 +1107,8 @@ static ArchItem valid_archs[] = {
|
||||||
static const char *valid_abis[] = {
|
static const char *valid_abis[] = {
|
||||||
"gnu",
|
"gnu",
|
||||||
"eabi",
|
"eabi",
|
||||||
"gnueabihf"
|
"gnueabihf",
|
||||||
|
"msvc"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1335,9 +1336,32 @@ aot_create_comp_context(AOTCompData *comp_data,
|
||||||
|
|
||||||
if (arch) {
|
if (arch) {
|
||||||
/* Construct target triple: <arch>-<vendor>-<sys>-<abi> */
|
/* Construct target triple: <arch>-<vendor>-<sys>-<abi> */
|
||||||
const char *vendor_sys = "-pc-linux-";
|
const char *vendor_sys;
|
||||||
|
char *default_triple = LLVMGetDefaultTargetTriple();
|
||||||
|
|
||||||
|
if (!default_triple) {
|
||||||
|
aot_set_last_error("llvm get default target triple failed.");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strstr(default_triple, "windows")) {
|
||||||
|
vendor_sys = "-pc-windows-";
|
||||||
|
if (!abi)
|
||||||
|
abi = "msvc";
|
||||||
|
}
|
||||||
|
else if (strstr(default_triple, "win32")) {
|
||||||
|
vendor_sys = "-pc-win32-";
|
||||||
|
if (!abi)
|
||||||
|
abi = "msvc";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vendor_sys = "-pc-linux-";
|
||||||
if (!abi)
|
if (!abi)
|
||||||
abi = "gnu";
|
abi = "gnu";
|
||||||
|
}
|
||||||
|
|
||||||
|
LLVMDisposeMessage(default_triple);
|
||||||
|
|
||||||
bh_assert(strlen(arch) + strlen(vendor_sys) + strlen(abi) < sizeof(triple_buf));
|
bh_assert(strlen(arch) + strlen(vendor_sys) + strlen(abi) < sizeof(triple_buf));
|
||||||
memcpy(triple_buf, arch, strlen(arch));
|
memcpy(triple_buf, arch, strlen(arch));
|
||||||
memcpy(triple_buf + strlen(arch), vendor_sys, strlen(vendor_sys));
|
memcpy(triple_buf + strlen(arch), vendor_sys, strlen(vendor_sys));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user