More questions about _GLOBAL

Per Bothner
Tue Jan 29 13:59:00 GMT 2002

Adam Megacz wrote:
> So the GNU ld knows that .jcr is a "magic" section which should
> recieve special handling?

Probably not.  They are all put in a special section to make them
easy to find by runtime-code.  I believe the magic is no different
from other sections, in that the linker makes available symbols
that indicate the start and end of a section.

>>Hmm... I'm not sure I understand what you're asking.  You need these
>>_GLOBAL__ functions to implement static initializers.

As that really the case?  I didn't think so.

> Ugh, so _Jv_RegisterClass calls class initializers (<clinit>'s)?

No.  They just make the class names visible.

> The optimization I'm trying to do is this: if none of a class's
> constructors are reachable, I prune$ from the
> output. Unfortunately, the symbol will call
> _Jv_RegisterClass($), which then SEGV's.

I think this is easiest handled at compile time, rather than
link time.  We could add a flag
This tells the compiler to suppress the _Jv_RegisterClass call for
a class, unless it is one of the ones listed.
	--Per Bothner

More information about the Java mailing list