21 GCC regressions, 0 new, with your patch on 2003-06-26T09:45:01Z.

Jan Hubicka jh@suse.cz
Thu Jun 26 21:58:00 GMT 2003


> > Here is the diff with and without -funit-at-a-time on Darwin:
> 
> The patch I commited for this yesterday didn't work for darwin?  It
> definitly fixed the problems on PPC Linux.
> Ugm, I will try again with crosscomplier :(
> Basically if there is object output that is not used by way visible to
> varpool it must by marked via varpool_mark_needed_node.  Do you have
> some knowledge how does the Darwin OBJC work and what makes it
> different?

Hi,
the problem is that actually darwin uses special purpose sections instead of
global symbols.  varpool code then removes the variables emit into these
sections as dead.  The attached patch marks all declarations built by
objc-act.c that appears to be set used because it may not be used later (just
to avoid warning as comment in some cases says).  I am not 100% sure that they
are all needed, but they won't hurt and it is probably better to be safe then
sorry when I have zero chances to test it on darwin myself.

Do you have access to darwin machine and can you test it by any chance?

Honza

Thu Jun 26 23:54:36 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* objc-act.c (synth_module_prologue, generate_objc_symtab_decl,
	build_module_descriptor, generate_static_references,
	build_selector_reference_decl, build_class_reference_decl,
	build_objc_string_decl, generate_protocols, synth_forward_declarations,
	synth_forward_declarations, generate_category,
	build_protocol_reference, handle_class_ref):  Mark variables as needed.
Index: objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.177
diff -c -3 -p -r1.177 objc-act.c
*** objc-act.c	14 Jun 2003 17:33:32 -0000	1.177
--- objc-act.c	26 Jun 2003 21:54:27 -0000
*************** synth_module_prologue ()
*** 1224,1229 ****
--- 1224,1231 ----
  
        /* Avoid warning when not sending messages.  */
        TREE_USED (UOBJC_SELECTOR_TABLE_decl) = 1;
+       cgraph_varpool_mark_needed_node
+ 	(cgraph_varpool_node (UOBJC_SELECTOR_TABLE_decl));
      }
  
    generate_forward_declaration_to_string_table ();
*************** generate_objc_symtab_decl ()
*** 1644,1649 ****
--- 1646,1652 ----
    finish_decl (UOBJC_SYMBOLS_decl,
  	       init_objc_symtab (TREE_TYPE (UOBJC_SYMBOLS_decl)),
  	       NULL_TREE);
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (UOBJC_SYMBOLS_decl));
  }
  
  static tree
*************** build_module_descriptor ()
*** 1789,1794 ****
--- 1792,1798 ----
      init_function_decl = current_function_decl;
      TREE_PUBLIC (init_function_decl) = ! targetm.have_ctors_dtors;
      TREE_USED (init_function_decl) = 1;
+     cgraph_mark_needed_node (cgraph_node (init_function_decl), 1);
      /* Don't let this one be deferred.  */
      DECL_INLINE (init_function_decl) = 0;
      DECL_UNINLINABLE (init_function_decl) = 1;
*************** generate_static_references ()
*** 1902,1907 ****
--- 1906,1912 ----
        expr = objc_build_constructor (TREE_TYPE (decl), nreverse (initlist));
        finish_decl (decl, expr, NULL_TREE);
        TREE_USED (decl) = 1;
+       cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
  
        type = build_array_type (build_pointer_type (void_type_node), 0);
        decl = build_decl (VAR_DECL, ident, type);
*************** generate_static_references ()
*** 1925,1930 ****
--- 1930,1936 ----
    expr = objc_build_constructor (TREE_TYPE (static_instances_decl),
  			    nreverse (decls));
    finish_decl (static_instances_decl, expr, NULL_TREE);
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (static_instances_decl));
  }
  
  /* Output all strings.  */
*************** build_selector_reference_decl ()
*** 2003,2008 ****
--- 2009,2015 ----
  
    make_decl_rtl (decl, 0);
    pushdecl_top_level (decl);
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
  
    return decl;
  }
*************** build_class_reference_decl ()
*** 2218,2223 ****
--- 2225,2231 ----
  
    make_decl_rtl (decl, 0);
    pushdecl_top_level (decl);
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
  
    return decl;
  }
*************** build_objc_string_decl (section)
*** 2356,2361 ****
--- 2364,2370 ----
   
    make_decl_rtl (decl, 0);
    pushdecl_top_level (decl);
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
  
    return decl;
  }
*************** generate_protocols ()
*** 3180,3185 ****
--- 3189,3195 ----
  
        /* Mark the decl as used to avoid "defined but not used" warning.  */
        TREE_USED (decl) = 1;
+       cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
      }
  }
  
*************** synth_forward_declarations ()
*** 3519,3524 ****
--- 3529,3535 ----
    decl_specs = tree_cons (NULL_TREE, objc_class_template, sc_spec);
    UOBJC_CLASS_decl = define_decl (an_id, decl_specs);
    TREE_USED (UOBJC_CLASS_decl) = 1;
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (UOBJC_CLASS_decl));
    DECL_ARTIFICIAL (UOBJC_CLASS_decl) = 1;
  
    /* extern struct objc_class _OBJC_METACLASS_<my_name>; */
*************** synth_forward_declarations ()
*** 3528,3533 ****
--- 3539,3545 ----
  
    UOBJC_METACLASS_decl = define_decl (an_id, decl_specs);
    TREE_USED (UOBJC_METACLASS_decl) = 1;
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (UOBJC_METACLASS_decl));
    DECL_ARTIFICIAL(UOBJC_METACLASS_decl) = 1;
  
    /* Pre-build the following entities - for speed/convenience.  */
*************** generate_category (cat)
*** 4417,4422 ****
--- 4429,4435 ----
  
    TREE_USED (decl) = 1;
    finish_decl (decl, initlist, NULL_TREE);
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
  }
  
  /* static struct objc_class _OBJC_METACLASS_Foo={ ... };
*************** build_protocol_reference (p)
*** 5307,5312 ****
--- 5320,5326 ----
        TREE_PUBLIC (decl) = 1;
        TREE_USED (decl) = 1;
        DECL_ARTIFICIAL (decl) = 1;
+       cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
  
        make_decl_rtl (decl, 0);
        pushdecl_top_level (decl);
*************** handle_class_ref (chain)
*** 8462,8467 ****
--- 8476,8482 ----
  
    pushdecl (decl);
    rest_of_decl_compilation (decl, 0, 0, 0);
+   cgraph_varpool_mark_needed_node (cgraph_varpool_node (decl));
  }
  
  static void



More information about the Gcc-regression mailing list