[WebAssembly] Avoid unused function imports in PIC mode
authorSam Clegg <sbc@chromium.org>
Thu, 19 Aug 2021 02:20:55 +0000 (22:20 -0400)
committerSam Clegg <sbc@chromium.org>
Thu, 19 Aug 2021 02:31:04 +0000 (22:31 -0400)
commite4888be74e342840cc1d9e42c9f42938169ae96b
tree9c0b58c2bfb38f596da208344cf1f7b5981d9624
parenta9095f005fdae510fc262f13431c710e3217a0d0
[WebAssembly] Avoid unused function imports in PIC mode

In PIC mode we import function address via `GOT.mem` imports but for
direct function calls we still import the first class function.
However, if the function is never directly called we can avoid the first
class import completely.

Differential Revision: https://reviews.llvm.org/D108345
lld/test/wasm/shared.s
lld/test/wasm/shared64.s
lld/wasm/SymbolTable.cpp
lld/wasm/Writer.cpp