[LLVMbugs] [Bug 11480] New: attribute((init_array(N))) is not codegen'ed properly
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Dec 4 23:45:16 PST 2011
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: unassignedclangbugs at nondot.org
ReportedBy: asl at math.spbu.ru
CC: llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list