[LLVMbugs] [Bug 5329] New: Global ctor/dtor priorities not codegened correctly

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Oct 28 15:55:17 PDT 2009


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

           Summary: Global ctor/dtor priorities not codegened correctly
           Product: new-bugs
           Version: unspecified
          Platform: PC
        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


Created an attachment (id=3718)
 --> (http://llvm.org/bugs/attachment.cgi?id=3718)
failing testcase

The attached gcc testcase fails:

$ llvm-g++ -o initp1 initp1.C
$ ./initp1 
Aborted

That's because the constructors are being output in the wrong
order in the ctors section.  EmitXXStructorList in ELFWriter.cpp
should output the ctors in decreasing numerical order of priority.
Right now it doesn't order them at all.

Interestingly, another solution is to not output the ctors
section at all!  This only works for ctors/dtors generated
by gcc: it seems they use magic names that are recognized
by collect2.  So it would be enough for llvm-gcc to not add
ctors to llvm.global_ctors at all, and just mark them as used.


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