Skip to content

Function name choices and multiple definitions #415

@jcbeyler

Description

@jcbeyler

Dear all,

I've had problems today with two test files. The first is f64.wast. My system used to be able to support it but I started trying to support float_exports.wast. Because of that latter test, I started convincing the LLVM backend to create multiple LLVM files, one per module + one for all the asserts.

But problems started to arise:

  • For f64.wast, the methods exposed are the same as the libc names, which means that when I lower it, I end up in an infinite loop
    • The WASM trunc, calls the opcode trunc; I tell it to call trunc the llvm intrinsic but the way it works is that it lowers it as an infinite loop (trunc calls trunc...)
      • Of course, my belief is that Wasm should not care about it and I'll probably just put a prefix to all wasm methods to not have this issue but thought others writing compilers for Wasm might want to be careful of that.

A more annoying problem is this, consider the following test:
https://github.com/WebAssembly/spec/blob/master/ml-proto/test/exports.wast

It contains multiple modules and some define the same method (for example: $f32.no_fold_div_0).

Now the problem is: what do we do? Do we consider that this is legal or illegal to have a wasm file with multiple exported functions that have the same name (I can accept multiple functions with the same name that are not exported).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions