This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Use data sections by default
ClosedPublic

Authored by sbc100 on Feb 7 2021, 8:25 PM.

Details

Summary

This allows data sections that don't start with .data to be
used/created.

Without this, clang's __attribute__((section("foo"))) would
generate assembly that would not parse.

Diff Detail

Event Timeline

sbc100 created this revision.Feb 7 2021, 8:25 PM
sbc100 requested review of this revision.Feb 7 2021, 8:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2021, 8:25 PM
dschuff accepted this revision.Feb 9 2021, 10:58 AM
This revision is now accepted and ready to land.Feb 9 2021, 10:58 AM

So the issue here is that using attribute(section) just generates the equivalent of .section and expects it to be a data section by default? Can you use attribute(section) on a function too? what's the behavior?

This revision was landed with ongoing or failed builds.Feb 9 2021, 11:03 AM
This revision was automatically updated to reflect the committed changes.

So the issue here is that using attribute(section) just generates the equivalent of .section and expects it to be a data section by default? Can you use attribute(section) on a function too? what's the behavior?

No, with wasm we don't support the section attribute for functions. Functions always get a unique section of their own. Also, unlike data sections you cannot get the start_xxx and end_xxx of a text section or find any addresses within a text section so it makes almost no sense to try to do this with wem.