More questions about _GLOBAL

Adam Megacz
Tue Jan 29 13:34:00 GMT 2002

Anthony Green <> writes:
> > 2. How does the linker know which symbols should be invoked on startup
> >    and which shouldn't? Is "_GLOBAL" a "magic prefix"?

> I can only speak for ELF systems, in which case a list of pointers to
> these functions is placed in a special section, and the linker pulls
> them together into one list which is traversed at program startup.

So the GNU ld knows that .jcr is a "magic" section which should
recieve special handling?

> > 3. Is there any way for me to remove one of these _GLOBAL__ sections
> >    from a .o after compilation, without causing __main() to jump to an
> >    undefined/invalid address? If I simply remove the section (strip
> >    -R), __main() seems to call some other randomly-chosen section
> >    instead, which, of course, causes my program to barf all over the
> >    place.

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

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

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 guess that if _Jv_RegisterClass is responsible for doing the work of
<clinit>, I can't really do this. Crud.

  - a

More information about the Java mailing list