More questions about _GLOBAL

Per Bothner per@bothner.com
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 foo.bar.baz.class$ from the
> output. Unfortunately, the __GLOBAL_foo.bar.baz symbol will call
> _Jv_RegisterClass(foo.bar.baz.class$), which then SEGV's.

I think this is easiest handled at compile time, rather than
link time. We could add a flag
 --forname-findable=CLASSX,CLASSY,...
This tells the compiler to suppress the _Jv_RegisterClass call for
a class, unless it is one of the ones listed.
-- 
	--Per Bothner
per@bothner.com http://www.bothner.com/per/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /