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]

Doh! Forgot the AIX vtable patch...



Here's the patch itself...

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-02-06  Mark Mitchell  <mark@codesourcery.com>

	* config/rs6000/rs6000.h (ASM_OUTPUT_SYMBOL_REF): Define.
	* config/rs6000/rs6000-protos.h (rs6000_output_symbol_ref): Declare.
	* config/rs6000/rs6000.c (VTABLE_NAME_P): New macro.
	(rs6000_output_symbol_ref): New function.
	(output_toc): Use VTABLE_NAME_P.
	
Index: rs6000-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000-protos.h,v
retrieving revision 1.14
diff -c -p -r1.14 rs6000-protos.h
*** rs6000-protos.h	2001/01/24 00:07:32	1.14
--- rs6000-protos.h	2001/02/06 18:56:38
*************** extern void rs6000_emit_move PARAMS ((rt
*** 109,114 ****
--- 109,115 ----
  extern rtx rs6000_legitimize_address PARAMS ((rtx, rtx, enum machine_mode));
  extern void rs6000_select_rtx_section PARAMS ((enum machine_mode, rtx));
  extern rtx rs6000_return_addr PARAMS ((int, rtx));
+ extern void rs6000_output_symbol_ref PARAMS ((FILE*, rtx));
  #endif /* RTX_CODE */
  
  #ifdef TREE_CODE
Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.163
diff -c -p -r1.163 rs6000.c
*** rs6000.c	2001/02/05 19:42:13	1.163
--- rs6000.c	2001/02/06 18:56:43
*************** toc_hash_mark_table (vht)
*** 6735,6740 ****
--- 6735,6772 ----
    htab_traverse (*ht, toc_hash_mark_entry, (void *)0);
  }
  
+ /* These are the names given by the C++ front-end to vtables, and
+    vtable-like objects.  Ideally, this logic should not be here;
+    instead, there should be some programmatic way of inquiring as
+    to whether or not an object is a vtable.  */
+ 
+ #define VTABLE_NAME_P(NAME)				\
+   (strncmp ("_vt.", name, strlen("_vt.")) == 0		\
+   || strncmp ("_ZTV", name, strlen ("_ZTV")) == 0	\
+   || strncmp ("_ZTT", name, strlen ("_ZTT")) == 0	\
+   || strncmp ("_ZTC", name, strlen ("_ZTC")) == 0) 
+ 
+ void
+ rs6000_output_symbol_ref (file, x)
+      FILE *file;
+      rtx x;
+ {
+   /* Currently C++ toc references to vtables can be emitted before it
+      is decided whether the vtable is public or private.  If this is
+      the case, then the linker will eventually complain that there is
+      a reference to an unknown section.  Thus, for vtables only, 
+      we emit the TOC reference to reference the symbol and not the
+      section.  */
+   const char *name = XSTR (x, 0);
+ 
+   if (VTABLE_NAME_P (name)) 
+     {
+       RS6000_OUTPUT_BASENAME (file, name);
+     }
+   else
+     assemble_name (file, name);
+ }
+ 
  /* Output a TOC entry.  We derive the entry name from what is
     being written.  */
  
*************** output_toc (file, x, labelno, mode)
*** 6942,6948 ****
       a TOC reference to an unknown section.  Thus, for vtables only,
       we emit the TOC reference to reference the symbol and not the
       section.  */
!   if (strncmp ("_vt.", name, 4) == 0)
      {
        RS6000_OUTPUT_BASENAME (file, name);
        if (offset < 0)
--- 6974,6980 ----
       a TOC reference to an unknown section.  Thus, for vtables only,
       we emit the TOC reference to reference the symbol and not the
       section.  */
!   if (VTABLE_NAME_P (name))
      {
        RS6000_OUTPUT_BASENAME (file, name);
        if (offset < 0)
Index: rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.102
diff -c -p -r1.102 rs6000.h
*** rs6000.h	2001/01/23 22:03:46	1.102
--- rs6000.h	2001/02/06 18:56:45
*************** do {									\
*** 2628,2633 ****
--- 2628,2638 ----
  ( (OUTPUT) = (char *) alloca (strlen ((NAME)) + 10),	\
    sprintf ((OUTPUT), "%s.%d", (NAME), (LABELNO)))
  
+ /* Output a reference to SYM on FILE.  */
+ 
+ #define ASM_OUTPUT_SYMBOL_REF(FILE, SYM) \
+   rs6000_output_symbol_ref (FILE, SYM)
+ 
  /* Define the parentheses used to group arithmetic operations
     in assembler code.  */
  

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