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

             Bug #: 11480
           Summary: attribute((init_array(N))) is not codegen'ed properly
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


Right now attribute((init_array(N))) in clang defines the "local" order of
initialization of statics in the same TU. However, gcc's behavior for
init_array(N) is same as for constructor(N) - global priority wrt all TUs.

The solution seems to be easy - instead of emission of the single global
initialization function, emit one for each priority and rely on the priorities
in the LLVM's global_ctor / global_dtor section. There, if the target supports
the ctor / dtor priorities, then everything will be emitted in the appropriate
order. Otherwise (e.g. on Darwin, which does not support the priorities), we'll
emit everything into the single section with the proper priority order.

Does this sound reasonable?

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to