This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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: [PATCH] Make java compiled resources public.


David Daney writes:
 > This patch makes java compiled resources public symbols.  This is needed
 > so that when statically linking to libgcj, the resource files in
 > libgcj.a can be linked by passing -u to the linker.  In 4.2 we could
 > statically link java.util.Currency, but in 4.3 this class now depends on
 > an compiled core:/ resource file.  Without this patch it is impossible
 > (or at least very awkward) to force the resource file to be linked.
 > 
 > There are two changes:  The first is to generate a name for the resource
 > that is a mangled version of the resource name.  Second, make the
 > resource names public.  This allows us to force the resource to be
 > linked by referring to the symbol from either the linker command line or
 > some other object that is being linked.
 > 
 > The mangling is as follows:
 > 
 > The resource name is broken into path components by '/' characters. Each
 > component then has an '_' prepended and all '.' -> "$_" and '$' ->
 > "$$".  The length of each component is then prepended to this and all
 > are concatenated together and preceeded by "_ZGr".  "Gr" being an unused
 > special-name designator that could be thought of as representing
 > GNU-resource.  For example:
 > 
 > "java/util/iso4217.properties" mangles as:
 > "_ZGr5_java5_util20_iso4217$_properties"
 > 
 > These symbols seem to pass through the demangler unaffected (GNU nm
 > 2.17.50.0.6-5.fc6 20061020 from FC6).
 > 
 > If the patch is accepted, I will follow up with a demangler patch that
 > handles this new mangling.
 > 
 > Tested on x86_64-pc-linux-gnu with bootstrap and make check in libjava
 > with no FAILures.
 > 
 > OK to commit?

Before you commit this please run it past a binutils maintainer such
as Ian Taylor (and post to the binutils list too) to make sure we
don't conflict with other mangling schemes.

It might be a good idea to submit the demangler patch first, get that
in binutils, then use the new magling here in gcj.

I presume that by using append_gpp_mangled_name() you avoid the
situation where an illegal character in a resource name might leak
into the assembly source, so that's OK.

Andrew.

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903


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