wasm32-wasi: Error while linking - invalid relocation function index

Summary

Error during linking process if there are units in implementation section.

System Information

  • Operating system: Host: Arch Linux. Client: WASI
  • Processor architecture: Host: x86_64. Client: wasm32
  • Compiler version: 3.3.1-9965-g88959bdd
  • Linker version: LLD 12.0.0 & LLD 13.0.0
  • Device: Computer

Steps to reproduce

linker-error.zip Extract the attached zip file and compile the code with fpc -Twasi -Pwasm32 -MObjFPC -Sh -otestlinkererror.wasm testlinkererror.pas

What is the current bug behavior?

Compilation ok but fails during linking process with this error message: wasm-ld: error: unit1.o: invalid relocation function index

What is the expected (correct) behavior?

Compilation completes without any errors.

Edited by kagamma