HomePhabricator

[WebAssembly] Add placeholders for R_WASM_TABLE_INDEX_REL_SLEB relocations
Audit Required81443ac1bc71

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

Description

[WebAssembly] Add placeholders for R_WASM_TABLE_INDEX_REL_SLEB relocations

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 inconsistency
between 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.

Differential Revision: https://reviews.llvm.org/D80774

Details