Reducing static binary size [also: -ffunction-sections, and 'where did Adam go?']

Adam Megacz gcj@lists.megacz.com
Wed Feb 20 10:57:00 GMT 2002


Tom Tromey <tromey@redhat.com> writes:
> Adam Megacz has a script he uses to reduce the size of his program;
> as I recall he made it available in the recent past (within the last
> month or two).

Yeah, it's actually a Java program that does reachability analysis on
the bytecode version of your program, and then spews out a linker
script that will drop the unreachable methods. It also has some hacks
to know what methods inside libgcj are invoked by native methods. I
got HelloWorld down to 133kb gzipped.

Only tested on Win32, but I'll get it working on other platforms
eventually. I don't expect it to be widely usable for a few months
though, so don't hold your breath =)

Speaking of, my stuff requires -ffunction-sections. Since my
suggestion for a --with-jc1-option configure flag sort of fell flat,
what do you all think of making -ffunction-sections the default for
libgcj (just like libstdc++-v3)? It would probably make sense to
enable it on a platform-by-platform basis, as it is tested.

BTW, to the rest of the gcj people: I'm not dead, I just had to take
some time off:

  http://www.megacz.com/1.avi
  http://www.megacz.com/2.avi

I should be back in patchmaking mode in a few days.

  - a

PS, Sorry about the video format, I can't figure out how to turn them
    into MPEGs. Xanim should play them fine, though. If anybody knows
    how to convert them, please let me know.

-- 
"In the dream, someone was asking me 'So what you're saying is that
 all your dreams are lucid?' 'Yes,' I replied 'except for this one.'"
                                                         -- epepke@k5



More information about the Java mailing list