This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] MC: Start table at offset 1 rather than 0
ClosedPublic

Authored by sbc100 on Jan 18 2018, 7:56 PM.

Details

Summary

For consistency with the output of lld.

This is useful in runnable binaries as can them be sure the
null function pointer will never be a valid argument
call_indirect.

Diff Detail

Repository
rL LLVM

Event Timeline

sbc100 created this revision.Jan 18 2018, 7:56 PM
ncw accepted this revision.Jan 19 2018, 1:11 AM

I can't see that anything would break by landing this and D42285 first.

There are some other changes in D42095 as well, because even with this offset-by-one change, the indexes written out by Clang still don't match the indexes LLD would write out for the same Symbols (for weak and aliased functions, of course!). But, the rest of #3 (D42095) definitely can't land before #2. Until the actual symbol indexes are being written out for the table relocations (#2), we can't alter the ELEM section to use exactly the same rules in Clang as it does in LLD.

This revision is now accepted and ready to land.Jan 19 2018, 1:11 AM

I was trying to tease out this part that could land without and ABI change (that TABLE_INDEX relocation change). Hopefully we can do the ABI changes this week too though.

dschuff accepted this revision.Jan 19 2018, 10:57 AM
This revision was automatically updated to reflect the committed changes.