This is the mail archive of the 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: Expunge mark_referenced (needs testing on Darwin/OSX)

On May 29, 2004, at 13:09, Zack Weinberg wrote:

Andrew Pinski <> writes:

On May 22, 2004, at 18:03, Zack Weinberg wrote:
I do not have access to a Darwin system; I would appreciate testing.
This patch has not even been compiled.

When testing this, this patch produces a huge amount of new FAILs. All most of all the new failures are due to the vtable/typeinfo for C++ is not being emitted.

I can look into why this is happening unless you want to look into it.

Yes, I would appreciate your looking into it.

And here is the patch which I came up to fix the failures, the problem was
the C++ front-end was looking into TREE_SYMBOL_REFERENCED still but now that
it is only done when the assemble_name is called on it, the vtable/typeinfo
were not being marked as REFERENCED as the name which Darwin was using was
not the normal name but a non-lazy pointer (an indirect pointer as the
vtable/typeinfo are weak). So to fix it, we need a patch to the darwin
back-end so that the non-lazy pointer's SYMBOL_REF has a pointer back
to the original decl. The other part of the patch is to remove the
looking into TREE_SYMBOL_REFERENCED in the C++ front-end by using the
cgraph_*node functions and looking if the decl is needed.

Andrew Pinski

	* config/darwin.c (machopic_indirect_data_reference): Copy
	the SYMBOL_REF_DECL from the original RTX for the new
	non-lazy pointer RTX.
	* cp-tree.h: Include cgraph.h
	(DECL_NEEDED_P): Use cgraph_*node on the decl instead of

Index: config/darwin.c
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.68
diff -u -p -r1.68 darwin.c
--- config/darwin.c	29 May 2004 02:55:23 -0000	1.68
+++ config/darwin.c	2 Jun 2004 16:55:39 -0000
@@ -497,8 +486,9 @@ machopic_indirect_data_reference (rtx or

       ptr_ref = gen_rtx_SYMBOL_REF (Pmode,
-				    machopic_non_lazy_ptr_name (name));
+                                    machopic_non_lazy_ptr_name (name));

+      SYMBOL_REF_DECL (ptr_ref) = SYMBOL_REF_DECL (orig);
       ptr_ref = gen_rtx_MEM (Pmode, ptr_ref);
       RTX_UNCHANGING_P (ptr_ref) = 1;

Index: cp/cp-tree.h
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.970
diff -u -p -r1.970 cp-tree.h
--- cp/cp-tree.h	31 May 2004 21:24:28 -0000	1.970
+++ cp/cp-tree.h	2 Jun 2004 16:55:40 -0000
@@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA.  */
 #include "hashtab.h"
 #include "splay-tree.h"
 #include "varray.h"
+#include "cgraph.h"

#include "c-common.h"
#include "name-lookup.h"
@@ -1710,8 +1711,9 @@ struct lang_decl GTY(())
not something is comdat until end-of-file. */
((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \
+ && cgraph_varpool_node (DECL)->needed) \
+ || (TREE_CODE (DECL) == FUNCTION_DECL && cgraph_node (DECL)->needed) \
|| (((flag_syntax_only || flag_unit_at_a_time) && TREE_USED (DECL))))

/* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]