wasm: fix functions exported through //export

When a function is exported using //export, but also had a
//go:wasm-module pragma, the //export name was ignored. The
//go:wasm-module doesn't actually do anything besides breaking the
export (exported functions don't have a module name).

I've refactored and cleaned up the code, and in the process removed this
weird edge case.
This commit is contained in:
Ayke van Laethem
2023-07-28 12:49:07 +02:00
committed by Ron Evans
parent 00d46bd25d
commit d845f1e1b2
3 changed files with 39 additions and 35 deletions
+13
View File
@@ -62,6 +62,19 @@ func exportedFunctionInSection() {
//go:wasmimport modulename import1
func declaredImport()
// Legacy way of importing a function.
//
//go:wasm-module foobar
//export imported
func foobarImport()
// The wasm-module pragma is not functional here, but it should be safe.
//
//go:wasm-module foobar
//export exported
func foobarExportModule() {
}
// This function should not: it's only a declaration and not a definition.
//
//go:section .special_function_section