This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

More questions about _GLOBAL



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]