[WebAssembly] Fix R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocation entries
authorSam Clegg <sbc@chromium.org>
Tue, 15 May 2018 22:27:50 +0000 (22:27 +0000)
committerSam Clegg <sbc@chromium.org>
Tue, 15 May 2018 22:27:50 +0000 (22:27 +0000)
commitcfeb646f809461177a89480bfadbc59a00c0018f
tree062d5659d42fd0e66278e36fe27314a668dadff6
parent94548648864144bffa59c545d78fdaa50a89813b
[WebAssembly] Fix R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocation entries

Fixes: lld: warning: unexpected existing value for R_WEBASSEMBLY_FUNCTION_OFFSET_I32: existing=839 expected=838

The existing solution is trying to erroneously recover correct offset of
the function code from the body (which is not a function segment that
includes its size, locals, and code).

The D46763 is trying to maintain the offset of the function code
allowing properly calculate the new relocation entry.

Patch by Yury Delendik

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

llvm-svn: 332412
lld/wasm/InputChunks.h
lld/wasm/InputFiles.cpp