Skip to content

Commit 2332b7c

Browse files
committed
Enable passing a triple to wamrc
1 parent 751cdcf commit 2332b7c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

core/iwasm/compilation/aot_llvm.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,10 +2736,12 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
27362736
}
27372737
else {
27382738
/* Create LLVM target machine */
2739-
arch = option->target_arch;
2740-
abi = option->target_abi;
2741-
cpu = option->target_cpu;
2742-
features = option->cpu_features;
2739+
triple = !strstr(option->target_arch, "-") ? NULL : option->target_arch;
2740+
arch = strstr(option->target_arch, "-") ? NULL : option->target_arch;
2741+
abi = strstr(option->target_arch, "-") ? NULL : option->target_abi;
2742+
cpu = strstr(option->target_arch, "-") ? NULL : option->target_cpu;
2743+
features =
2744+
strstr(option->target_arch, "-") ? NULL : option->cpu_features;
27432745
opt_level = option->opt_level;
27442746
size_level = option->size_level;
27452747

@@ -2980,6 +2982,7 @@ aot_create_comp_context(const AOTCompData *comp_data, aot_comp_option_t option)
29802982
aot_set_last_error(buf);
29812983
goto fail;
29822984
}
2985+
LOG_VERBOSE("triple: %s => normailized: %s", triple, triple_norm);
29832986
if (!cpu)
29842987
cpu = "";
29852988
}

wamr-compiler/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ print_help()
116116
printf(" Default is host arch, e.g. x86_64\n");
117117
printf(" <sub> = for ex. on arm or thumb: v5, v6m, v7a, v7m, etc.\n");
118118
printf(" Use --target=help to list supported targets\n");
119+
printf(" Or, provide a triple in the format of <arch>-<vendor>-<os>-<abi>.\n");
120+
printf(" By doing this, --target-abi, --cpu, and --cpu-features will be ignored.\n");
121+
printf(" The triple will only be normalized without any further verification.\n");
119122
printf(" --target-abi=<abi> Set the target ABI, e.g. gnu, eabi, gnueabihf, msvc, etc.\n");
120123
printf(" Default is gnu if target isn't riscv64 or riscv32\n");
121124
printf(" For target riscv64 and riscv32, default is lp64d and ilp32d\n");

0 commit comments

Comments
 (0)