This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: [4.1 Regression]: java compiler generates wrong code on ia64
On Mon, Apr 18, 2005 at 03:03:02PM -0400, Bryce McKinlay wrote:
> H. J. Lu wrote:
>
> >>The function pointers in the GCJ method metadata (_Jv_Method) are always
> >>local, except in the case of CNI functions. But, even local function
> >>references in a .so will point at PLT entries if the function is also
> >>referenced from the main binary.
> >>
> >>
> >
> >Whan you said "local function", did you mean
> >
> >1. A local data variable with function type. Or
> >2. A function symbol which isn't visible to the outside. Or
> >3. A global data variable with function type pointing to a local
> >function.
> >
> >I ran into a very tricky issue. But I don't have a testcase. This
> >problem may be related.
> >
> >
> I mean "a reference to a function which is public (visible to the
> outside) and defined within the same compilation unit"
That makes senses now. For me, "local function" means a different
thing :-). If you want to know if a function will be bound locally
at the run time, you should use targetm.binds_local_p. I think this
patch is correct.
H.J.
---
2005-04-18 H.J. Lu <hongjiu.lu@intel.com>
PR java/21070
* class.c (make_local_function_alias): Use targetm.binds_local_p
to check if a function is bound locally.
--- gcc/java/class.c.linkonce 2005-04-08 10:25:40.000000000 -0700
+++ gcc/java/class.c 2005-04-18 12:12:27.000000000 -0700
@@ -1204,8 +1204,8 @@ make_local_function_alias (tree 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))
+ /* Only create aliases for locally bound functions. */
+ if (!targetm.binds_local_p (decl))
return method;
/* Prefix method_name with 'L' for the alias label. */