More questions about _GLOBAL

Adam Megacz gcj@lists.megacz.com
Tue Jan 29 09:59:00 GMT 2002


More questions about _GLOBAL...
Per Bothner <per@bothner.com> writes:
> Symbols of the _GLOBAL__I__XXX are used for static initializers - i.e.
> code that executed on startup, normally before main is called.

Okay, so let me get this straight: there are a lot of code snippets
called _GLOBAL_*. On startup, __main() is invoked, and calls each of
these snippets. Then my main() is called.
A few questions:
1. Since we don't know which _GLOBAL symbols should be invoked on
 startup until the link phase, does this mean that the linker
 actually generates the code for __main()?
2. How does the linker know which symbols should be invoked on startup
 and which shouldn't? Is "_GLOBAL" a "magic prefix"?
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.
 - a


More information about the Java mailing list

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