From df98d9fb4a111edb4b6427108f862dab18ed88c9 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Tue, 4 Jul 2023 12:03:40 +0800 Subject: [PATCH] Add "--xip" option for wamrc (#2336) Add shorthand "--xip" option for wamrc, which is equal to "--enalbe-indirect-mode --disable-llvm-intrinsics" --- doc/xip.md | 4 ++++ wamr-compiler/main.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/doc/xip.md b/doc/xip.md index d6c5a3701..9e9d1699b 100644 --- a/doc/xip.md +++ b/doc/xip.md @@ -7,8 +7,12 @@ Some IoT devices may require to run the AOT file from flash or ROM which is read The XIP file is an AOT file without (or with few) relocations to patch the AOT code (or text section). Developer can use the option `--enable-indirect-mode --disable-llvm-intrinsics` for wamrc to generate the AOT file, e.g.: ```bash wamrc --enable-indirect-mode --disable-llvm-intrinsics -o +or +wamrc --xip -o ``` +Note: --xip is a short option for --enable-indirect-mode --disable-llvm-intrinsics + ## Known issues There may be some relocations to the ".rodata" like sections which require to patch the AOT code. More work will be done to resolve it in the future. diff --git a/wamr-compiler/main.c b/wamr-compiler/main.c index ce6ed7006..37d659524 100644 --- a/wamr-compiler/main.c +++ b/wamr-compiler/main.c @@ -65,6 +65,7 @@ print_help() printf(" --enable-dump-call-stack Enable stack trace feature\n"); printf(" --enable-perf-profiling Enable function performance profiling\n"); printf(" --enable-memory-profiling Enable memory usage profiling\n"); + printf(" --xip A shorthand of --enalbe-indirect-mode --disable-llvm-intrinsics\n"); printf(" --enable-indirect-mode Enalbe call function through symbol table but not direct call\n"); printf(" --disable-llvm-intrinsics Disable the LLVM built-in intrinsics\n"); printf(" --disable-llvm-lto Disable the LLVM link time optimization\n"); @@ -325,6 +326,10 @@ main(int argc, char *argv[]) else if (!strcmp(argv[0], "--enable-memory-profiling")) { option.enable_stack_estimation = true; } + else if (!strcmp(argv[0], "--xip")) { + option.is_indirect_mode = true; + option.disable_llvm_intrinsics = true; + } else if (!strcmp(argv[0], "--enable-indirect-mode")) { option.is_indirect_mode = true; }