This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add placeholders for R_WASM_TABLE_INDEX_REL_SLEB relocations
ClosedPublic

Authored by sbc100 on May 28 2020, 6:48 PM.

Details

Summary

Previously in the object format we punted on this and simply wrote
zeros (and didn't include the function in the elem segment). With
this change we write a meaningful value which is the segment
relative table index of the associated function.

This matches the that wasm-ld produces in -r mode. This incosistency
bettween the output the MC object writer and the wasm-ld object
writer could cause warnings to be emitted when reading back in the
output of wasm-ld -r. See:
https://github.com/emscripten-core/emscripten/issues/11217

This only applies to this one relocation type which is only generated
when compiling in PIC mode.

Diff Detail

Event Timeline

sbc100 created this revision.May 28 2020, 6:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 28 2020, 6:48 PM

Sorry @dschuff .. not sure who else to send these types of reviews to :)

dschuff accepted this revision.May 29 2020, 10:04 AM

no worries, I'm probably the right one to be reviewing this; I've thought a lot about linking, even if I didn't write any of this code :D

This revision is now accepted and ready to land.May 29 2020, 10:04 AM

speaking of which, can you also add the _REL_ relocations to the linking.md doc in tool-conventions?

speaking of which, can you also add the _REL_ relocations to the linking.md doc in tool-conventions?

Those get documented here: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md. Not in the main document because the final PIC ABI is still not set in stone.

ah right, i had forgotten that.

This revision was automatically updated to reflect the committed changes.