This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Expunge mark_referenced (needs testing on Darwin/OSX)
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Andrew Pinski <pinskia at physics dot uc dot edu>, Andreas Tobler <toa at pop dot agri dot ch>
- Date: Wed, 2 Jun 2004 13:13:07 -0400
- Subject: Re: Expunge mark_referenced (needs testing on Darwin/OSX)
- References: <877jv4ruez.fsf@taltos.codesourcery.com> <366E5542-B169-11D8-A101-000393A6D2F2@physics.uc.edu> <87oeo7w46t.fsf@taltos.codesourcery.com>
On May 29, 2004, at 13:09, Zack Weinberg wrote:
Andrew Pinski <pinskia@physics.uc.edu> 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.
Thanks,
Andrew Pinski
ChangeLog:
* 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
TREE_SYMBOL_REFERENCED on the DECL_ASSEMBLER_NAME of the decl.
Patch:
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. */
#define DECL_NEEDED_P(DECL) \
((at_eof && TREE_PUBLIC (DECL) && !DECL_COMDAT (DECL)) \
- || (DECL_ASSEMBLER_NAME_SET_P (DECL) \
- && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL))) \
+ || (DECL_P (DECL) && TREE_CODE (DECL) != FUNCTION_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