This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
SV: Pruning libgcj
- From: Øyvind Harboe <oyvind dot harboe at zylin dot com>
- To: "Andrew Haley" <aph at redhat dot com>
- Cc: <java at gcc dot gnu dot org>
- Date: Thu, 27 Feb 2003 15:58:06 +0100
- Subject: SV: Pruning libgcj
> > How can GCJ not to link with libgcj?
> >
> > I was toying with the idea of using something like jclassinfo from sourceforge to list all the
> > class files required starting at --main and then compiling only those. I'm expecting that
> > this should discover almost all the classes required for the build.
>
>It won't.
>
>The linker already only links in classes for which there is a direct
>reference in your program or libgcj startup. If you use the command
>-Wl,-Map,myprog.map command while building your program you'll see how
>this works.
Ah. I see. I could use this trick for my app. I have serveral large .jars
for which I only use a subset for the native parts, currently the entire .jars
are linked into the executable.
Here is a demonstration of size savings when applied to Mohans HelloSWT
gcj -s -o HelloSWT.exe -fjni --main=HelloSWT swt_noawt.jar HelloSWT.java
->
helloswt.exe 3,5MB
\thisiscool-gcc\gcc-3.3\bin\gcj -s -o HelloSWT2.exe -fjni --main=HelloSWT --classpath=swt.jar HelloSWT.java -lswt
helloswt.exe 2,7MB
Øyvind