This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Distinguish symbol/debug names for functions and test
ClosedPublic

Authored by ncw on Mar 13 2018, 10:11 AM.

Details

Summary

Previously, the function's "name" was sometimes mangled, sometimes not. Now we have a clear differentiation between symbol names and debug names.

Also adds support for --print-gc-sections for synthetic functions, so that the tests can be extended to cover the function names and debug names separately.

Diff Detail

Repository
rL LLVM

Event Timeline

ncw created this revision.Mar 13 2018, 10:11 AM
sbc100 accepted this revision.Mar 13 2018, 12:29 PM

lgtm, but maybe fix the names first.

test/wasm/undefined-weak-call.ll
16 ↗(On Diff #138221)

Is this really what the stubs are called? I think we should at least make them valid C identifiers. __undefined_xxx?

This revision is now accepted and ready to land.Mar 13 2018, 12:29 PM
ncw added inline comments.Mar 14 2018, 9:49 AM
test/wasm/undefined-weak-call.ll
16 ↗(On Diff #138221)

In the symbol table, the stubs would have the original name. In the "name" section they have this pretty format.

Your suggested prefixed C identifier would only appear in this one single place... We could do it, it might be cleaner, but I've just played around with a couple of options and they're somewhat inelegant.

We basically want to differentiate between an InputFunction's identifier, and the "name" it has as a WasmFunction (which is demangled). We haven't needed that distinction until now.

I was actually thinking of putting the boot on the other foot: really, the -print-gc-sections log messages should be demangled for all symbols, don't you think? That would be another way to regain consistency.

ncw updated this revision to Diff 140215.EditedMar 29 2018, 5:54 AM
ncw retitled this revision from [WebAssembly] Implement --print-gc-sections for synthetic functions to [WebAssembly] Distinguish symbol/debug names for functions and test.
ncw edited the summary of this revision. (Show Details)

Updated, with clear differentiation between (symbol) name and debug name.

Requires corresponding LLVM commit D45021

This revision was automatically updated to reflect the committed changes.