This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

[PATCH] Fix PR java/17265


Hi,

This patch reverts

2004-08-18  Bryce McKinlay  <mckinlay@redhat.com>

        * class.c (make_local_function_alias): New function. Create local
        alias for public method DECL.
        (make_method_value): Use make_local_function_alias.

which breaks the GCJ compiler with non-GNU assemblers.  The problem is that it 
instructs the compiler to create local aliases of external functions.

Quoting comment #6 from RTH: "Note that while this construct is *accepted* by 
gas, it won't do what you might think it would.  It does nothing useful.  
I've wished in the past that gas would diagnose this problem..."

Built on sparc64-sun-solaris2.9 and sparc-sun-solaris2.8, built and tested on 
amd64-mandrake-linux-gnu.  OK for mainline?


2004-10-22 ?Eric Botcazou ?<ebotcazou@libertysurf.fr>

	PR java/17265
	* class.c (make_local_function_alias): Revert 2004-08-18 change.
	(make_method_value): Likewise.


-- 
Eric Botcazou
Index: class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.211
diff -u -p -r1.211 class.c
--- class.c	17 Oct 2004 22:51:35 -0000	1.211
+++ class.c	22 Oct 2004 07:16:03 -0000
@@ -1198,48 +1198,6 @@ get_access_flags_from_decl (tree decl)
   abort ();
 }
 
-static GTY (()) int alias_labelno = 0;
-
-/* Create a private alias for METHOD. Using this alias instead of the method
-   decl ensures that ncode entries in the method table point to the real function 
-   at runtime, not a PLT entry.  */
-
-static tree
-make_local_function_alias (tree method)
-{
-#ifdef ASM_OUTPUT_DEF
-  tree alias;
-  const char *method_name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (method));
-  char *name = alloca (strlen (method_name) + 2);
-  char *buf = alloca (strlen (method_name) + 128);
-  
-  /* Prefix method_name with 'L' for the alias label.  */
-  *name = 'L';
-  strcpy (name + 1, method_name);
-
-  ASM_GENERATE_INTERNAL_LABEL (buf, name, alias_labelno++);  
-  alias = build_decl (FUNCTION_DECL, get_identifier (buf),
-		      TREE_TYPE (method));
-  DECL_CONTEXT (alias) = NULL;
-  TREE_READONLY (alias) = TREE_READONLY (method);
-  TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (method);
-  TREE_PUBLIC (alias) = 0;
-  DECL_EXTERNAL (alias) = 0;
-  DECL_ARTIFICIAL (alias) = 1;
-  DECL_INLINE (alias) = 0;
-  DECL_INITIAL (alias) = error_mark_node;
-  TREE_ADDRESSABLE (alias) = 1;
-  TREE_USED (alias) = 1;
-  SET_DECL_ASSEMBLER_NAME (alias, DECL_NAME (alias));
-  TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias)) = 1;
-  if (!flag_syntax_only)
-    assemble_alias (alias, DECL_ASSEMBLER_NAME (method));
-  return alias;
-#else
-  return method;
-#endif
-}
-
 /** Make reflection data (_Jv_Field) for field FDECL. */
 
 static tree
@@ -1311,8 +1269,7 @@ make_method_value (tree mdecl)
 
   code = null_pointer_node;
   if (DECL_RTL_SET_P (mdecl))
-    code = build1 (ADDR_EXPR, nativecode_ptr_type_node, 
-		   make_local_function_alias (mdecl));
+    code = build1 (ADDR_EXPR, nativecode_ptr_type_node, mdecl);
   START_RECORD_CONSTRUCTOR (minit, method_type_node);
   PUSH_FIELD_VALUE (minit, "name",
 		    build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ?

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