[PATCH, take 2] Build java as two separate DLLs on windows.

Dave Korn dave.korn.cygwin@googlemail.com
Wed Sep 9 11:24:00 GMT 2009


Andrew Haley wrote:
> Dave Korn wrote:
>> Andrew Haley wrote:
>>
>>> I had a look, and while it looks OK it seems to be written only for
>>> Windows. That's a shame.  Will it work on GNU/Linux?  Can it be made to?
>>> That would help to keep the facility from bitrotting.
>>   It doesn't quite work on linux.  Builds both the libraries, but then there's
>> some kind of problem caused by the use of ELF visibility when it starts trying
>> to link the tools against them:
> 
>>   I would guess that when the functions were all in one library together they
>> could see each other even if not externally visible, and now they're in
>> separate libraries they can't.  PE targets don't support visibility so it
>> doesn't prevent the functions being imported by libgcj-noncore from libgcj.
>>
>>   Not being a major ELF-head, I don't know what would be the right thing to do
>> about this.  Make them visible?  Is there any way of declaring a "friend library"?
> 
> Maybe just disable the linker script when split into two libraries?  It'd still
> work.

  You mean the version script?  Nope, didn't help any.  The symbols are
already marked hidden in the objects before they get linked anyway, by
hardcoded statements like "DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN;" in
places like build_java_method_aliases(), java_mark_cni_decl_local() and
java_hide_decl().

  What did work, which I tried as an experiment, was commenting out the
definition of HAVE_GAS_HIDDEN in $objdir/gcc/config.h, rebuilding in
$objdir/gcc to rebuild the compiler with no ability to use hidden symbols at
all, then cleaning and remaking in $objdir/$target/libjava.  That got me two
fully-working split .so libraries, and the testsuite ran all the way through
without any failures.

  That's obviously just a crude proof-of-concept.  Would we need to do
something like add a switch to the java compiler to tell it not to use hidden
aliases and use that in the libtool compile flags when building libjava?

    cheers,
      DaveK





More information about the Java-patches mailing list