From c0a32b317df67878ad6c1939eb055e263642562c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Mon, 11 Aug 2025 16:06:17 +0900 Subject: [PATCH] wamr-compiler: add --llvm-version option (#4540) llvm is one of the most important component of wamrc. otoh, i often forget which version of llvm i linked to my wamrc binary. this option would help people with a dim memory like me. ```shell spacetanuki% ./wamrc --llvm-version LLVM 19.1.2 spacetanuki% ``` --- wamr-compiler/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wamr-compiler/main.c b/wamr-compiler/main.c index 62b0dfb90..2ca9a175d 100644 --- a/wamr-compiler/main.c +++ b/wamr-compiler/main.c @@ -9,6 +9,7 @@ #include "wasm_export.h" #include "aot_export.h" +#include #include #if BH_HAS_DLFCN @@ -218,6 +219,7 @@ print_help() printf(" WARNING: enable this feature will largely increase code size\n"); printf(" -v=n Set log verbose level (0 to 5, default is 2), larger with more log\n"); printf(" --version Show version information\n"); + printf(" --llvm-version Show LLVM version information\n"); printf("Examples: wamrc -o test.aot test.wasm\n"); printf(" wamrc --target=i386 -o test.aot test.wasm\n"); printf(" wamrc --target=i386 --format=object -o test.o test.wasm\n"); @@ -676,6 +678,12 @@ main(int argc, char *argv[]) printf("wamrc %u.%u.%u\n", major, minor, patch); return 0; } + else if (!strcmp(argv[0], "--llvm-version")) { + unsigned major, minor, patch; + LLVMGetVersion(&major, &minor, &patch); + printf("LLVM %u.%u.%u\n", major, minor, patch); + return 0; + } else PRINT_HELP_AND_EXIT(); }