[wasm] Correctly escape library names when generating symbols for .c (#79007)
authorAnkit Jain <radical@gmail.com>
Wed, 30 Nov 2022 23:31:32 +0000 (18:31 -0500)
committerGitHub <noreply@github.com>
Wed, 30 Nov 2022 23:31:32 +0000 (18:31 -0500)
commit85a9dfcdeea437c0d7c8be77a2be71a8786a6727
tree4a54be07fd447a54910e3ff6d5ed4bc077facfb3
parentc01ad8694fe712e9dcdfa9a9d37c1be0e8b82e4e
[wasm] Correctly escape library names when generating symbols for .c (#79007)

* [wasm] Correctly escape library names when generating symbols for .c files.
Use the existing `FixupSymbolName` method for fixing library names too,
when converting to symbols.

* [wasm] *TableGenerator task: Cache the symbol name fixups
.. as it is called frequently, and for repeated strings. For a
consolewasm template build, we get 490 calls but only 140 of them are
for unique strings.

* Add tests

Fixes https://github.com/dotnet/runtime/issues/78992 .
src/mono/wasm/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs
src/tasks/WasmAppBuilder/IcallTableGenerator.cs
src/tasks/WasmAppBuilder/ManagedToNativeGenerator.cs
src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs