Skip to content

LTO breaks the multi-value (i.e., experimental-mv) ABI for WebAssembly in Clang and generates incompatible function signatures #92995

Description

@jonathanmarvens

I’ve been using the multi-value ABI for WebAssembly in Clang (i.e., -mmultivalue -Xclang -target-abi -Xclang experimental-mv) and it’s been working relatively well. I decided to enable LTO (thin) in the pipeline and everything exploded—the signatures of all of the functions using multi-value returns are changed in the final WebAssembly binary (lowering the multi-value returns to pointer parameters). The linker seems to be the culprit, because all of the signatures in the LLVM bitcode produced for the individual object files are correct (I’ve painstakingly inspected all of them to confirm this). Also, the same problem persists with full LTO.

Given that this is a proprietary project that involves a somewhat complex pipeline, it’s difficult to extract a reasonable sample of the code to reproduce this issue, but I can try to create an example from scratch if necessary.

I think the following Emscripten issues are related to this issue too:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    LTOLink time optimization (regular/full LTO or ThinLTO)backend:WebAssembly

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions