It can be that while processing relocations, we realize that in the end
we need an indirect function table. Ensure that one is present, in that
case, to avoid writing invalid object files.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
lgtm % comments / nits
lld/wasm/Driver.cpp | ||
---|---|---|
798 | This function can probably just be removed now. | |
lld/wasm/SymbolTable.cpp | ||
683 | Remove this line? | |
lld/wasm/SyntheticSections.cpp | ||
304 | you can do resolveIndirectFunctionTable(/*required =*/true); to avoid the extra local Perhaps the early return is then overkill if if the body is just one line anyway? | |
313 | How about calling this ensureIndirectFunctionTable ? | |
lld/wasm/Writer.cpp | ||
743 | This kind of ordering violation kind of makes me sad, but I'm not sure I have any better ideas. | |
743 | Can this be replaced by: // In some cases indirectFunctionTable is added during scanRelocations and therefore was not // added to the import list at the normal time. if (shouldImport(WasmSym::indirectFunctionTable) && !WasmSym::indirectFunctionTable.hasTableNumber()) { ... ` This would avoid the extra indirectFunctionTablePresentWhenComputingImports variable which would simplify the patch a little I think (you could revert the conversion of finalizeIndirectFunctionTable to a member for example). Its still ugly but less intrusive maybe. |
lld/wasm/Writer.cpp | ||
---|---|---|
743 | Yeah I feel the pain here -- I did try to add a clause in the earlier resolveIndirectFunctionTable routine, but at that point it's too hard to know if there are GOT function pointers. Sad indeed. Thanks for the review! |
This function can probably just be removed now.