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
This commit is contained in:
YAMAMOTO Takashi 2024-08-20 11:26:26 +09:00 committed by GitHub
parent 97c95a2e2f
commit 581e1d9767
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;