aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index e11338f..206cd6b 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2601,6 +2601,15 @@ generate_ctor_or_dtor_function (bool constructor_p, int priority,
global constructors and destructors. */
body = NULL_TREE;
+ /* For Objective-C++, we may need to initialize metadata found in this module.
+ This must be done _before_ any other static initializations. */
+ if (c_dialect_objc () && (priority == DEFAULT_INIT_PRIORITY)
+ && constructor_p && objc_static_init_needed_p ())
+ {
+ body = start_objects (function_key, priority);
+ static_ctors = objc_generate_static_init_call (static_ctors);
+ }
+
/* Call the static storage duration function with appropriate
arguments. */
for (i = 0; VEC_iterate (tree, ssdf_decls, i, fndecl); ++i)