Skip to content

Export of local symbols in .o files #29

Closed
@sunfishcode

Description

@sunfishcode

This C:

static void foo(void) {}
void *bar(void) { return foo; }

currently compilers to this wasm:

(module
  (type (;0;) (func (result i32)))
  (type (;1;) (func))
  (func $bar (type 0) (result i32)
    i32.const 0)
  (func $foo (type 1))
  (table (;0;) 1 anyfunc)
  (memory (;0;) 0)
  (export "bar" (func $bar))
  (export "foo" (func $foo))
  (elem (i32.const 0) $foo))

It's surprising to see "barfoo" exported here, since it has internal name linkage. The linkage is recorded in the metadata, via WASM_SYM_BINDING_LOCAL, however it seems like it would be more wasm-like to just omit the export.

Local symbols are never comdat or weak and they don't have visibilities, so it seems like they could be omitted from the WASM_SYMBOL_INFO subsection altogether.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions