aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce McKinlay <mckinlay@redhat.com>2004-11-02 16:52:55 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2004-11-02 16:52:55 +0000
commit65e9700cc0554d17492c4d28abd1e9bf68454c9a (patch)
tree2665e34b9a62bc5a8c33ebdfd395fabc75b23074
parent571cfa750e5227a8395594d0f30b2244e564ea69 (diff)
downloadgcc-65e9700cc0554d17492c4d28abd1e9bf68454c9a.zip
gcc-65e9700cc0554d17492c4d28abd1e9bf68454c9a.tar.gz
gcc-65e9700cc0554d17492c4d28abd1e9bf68454c9a.tar.bz2
re PR java/17265 (Libjava doesn't build)
2004-11-02 Bryce McKinlay <mckinlay@redhat.com> PR java/17265 * class.c: Reinstate 2004-08-18 patch. (make_local_function_alias): Don't create an alias for extern (native) functions. From-SVN: r89993
-rw-r--r--gcc/java/ChangeLog7
-rw-r--r--gcc/java/class.c50
2 files changed, 56 insertions, 1 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 3691c4b..a0821b0 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,10 @@
+2004-11-02 Bryce McKinlay <mckinlay@redhat.com>
+
+ PR java/17265
+ * class.c: Reinstate 2004-08-18 patch.
+ (make_local_function_alias): Don't create an alias for extern (native)
+ functions.
+
2004-10-22 Eric Botcazou <ebotcazou@libertysurf.fr>
PR java/17265
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 70a3b2b..6e6bded 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1198,6 +1198,53 @@ 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);
+
+ /* Only create aliases for local functions. */
+ if (DECL_EXTERNAL (method))
+ return method;
+
+ /* 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
@@ -1269,7 +1316,8 @@ make_method_value (tree mdecl)
code = null_pointer_node;
if (DECL_RTL_SET_P (mdecl))
- code = build1 (ADDR_EXPR, nativecode_ptr_type_node, mdecl);
+ code = build1 (ADDR_EXPR, nativecode_ptr_type_node,
+ make_local_function_alias (mdecl));
START_RECORD_CONSTRUCTOR (minit, method_type_node);
PUSH_FIELD_VALUE (minit, "name",
build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ?