This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssemby] Allow import module names to be empty strings.
ClosedPublic

Authored by sunfish on Aug 31 2022, 11:44 AM.

Details

Summary

The component-model [canonical ABI] is currently using import module names with empty strings. Remove the special cases for empty strings from WasmObjectFile.cpp so that they can pass through as-is.

Diff Detail

Event Timeline

sunfish created this revision.Aug 31 2022, 11:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2022, 11:45 AM
sunfish requested review of this revision.Aug 31 2022, 11:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 31 2022, 11:45 AM
Herald added a subscriber: aheejin. · View Herald Transcript

Did you mean to title this "Allow import names and modules to be empty strings." ?

The change to the code here seems only to relate to the module and the not the name/field of the import, is that right? Were fields already allowed to be empty? In which case maybe the title should just be "Allow empty module names in imports?"

is the canonical ABI using empty fields or empty module names? (presumably one can't use both .. otherwise everything is the same import :)

lld/test/wasm/import-module-empty.ll
14 ↗(On Diff #457043)

We've been in the process of trying to re-write all wasm-ld tests in assembly for a while now. I think these should be easy enough to write in .s format?

sunfish retitled this revision from [lld][WebAssemby] Allow import names and sections to be empty strings. to [lld][WebAssemby] Allow import module names to be empty strings..Aug 31 2022, 2:24 PM
sunfish edited the summary of this revision. (Show Details)
sbc100 accepted this revision.Aug 31 2022, 2:29 PM

lgtm with tests converted to asm.

This revision is now accepted and ready to land.Aug 31 2022, 2:29 PM

Actually perhaps we can just make this part of the existing lld/test/wasm/import-module.ll, and lld/test/wasm/import-name.ll tests.. i don't see why they shouldn't test the different edge cases in the single test file (if you do it that way I guess you can avoid re-writing them tests in assembly too :)

sunfish updated this revision to Diff 457098.Aug 31 2022, 2:43 PM

Instead of adding new test files, add tests to existing test files.

The change to the code here seems only to relate to the module and the not the name/field of the import, is that right? Were fields already allowed to be empty? In which case maybe the title should just be "Allow empty module names in imports?"

The actual change is just for module names. Empty fields were already supported. I've now updated the title.

is the canonical ABI using empty fields or empty module names? (presumably one can't use both .. otherwise everything is the same import :)

The canonical ABI is using empty module names for some things.

Actually perhaps we can just make this part of the existing lld/test/wasm/import-module.ll, and lld/test/wasm/import-name.ll tests.. i don't see why they shouldn't test the different edge cases in the single test file (if you do it that way I guess you can avoid re-writing them tests in assembly too :)

I've now done this :-).

This revision was landed with ongoing or failed builds.Aug 31 2022, 3:30 PM
This revision was automatically updated to reflect the committed changes.