section-gc and gcj

Adam Megacz
Thu Jan 3 22:13:00 GMT 2002

Hrm, so I tried to build a vtable gc postprocessor that would take
both a .jar and a pile of .o's, use the .jar (and included .class
files) to figure out which methods were "reachable", and then remove
all unreachables (by stripping their symbols) from the .o, and wrap it
up in to a .a. It works (mostly), and it's a great hack until we have
vtable gc.

Then I found out that stripping a symbol doesn't actually remove the
bytes associated with the symbol from the .o unless the symbol has its
own section, and you're using section-gc in your linker. Argh.



- Do -ffunction-sections and -fdata-sections work with gcj? AFAIK, gcj
  just transforms a Java source file into a C++ abstract syntax tree,
  then throws it over the fence to the C++ backend, which is why CNI
  works so well (you're just skipping over the Java-to-C++
  transform). So stuff like this ought to "just work"...

- If the above works, and I manually strip the symbols of functions I
  know I won't use, and I enable section-gc in the linker, will the
  linker properly drop such functions?

- (kinda OT) does anybody know if the latest mingw ld offers
  section-gc? If not, I guess I can include manual removal of sections
  in addition to stripping symbols... the hard part is achieving


  - a

More information about the Java mailing list