[PATCH] D92840: [WebAssembly] call_indirect causes indirect function table import

Andy Wingo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 8 05:22:14 PST 2020


wingo created this revision.
wingo added a reviewer: sbc100.
Herald added subscribers: ecnelises, arphaman, sunfish, hiraditya, jgravelle-google, dschuff.
wingo requested review of this revision.
Herald added subscribers: llvm-commits, aheejin.
Herald added a project: LLVM.

For wasm-ld table linking work to proceed, object files should indicate
if they use an indirect function table.  In the future this will be done
by the usual symbols and relocations mechanism, but until that support
lands in the linker, the presence of an `__indirect_function_table` in
the object file's import section shows that the object file needs an
indirect function table.

Prior to https://reviews.llvm.org/D91637, this condition was met by all
object files residualizing an `__indirect_function_table` import.

Since https://reviews.llvm.org/D91637, the intention has been that only
those object files needing an indirect function table would have the
`__indirect_function_table` import.  However, we missed the case of
object files which use the table via `call_indirect` but which
themselves do not declare any indirect functions.

This changeset makes it so that when we lower a call to `call_indirect`,
that we ensure that a `__indirect_function_table` symbol is present and
that it will be propagated to the linker.

A followup patch will revise this mechanism to make an explicit link
between `call_indirect` and its associated indirect function table; see
https://reviews.llvm.org/D90948.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92840

Files:
  llvm/lib/MC/WasmObjectWriter.cpp
  llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyUtilities.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyUtilities.h
  llvm/test/CodeGen/WebAssembly/call-indirect.ll
  llvm/test/MC/WebAssembly/type-index.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92840.310148.patch
Type: text/x-patch
Size: 9578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201208/fdac2652/attachment.bin>


More information about the llvm-commits mailing list