This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: enable static libgcj on darwin
On 12/27/06, Adam Megacz <megacz@cs.berkeley.edu> wrote:
Andrew Pinski <pinskia@physics.uc.edu> writes:
>> Since darwin doesn't have a crtbegin.o/crtend.o (gcc only supports
>> this for COFF and ELF), the jcr section doesn't really work. Until
>> there is support for Mach-O in crtbegin/end, we need to fall back to
>> alternative methods of getting classes registered.
> This is wrong. Darwin does have support for JCR sections.
It has JCR sections. What it does not have is all the other stuff
needed to make them useful. See gcc/crtstuff.c, which is COFF/ELF-only.
> See libjava/darwin.cc which is used to support for JCR sections.
That is only a tiny portion of the functionality needed to make JCR
sections work properly. The rest is missing.
Like? Look again,
crtstuff does:
if (__JCR_LIST__[0])
{
void (*register_classes) (void *) = _Jv_RegisterClasses;
__asm ("" : "+r" (register_classes));
if (register_classes)
register_classes (__JCR_LIST__);
}
#ifdef JCR_SECTION_NAME
if (__JCR_LIST__[0])
{
void (*register_classes) (void *) = _Jv_RegisterClasses;
__asm ("" : "+r" (register_classes));
if (register_classes)
register_classes (__JCR_LIST__);
}
#endif
While libjava/darwin.cc does:
/* As far as I can tell, you're only supposed to load shared
libraries while having a lock on java.lang.Class. So there's
no need to synchronize on anything here. (I'm not sure how exactly
you can ensure this given lazy library loading. FIXME.) */
_Jv_RegisterClasses_Counted ((const jclass *) (fde + slide),
sz / sizeof (jclass *));
So what rest is missing? You still have not said what is really missing?
darwin_java_register_dyld_add_image_hook is invoke every time a
dynamic library is loaded (or really added). So I don't see what the
problem is still.
-- Pinski