[LLVMbugs] [Bug 2398] New: callgraph wrong in presence of weak functions

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat May 31 23:43:42 PDT 2008


           Summary: callgraph wrong in presence of weak functions
           Product: new-bugs
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: baldrick at free.fr
                CC: llvmbugs at cs.uiuc.edu

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

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.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list