-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Description
| Bugzilla Link | 2398 |
| Version | unspecified |
| OS | Linux |
| Depends On | llvm/llvm-bugzilla-archive#2742 |
| Reporter | LLVM Bugzilla Contributor |
| CC | @asl,@nlewycky |
Extended Description
The definition of a weak function can be replaced with
a different definition (this is what "weak linkage" means).
So any deductions made by examining the instructions making
up a weak function definition may be wrong. So such functions
must not be inlined etc. This also impacts calculation of the
callgraph: a new definition may call different functions to the
current definition.
The obvious thing to do is to have functions that call
the weak function get an external node in their callgraph
as well as the weak function. I think the weak function is
needed in the callgraph as well as the external node
because the weak function may call functions with internal
linkage while an external definition cannot, so if there
was only an external node then optimizers might wrongly
think that a call to the weak function cannot access internal
functions.
There is also the question of what the callgraph for the
weak function itself should look like. I think this should
be the callgraph of the current definition plus the external
node for the same reason.
Note that any new definition of the weak function will not be
able to access internal globals.