Skip to content

Commit c0a32b3

Browse files
authored
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% ```
1 parent 082e558 commit c0a32b3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

wamr-compiler/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "wasm_export.h"
1010
#include "aot_export.h"
1111

12+
#include <llvm-c/Core.h>
1213
#include <llvm-c/Support.h>
1314

1415
#if BH_HAS_DLFCN
@@ -218,6 +219,7 @@ print_help()
218219
printf(" WARNING: enable this feature will largely increase code size\n");
219220
printf(" -v=n Set log verbose level (0 to 5, default is 2), larger with more log\n");
220221
printf(" --version Show version information\n");
222+
printf(" --llvm-version Show LLVM version information\n");
221223
printf("Examples: wamrc -o test.aot test.wasm\n");
222224
printf(" wamrc --target=i386 -o test.aot test.wasm\n");
223225
printf(" wamrc --target=i386 --format=object -o test.o test.wasm\n");
@@ -676,6 +678,12 @@ main(int argc, char *argv[])
676678
printf("wamrc %u.%u.%u\n", major, minor, patch);
677679
return 0;
678680
}
681+
else if (!strcmp(argv[0], "--llvm-version")) {
682+
unsigned major, minor, patch;
683+
LLVMGetVersion(&major, &minor, &patch);
684+
printf("LLVM %u.%u.%u\n", major, minor, patch);
685+
return 0;
686+
}
679687
else
680688
PRINT_HELP_AND_EXIT();
681689
}

0 commit comments

Comments
 (0)