Skip to content

AOT module load fails with "invalid function code offset" when compiled with --enable-llvm-pgo on Windows #4870

@youdie323323

Description

@youdie323323

Describe the bug
Loading an AOT module compiled with wamrc using the --enable-llvm-pgo flag fails at runtime during wasm_runtime_load with the error: AOT module load failed: invalid function code offset.
Compiling the exact same WASM module without --enable-llvm-pgo works perfectly and loads without any issues.

Version

  • WAMR Version: 2.4.4 (binaries are from the official release)

To Reproduce
Steps to reproduce the behavior:

  1. Run wamrc to compile: ./wamrc.exe --target=x86_64 --opt-level=3 --size-level=0 --enable-simd --cpu=x86-64-v3 --enable-llvm-pgo --format=aot -o HavokPhysics.aot HavokPhysics.wasm
  2. Run HavokPhysics.aot with iwasm: ./iwasm.exe -f __wasm_call_ctors HavokPhysics.aot (not adding --gen-prof-file as it does not affect the running)
  3. See error: AOT module load failed: invalid function code offset

Expected behavior
The AOT module should load successfully, just as it does when compiled without the --enable-llvm-pgo flag.

Actual Result

> ./wamrc.exe --target=x86_64 --opt-level=3 --size-level=0 --enable-simd --cpu=x86-64-v3 --enable-llvm-pgo --format=aot -o HavokPhysics.aot HavokPhysics.wasm                                                   
[05:55:35:083 - 7FF7F2205D10]: warning: a module with WASI apis should be either a command or a reactor
Create AoT compiler with:
  target:        x86_64
  target cpu:    x86-64-v3
  target triple: x86_64-pc-windows-msvc
  cpu features:
  opt level:     3
  size level:    0
  output format: AoT file
Compile success, file HavokPhysics.aot was generated.
> ./iwasm.exe -f __wasm_call_ctors HavokPhysics.aot                                                                        
[05:58:25:005 - 7FF7418E6780]: Warning: loader mmap memory address is not in the first 2 Gigabytes of the process address space.
[05:58:25:006 - 7FF7418E6780]: Warning: loader mmap memory address is not in the first 2 Gigabytes of the process address space.
[05:58:25:006 - 7FF7418E6780]: Warning: loader mmap memory address is not in the first 2 Gigabytes of the process address space.
AOT module load failed: invalid function code offset

(Please ignore the warnings, it appears without the --enable-llvm-pgo flag).

Desktop (please complete the following information):

  • Arch: x64
  • Board: A320M-HDV R4.0
  • OS: Windows
  • Version: 11

Additional context
HavokPhysics.wasm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions