Do no emit GNU metadata if there is nothing to put into it
authorNicola Pero <nicola.pero@meta-innovation.com>
Sat, 19 Feb 2011 00:12:45 +0000 (00:12 +0000)
committerNicola Pero <nicola@gcc.gnu.org>
Sat, 19 Feb 2011 00:12:45 +0000 (00:12 +0000)
From-SVN: r170292

gcc/objc/ChangeLog
gcc/objc/objc-gnu-runtime-abi-01.c

index 926352e51c9acdd0e7c4cdc9ececd6fe5a4e577b..81fff66fd4569cd8bebdd8fc6ad72b90871812be 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-19  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * objc-gnu-runtime-abi-01.c (objc_generate_v1_gnu_metadata): Do
+       not generate metadata if there is nothing to put into it.
+
 2011-02-17  Iain Sandoe  <iains@gcc.gnu.org>
 
        * config-lang.in (gtfiles): Updated.
index a13f0158b1c47f7ce68e02ac68528004f2a06c08..fdf04802321e72e6b174c9e16ea33aa5e3feca58 100644 (file)
@@ -2105,11 +2105,23 @@ objc_generate_v1_gnu_metadata (void)
     generate_protocols ();
 
   /* Arrange for ObjC data structures to be initialized at run time.  */
-  generate_objc_symtab_decl ();
-  /* Make sure that the meta-data are identified as being GNU-runtime.  */
-  build_module_descriptor (OBJC_VERSION, 
-                          build_tree_list (objc_meta, meta_base));
-  build_module_initializer_routine ();
+  /* FIXME: Have some more elegant way to determine if we need to
+     generate objc_symtab_decl or not, instead of checking these
+     global symbols.  */
+  if (imp_list || class_names_chain
+      || meth_var_names_chain || meth_var_types_chain || sel_ref_chain
+      || prop_names_attr_chain)
+    generate_objc_symtab_decl ();
+
+  if (imp_list || class_names_chain || objc_static_instances
+      || meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
+    {
+      /* Make sure that the meta-data are identified as being
+        GNU-runtime.  */
+      build_module_descriptor (OBJC_VERSION, 
+                              build_tree_list (objc_meta, meta_base));
+      build_module_initializer_routine ();
+    }
 
   /* Dump the class references.  This forces the appropriate classes
      to be linked into the executable image, preserving unix archive