public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* custom libgcj
@ 2009-04-20 11:41 abhishek desai
  2009-04-20 13:25 ` Bryce McKinlay
  2009-04-21  9:03 ` Bryce McKinlay
  0 siblings, 2 replies; 5+ messages in thread
From: abhishek desai @ 2009-04-20 11:41 UTC (permalink / raw)
  To: java

Hi,

I want to customize libgcj compilation to include only the garbage
collector part and other required files for a simple java program to
compile and execute in native using gcj. Then I want to add my own
java files to libgcj. Is there some way this can be done? Which files
can I edit for this ?
Please advice.

Abhishek.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: custom libgcj
  2009-04-20 11:41 custom libgcj abhishek desai
@ 2009-04-20 13:25 ` Bryce McKinlay
  2009-04-20 13:41   ` Andrew Haley
  2009-04-21  9:03 ` Bryce McKinlay
  1 sibling, 1 reply; 5+ messages in thread
From: Bryce McKinlay @ 2009-04-20 13:25 UTC (permalink / raw)
  To: abhishek desai; +Cc: java

On Mon, Apr 20, 2009 at 12:41 PM, abhishek desai <abhi00@gmail.com> wrote:

> I want to customize libgcj compilation to include only the garbage
> collector part and other required files for a simple java program to
> compile and execute in native using gcj. Then I want to add my own
> java files to libgcj. Is there some way this can be done? Which files
> can I edit for this ?

This would certainly be a very useful feature. Unfortunately, there is
no easy way to do it. You could edit Makefile.am files by hand to
remove classes you don't want, but you're likely to get missing symbol
errors at link time due to the way libgcj is compiled.

One solution would be to compile libgcj with the bc-abi, which results
in the class library being linked more dynamically. There are,
however, some technical challenges that would need to be overcome to
make that happen...

Bryce

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: custom libgcj
  2009-04-20 13:25 ` Bryce McKinlay
@ 2009-04-20 13:41   ` Andrew Haley
  2009-04-20 15:49     ` David Daney
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Haley @ 2009-04-20 13:41 UTC (permalink / raw)
  To: Bryce McKinlay; +Cc: abhishek desai, java

Bryce McKinlay wrote:
> On Mon, Apr 20, 2009 at 12:41 PM, abhishek desai <abhi00@gmail.com> wrote:
> 
>> I want to customize libgcj compilation to include only the garbage
>> collector part and other required files for a simple java program to
>> compile and execute in native using gcj. Then I want to add my own
>> java files to libgcj. Is there some way this can be done? Which files
>> can I edit for this ?
> 
> This would certainly be a very useful feature. Unfortunately, there is
> no easy way to do it. You could edit Makefile.am files by hand to
> remove classes you don't want, but you're likely to get missing symbol
> errors at link time due to the way libgcj is compiled.

I agree.

I think the only way to do it is iterate.

1.  Link app statcially with libgcj and make sure it still works.

2.  Run app with -verbose:class to see what gets used.

3.  Remove stuff that isn't listed in -verbose:class.

4.  Fix link errors.

5.  If that isn't enough, start tracing through -verbose:class and edit
the library source to prune dependencies.

6.  Goto 4...

Andrew.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: custom libgcj
  2009-04-20 13:41   ` Andrew Haley
@ 2009-04-20 15:49     ` David Daney
  0 siblings, 0 replies; 5+ messages in thread
From: David Daney @ 2009-04-20 15:49 UTC (permalink / raw)
  To: Andrew Haley, abhishek desai; +Cc: Bryce McKinlay, java

Andrew Haley wrote:
> Bryce McKinlay wrote:
>> On Mon, Apr 20, 2009 at 12:41 PM, abhishek desai <abhi00@gmail.com> wrote:
>>
>>> I want to customize libgcj compilation to include only the garbage
>>> collector part and other required files for a simple java program to
>>> compile and execute in native using gcj. Then I want to add my own
>>> java files to libgcj. Is there some way this can be done? Which files
>>> can I edit for this ?
>> This would certainly be a very useful feature. Unfortunately, there is
>> no easy way to do it. You could edit Makefile.am files by hand to
>> remove classes you don't want, but you're likely to get missing symbol
>> errors at link time due to the way libgcj is compiled.
> 
> I agree.
> 
> I think the only way to do it is iterate.
> 
> 1.  Link app statcially with libgcj and make sure it still works.
> 
> 2.  Run app with -verbose:class to see what gets used.
> 
> 3.  Remove stuff that isn't listed in -verbose:class.
> 
> 4.  Fix link errors.
> 
> 5.  If that isn't enough, start tracing through -verbose:class and edit
> the library source to prune dependencies.
> 
> 6.  Goto 4...
> 

That's right, unfortunately libgcj has many dependencies that are not 
obvious.  For example (from memory):

All programs have a ClassLoader...

ClassLoader->SecureClassLoader->URLClassLoader->(all known URL Handlers 
including https)->(Most of the crypto code)->(much of the xml 
code),(some javax.swing dialogs for certificate verification)->All of 
javax.swing

On a mips-linux system I was able to with a little work get the static 
image size of HelloWorld.java down to about 9MB (down from about 20MB). 
  To get much smaller than that would take some real work and create a 
library that is not really compatible with the reference implementation.

David Daney

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: custom libgcj
  2009-04-20 11:41 custom libgcj abhishek desai
  2009-04-20 13:25 ` Bryce McKinlay
@ 2009-04-21  9:03 ` Bryce McKinlay
  1 sibling, 0 replies; 5+ messages in thread
From: Bryce McKinlay @ 2009-04-21  9:03 UTC (permalink / raw)
  To: abhishek desai; +Cc: java

On Mon, Apr 20, 2009 at 12:41 PM, abhishek desai <abhi00@gmail.com> wrote:

> I want to customize libgcj compilation to include only the garbage
> collector part and other required files for a simple java program to
> compile and execute in native using gcj. Then I want to add my own
> java files to libgcj. Is there some way this can be done? Which files
> can I edit for this ?

See also micro-libgcj:

http://ulibgcj.sourceforge.net/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-04-21  9:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-20 11:41 custom libgcj abhishek desai
2009-04-20 13:25 ` Bryce McKinlay
2009-04-20 13:41   ` Andrew Haley
2009-04-20 15:49     ` David Daney
2009-04-21  9:03 ` Bryce McKinlay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).