[LLVMbugs] [Bug 2742] New: endless trouble due to functions with weak linkage

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Sep 1 08:21:55 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2742

           Summary: endless trouble due to functions with weak linkage
           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
            Blocks: 1678,2398,2411


All kinds of passes, eg: IP constant propagation,
Andersen's, GlobalsModRef, the inliner, and probably
many other IP passes, are all wrong for functions
with weak linkage.  The reason is that such functions
have a definition, but the definition may be wrong -
it can be replaced with something completely different
at link time.  Rather than fixing up all passes, here
is a suggestion for how to solve all problems in one
fell swoop:

(0) make it illegal for a function to have weak
linkage.
(1) when creating a function F which should have
weak linkage, instead output it with a different
name ("F2"), and create a weak alias F which
links to F2.  Calls to the function will be calls
to F, the alias.  The optimizers won't see the
body for F, since there is none, so won't make
mistakes.
(2) at codegen time, undo this transform: output
F2 with name F and with weak linkage.


-- 
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