Patch: Fix for PR 2369

Jeff Sturm jsturm@one-point.com
Sat Nov 17 07:39:00 GMT 2001



On Mon, 26 Nov 2001, Bryce McKinlay wrote:
> I don't think this would effect .so compilation. The driver would pass 
> the -fmain option to gcj in basically the same situations that it 
> presently invokes jvgenmain and cc1 to do it (ie when linking an 
> executable). If someone did "gcj Foo.o Bar.o" it would run jc1 
> exclusivly to find main and generate the C main.

With the standalone jvgenmain, I can use tricks like:

[jsturm@waterloo /tmp]$ gcj -shared -fPIC Hello.java -o libHello.so
[jsturm@waterloo /tmp]$ gcj --main=Hello libHello.so -o main
[jsturm@waterloo /tmp]$ ./main
Hello World

Note that jc1 doesn't run in the latter compilation.  This is very handy
if libHello.so contains several entry points, so I can link small stub
executables to launch it from different classes.

Does this work with your proposed -fmain?  Is main() still generated in
a separate object, or combined with the compiled java object?

Jeff



More information about the Gcc-patches mailing list