-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.
Description
| Bugzilla Link | 11480 |
| Resolution | FIXED |
| Resolved on | Sep 09, 2015 11:53 |
| Version | unspecified |
| OS | All |
| CC | @noloader,@kaomoneus |
Extended Description
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?
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.