Преглед на файлове

compilation: Use the dedicated stack-sizes section only for AOT (#3732)

For JIT, we naturally use mach-o on macOS, where the section name
we currently use is not valid and ends up with the errors like:

```
LLVM ERROR: Global variable '__orc_lcl.aot_stack_sizes.0' has an invalid section specifier '.aot_stack_sizes': mach-o section specifier requires a segment and section separated by a comma.
```

Because the dedicated section is not necessary for JIT,
this commit simply stops using it.

Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/3730
YAMAMOTO Takashi преди 1 година
родител
ревизия
581e1d9767
променени са 1 файла, в които са добавени 9 реда и са изтрити 1 реда
  1. 9 1
      core/iwasm/compilation/aot_llvm.c

+ 9 - 1
core/iwasm/compilation/aot_llvm.c

@@ -1690,7 +1690,15 @@ aot_create_stack_sizes(const AOTCompData *comp_data, AOTCompContext *comp_ctx)
      * avoid creating extra relocations in the precheck functions.
      */
     LLVMSetLinkage(stack_sizes, LLVMInternalLinkage);
-    LLVMSetSection(stack_sizes, aot_stack_sizes_section_name);
+    /*
+     * for AOT, place it into a dedicated section for the convenience
+     * of the AOT file generation and symbol resolutions.
+     *
+     * for JIT, it doesn't matter.
+     */
+    if (!comp_ctx->is_jit_mode) {
+        LLVMSetSection(stack_sizes, aot_stack_sizes_section_name);
+    }
     comp_ctx->stack_sizes_type = stack_sizes_type;
     comp_ctx->stack_sizes = stack_sizes;
     return true;