This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Java Patches: -fno-org-xml-sax and -fno-org-w3c-dom


Anthony Green wrote:

I like these two libraries, because if you don't add them at link time
libgcj will still be able to find them at runtime via Class.forName().
That's a good reason.

>This is not OK, IMO.  It's a bad precedent.  We can't keep
>adding random flags for specific packages.

Oh - I thought you had recently agreed to something like this on the
java list.
Then I must have been unclear.  I've had and expressed the "vision"
below for quite a while.

Well, what would you propose then?  Newer versions of Xerces (and
Tomcat, Xalan, etc) are unbuildable right now, so I would like to fix
this quickly.  Perhaps the simplest thing is to do what Jeff suggests
and never link these by default.
I think that is an acceptable short-term solution.

The "correct" solution (assuming we come to consensus that this is
a good idea):

* When the compiler emits a reference to a class that it found in a
jar in an extension directory, it remembers the name of the jar.
(If "emits a reference" is difficult to implement, then alternatively
"resolves a classname to a class in the jar" is ok.)  This should
not be difficult to implement.

* At the end of the compilation, it mangles the jar file name
(without the directory) to a linker library name.  So
"org-xml-sax.jar" becomes "-lorg-xml-sax" or whatever.  This
gets emitted in a special ELF section.  (I don't care about
non-ELF targets for this feature.)  This is also easy to
implement.

* The linker reads the special ELF sections of the linked files,
and addes the linker library names as implicit libraries to search.
(When building a shared library, it combines the lists.)

The last part is the hard part.  However, I have a feeling that
ELF linkers may already support this feature - it is certainly a
very nice feature, not just for Java.  (I know there are hooks to
remember -R flags in executables, which is a related concept.)
Could you discuss this with some linker/ELF experts either at
Red Hat or on the binutils mailing list?

I have two goals, which this satisfies:
(1) Don't have to specify any flags or paths for classes found in
the default locations.
(2) If an explicit path is used to override the default extension
jars, that should also override the searched shared libraries.
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]