This is an archive of the discontinued LLVM Phabricator instance.

WIP: [WebAssembly] Always use call_indirect when calling interposable functions
Needs ReviewPublic

Authored by sbc100 on Aug 13 2021, 4:05 PM.

Details

Reviewers
dschuff
Summary

Without this calls to DSO-local but weakly defined symbols will be
direct calls even though at runtime another DLL could define that
symbol.

Fixes: https://github.com/emscripten-core/emscripten/issues/13773

Diff Detail

Event Timeline

sbc100 created this revision.Aug 13 2021, 4:05 PM
sbc100 requested review of this revision.Aug 13 2021, 4:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2021, 4:05 PM
sbc100 retitled this revision from [WebAssembly] Always use call_indirect when calling interposable functions to WIP: [WebAssembly] Always use call_indirect when calling interposable functions.Aug 13 2021, 4:05 PM
sbc100 added a reviewer: dschuff.

Still needs a test.. but this fixes the emscripten issue.

when is Func->isInterposable() true? Is it just for weakly-defined functions (unlike e.g. in ELF where it's true anytime it's not DSO-local?)

when is Func->isInterposable() true? Is it just for weakly-defined functions (unlike e.g. in ELF where it's true anytime it's not DSO-local?)

Ah good point.. my goal here is to got call_indirect (via GOT) for weakly defined functions, but we might not want to do this for all externally visible symbols (or when calling imported functions).