[PATCH] D92215: [WebAssembly] MC layer writes table symbols to object files

Andy Wingo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 05:28:15 PST 2021


wingo added inline comments.


================
Comment at: llvm/lib/MC/WasmObjectWriter.cpp:523
+    // The linker won't be able to make the connection between TABLE_INDEX
+    // relocs and the specific table symbol, so explicitly prevent GC from
+    // eliding the symbol.  In the future we may want to define a new kind of
----------------
sbc100 wrote:
> wingo wrote:
> > sbc100 wrote:
> > > I thought the plan was to include this table symbol in a new TABLE_NUMBER reloc to go along with the TABLE_INDEX reloc?  Then each call_indirect could have up to two different relocations.
> > The problem isn't the `call_indirect`, which has a `TABLE_NUMBER` reloc, and doesn't reach this case.  This code is for function pointers, which don't record which table they are against.  It ensures that there is an `__indirect_function_table` if there are function pointers, even if there is never any `call_indirect`.  Does that make sense?
> Hmm... yes I think makes sense.     How about something like this: "any time we have a TABLE_INDEX relocation against a function symbol we need to ensure that table itself is part of the final output too".     Perhaps other types of symbols or other types of relocation could apply to other tables, but for now at least TABLE_INDEX against a function symbol always means an index into  `__indirect_function_table`...    maybe I'm just re-stating what you already wrote :)
Thanks for the reword; applied to the comment.  Cheers :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92215/new/

https://reviews.llvm.org/D92215



More information about the llvm-commits mailing list