This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH committed: 64-bit Apple Objective-C runtime support


Alexandre,

I applied the following patch to fix it.  Tested and regtested for ObjC/ObjC++ on i686 linux-gnu.

This fixes the specific command that fails your bootstrap with the options you are using.
I can see the command failing before this patch, and succeeding with it applied.  So it
should fix your problem.  I have started a full bootstrap with your options to double-check,
but it hasn't completed yet.

The reason the command failed is that it runs -fcompare-debug -print-runtime-info on a basically
empty file.  That runs the ObjC compiler twice.  Both times the compiler is ran with -print-runtime-info,
both the -fcompare-debug option gets to the actual ObjC compiler only once.  The code does
-print-runtime-info the time that -fcompare-debug is not passed (this exits the compiler without
going any further), but skips it when it is passed.  This causes it to compare the output of the
compiler exiting immediately, with the output of the compiler on a file that contains nothing.

I'm not entirely sure why it does that - but it certainly does the very useful check of checking
that the compiler doesn't emit ObjC metadata when there is nothing in the input file!  I assume
that is the reason for the behaviour actually - to have -fcompare-debug do this useful check. :-)

The changes the ObjC metadata generation had changed the GNU runtime in a way that would break
this check.  I restored the original behaviour.

Apologies; thanks a lot for your patience.

Thanks

PS: The patch was pre-approved by Mike Stump.  He pre-approved any critical ObjC/ObjC++
bugfix immediately required to address problems caused by the 64-bit Apple ObjC runtime
support patch.  I think this qualifies.

Index: objc-gnu-runtime-abi-01.c
===================================================================
--- objc-gnu-runtime-abi-01.c   (revision 170291)
+++ objc-gnu-runtime-abi-01.c   (working copy)
@@ -2105,12 +2105,24 @@ 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
      semantics.  This can be removed when we move to a more dynamically
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 170291)
+++ ChangeLog   (working copy)
@@ -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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]