[llvm] [WebAssembly] Add symbol information for shared libraries (PR #75238)
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 15 18:04:13 PST 2023
sbc100 wrote:
> The way you have it written here, a symbol table will be built up automatically anytime the exports section is parsed, and then cleared and recreated automatically anytime a symbol table is parsed. Is there any case where we would want this create to always be implicit? In the prototype I had for creating a symbol table from the name section, I made it an explicit method on WasmObjectFile, so that users like nm could "opt in" to the kind of symbol table they wanted (e.g. if there was no symbols after the initial parse, try adding symbols from the name section, and failing that, fall back to exports). I guess if every consumer of WasmObjectFile wants the same behavior, it seems ok to make it implicit. I would think that the linker at least would not want to use symbol information unless it came from a real symbol table, so maybe we need to at least make it possible to detect the source of the symbols.
The linker does want to use symbol information that comes from exports in the case of dynamic libraries, but wants to use the symbol table information the case of wasm object files.
The case we might want to avoid is a normal linked wasm file that contains imports/exports being mistaken for a wasm object file and this is already taken care of here:
https://github.com/llvm/llvm-project/blob/7e4ae28645ef3ad36f1daec3fe3edc901f561bc7/lld/wasm/InputFiles.cpp#L402-L403
`isRelocatableObject` here is only true for object files that have a symbol table, which mean they don't have any pseudo symbol table.
https://github.com/llvm/llvm-project/pull/75238
More information about the llvm-commits
mailing list