More precise help info of enabled targets for wamrc (#2783)

Instead of printing all support targets of wamrc, print only the targets
that are included in the LLVM library with which wamrc was compiled.
This commit is contained in:
TianlongLiang 2023-11-17 19:05:00 +08:00 committed by GitHub
parent b39fd516d3
commit 08c0ec74c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1938,13 +1938,33 @@ static void
print_supported_targets()
{
uint32 i;
const char *target_name;
os_printf("Supported targets:\n");
for (i = 0; i < sizeof(valid_archs) / sizeof(ArchItem); i++) {
os_printf("%s ", valid_archs[i].arch);
if (valid_archs[i].support_eb)
os_printf("%seb ", valid_archs[i].arch);
/* over the list of all available targets */
for (LLVMTargetRef target = LLVMGetFirstTarget(); target != NULL;
target = LLVMGetNextTarget(target)) {
target_name = LLVMGetTargetName(target);
/* Skip mipsel, aarch64_be since prefix mips, aarch64 will cover them */
if (strcmp(target_name, "mipsel") == 0)
continue;
else if (strcmp(target_name, "aarch64_be") == 0)
continue;
if (strcmp(target_name, "x86-64") == 0)
os_printf(" x86_64\n");
else if (strcmp(target_name, "x86") == 0)
os_printf(" i386\n");
else {
for (i = 0; i < sizeof(valid_archs) / sizeof(ArchItem); i++) {
/* If target_name is prefix for valid_archs[i].arch */
if ((strncmp(target_name, valid_archs[i].arch,
strlen(target_name))
== 0))
os_printf(" %s\n", valid_archs[i].arch);
}
}
}
os_printf("\n");
}
static void