summaryrefslogtreecommitdiff
path: root/libjava/darwin.cc
diff options
context:
space:
mode:
authorgeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-26 06:09:05 +0000
committergeoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-26 06:09:05 +0000
commit1dc74225ea88dfb3a14f88dd7a47741c5bafff01 (patch)
tree55b7af27d9c57fd804dcf7cea7736d928a9d995d /libjava/darwin.cc
parentd2f8c862f10fdad2340bbe9d31c2a1c3a41da2cd (diff)
downloadgcc-1dc74225ea88dfb3a14f88dd7a47741c5bafff01.tar.gz
Index: gcc/gcc/ChangeLog
2004-10-25 Geoffrey Keating <geoffk@apple.com> * config/darwin.h (LINK_SPEC): Default weak_reference_mismatches to 'non-weak'. (MAKE_DECL_ONE_ONLY): Set DECL_WEAK. (ASM_MAKE_LABEL_LINKONCE): Delete. (ASM_WEAKEN_DECL): New. (ASM_DECLARE_OBJECT_NAME): Look at DECL_WEAK not DECL_ONE_ONLY. (ASM_DECLARE_FUNCTION_NAME): Likewise. (TEXT_SECTION_ASM_OP): Add a tab. (DATA_SECTION_ASM_OP): Likewise. (SECTION_FUNCTION): Add a tab. Use fputs. Don't call data_section on every section change. (EXTRA_SECTIONS): Add a bunch of new extra sections. (EXTRA_SECTION_FUNCTIONS): Likewise. (USE_SELECT_SECTION_FOR_FUNCTIONS): Define. (JCR_SECTION_NAME): Define. (TARGET_SECTION_TYPE_FLAGS): Don't define. * config/darwin.c (darwin_encode_section_info): A symbol is defined in this file if it is not weak. (textcoal_section): Delete. (datacoal_section): Delete. (darwin_make_decl_one_only): Delete. (machopic_select_section): Handle functions. (darwin_asm_named_section): Add a tab. (darwin_section_type_flags): Delete. (darwin_unique_section): Delete contents. (darwin_emit_unwind_label): Add a tab. Make decls weak if DECL_WEAK is set. * config/darwin-protos.h (darwin_section_type_flags): Delete. (darwin_make_decl_one_only): Delete. (text_coal_section): New. (text_unlikely_section): New. (text_unlikely_coal_section): New. (const_coal_section): New. (data_coal_section): New. (const_data_coal_section): New. * varasm.c (function_section): Honour USE_SELECT_SECTION_FOR_FUNCTIONS. * dwarf2out.c (output_call_frame_info): Look at DECL_WEAK when TARGET_USES_WEAK_UNWIND_INFO is in effect. * dbxout.c (dbxout_source_file): Don't change sections while a function is being output. Index: gcc/testsuite/ChangeLog 2004-10-25 Geoffrey Keating <geoffk@apple.com> * objc.dg/image-info.m: Update for changes to section selection. Index: libjava/ChangeLog 2004-10-25 Geoffrey Keating <geoffk@apple.com> * Makefile.am (DARWIN_CRT_SRC): New. (libgcj_la_SOURCES): Use it. * configure.ac: Define USING_DARWIN_CRT when on Darwin. * darwin.cc: New file. * include/jvm.h (_Jv_RegisterClasses): Constify. (_Jv_RegisterClasses_Counted): New prototype. * java/lang/Class.h: Include stddef.h. (_Jv_RegisterClasses): Constify. (_Jv_RegisterClasses_Counted): New prototype. (Object): Make '_Jv_RegisterClasses_Counted' a friend. * java/lang/natClassLoader.cc (_Jv_RegisterClasses): Constify. (_Jv_RegisterClasses_Counted): New function. * configure: Regenerate. * Makefile.in: Regenerate. * gcj/Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. Index: libstdc++-v3/ChangeLog 2004-10-25 Geoffrey Keating <geoffk@apple.com> * libsupc++/new_op.cc (new): Make weak. * libsupc++/new_opnt.cc (new): Make weak. * libsupc++/new_opv.cc (new): Make weak. * libsupc++/new_opvnt.cc (new): Make weak. * libsupc++/delete_op.cc (delete): Make weak. * libsupc++/delete_opnt.cc (delete): Make weak. * libsupc++/delete_opv.cc (delete): Make weak. * libsupc++/delete_opvnt.cc (delete): Make weak. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89572 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/darwin.cc')
-rw-r--r--libjava/darwin.cc63
1 files changed, 63 insertions, 0 deletions
diff --git a/libjava/darwin.cc b/libjava/darwin.cc
new file mode 100644
index 00000000000..d427ba7cd19
--- /dev/null
+++ b/libjava/darwin.cc
@@ -0,0 +1,63 @@
+/* darwin.cc - class loader stuff for Darwin. */
+
+/* Copyright (C) 2004 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+
+#include <jvm.h>
+
+/* In theory, we should be able to do:
+ #include <mach-o/getsect.h>
+ #include <mach-o/dyld.h>
+
+ but all the types in these headers changed between Panther and Tiger,
+ so the only way to be avoid type mismatches is to declare the routines
+ ourself. */
+
+#include <stdint.h>
+struct mach_header;
+extern "C" void _dyld_register_func_for_add_image
+ (void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide));
+extern "C" void _dyld_register_func_for_remove_image
+ (void (*func)(const struct mach_header *mh, intptr_t vmaddr_slide));
+extern "C" char *getsectdatafromheader
+(const struct mach_header *mhp, const char *segname, const char *sectname,
+ uint32_t *size);
+
+/* When a new image is loaded, look to see if it has a jcr section
+ and if so register the classes listed in it. */
+
+static void
+darwin_java_register_dyld_add_image_hook (const struct mach_header *mh,
+ intptr_t slide)
+{
+ char *fde;
+ uint32_t sz;
+
+ fde = getsectdatafromheader (mh, "__DATA", "jcr", &sz);
+ if (! fde)
+ return;
+
+ /* 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 *));
+}
+
+static struct darwin_constructor_s{
+ darwin_constructor_s()
+ {
+ _dyld_register_func_for_add_image
+ (darwin_java_register_dyld_add_image_hook);
+ /* At present, you mustn't unload any java plugin. */
+ };
+} darwin_constructor;