You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Stack: a call to a weak function uses a definition the link may replace #191
The max stack of a caller takes a weak function's definition as the callee, but the link may replace that definition by another one. The result is then a known max stack that is wrong.
The linked program calls the strong replaceable of override.c, which alone takes 272 bytes. caller is reported at 32 bytes, known.
Analyzed alone, weak-function.c can still be linked with a program that defines replaceable, so its definition is not the callee for sure.
Expected
The caller's max stack stays unknown in both runs, as for a call whose callee is not known:
caller.maxStackUnknown == true with override.c;
caller.maxStackUnknown == true without it.
Where it comes from
src/analysis/StackComputation.cpp takes any definition as the callee:
calledDefinition, without a resolver: callee && !callee->isDeclaration();
CallResolver::resolve: a direct callee that is not a declaration.
Neither checks hasExactDefinition(), which CallResolver's own index and the never-return pass (src/passes/ModulePasses.cpp) already require.
A weak alias does not have the problem: on main its call is not resolved at all, and #190, which follows aliases, keeps an interposable alias's callee unknown. A weak function that is not an alias is outside #190's scope.
Activity