This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
boehm-gc: handle sparcv9
- From: Jeff Sturm <jsturm at one-point dot com>
- To: java-patches at gcc dot gnu dot org
- Cc: hans_boehm at hp dot com
- Date: Sun, 9 Dec 2001 23:41:12 -0500 (EST)
- Subject: boehm-gc: handle sparcv9
This adds support for 64-bit dynamic loading on Solaris. Tested on
sparcv9-sun-solaris2.7.
2001-12-09 Jeff Sturm <jsturm@one-point.com>
* dyn_load.c: Define ElfW (if needed) for all targets,
not just GNU/Linux.
(GC_FirstDLOpenedLinkMap): Use it.
(GC_register_dynamic_libraries_dl): Use it.
* include/private/gcconfig.h: Define CPP_WORDSZ, ELF_CLASS
for sparcv9.
Index: dyn_load.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/dyn_load.c,v
retrieving revision 1.13
diff -u -p -r1.13 dyn_load.c
--- dyn_load.c 2001/10/16 09:01:35 1.13
+++ dyn_load.c 2001/12/10 04:23:44
@@ -79,6 +79,15 @@
# define l_name lm_name
#endif
+/* Newer versions of GNU/Linux define this macro. We
+ * define it similarly for any ELF systems that don't. */
+# ifndef ElfW
+# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
+# define ElfW(type) Elf32_##type
+# else
+# define ElfW(type) Elf64_##type
+# endif
+# endif
#if defined(SUNOS5DL) && !defined(USE_PROC_FOR_LIBRARIES)
@@ -89,11 +98,11 @@
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
- extern Elf32_Dyn _DYNAMIC;
- Elf32_Dyn *dp;
+ extern ElfW(Dyn) _DYNAMIC;
+ ElfW(Dyn) *dp;
struct r_debug *r;
static struct link_map * cachedResult = 0;
- static Elf32_Dyn *dynStructureAddr = 0;
+ static ElfW(Dyn) *dynStructureAddr = 0;
/* BTL: added to avoid Solaris 5.3 ld.so _DYNAMIC bug */
# ifdef SUNOS53_SHARED_LIB
@@ -103,7 +112,7 @@ GC_FirstDLOpenedLinkMap()
/* at program startup. */
if( dynStructureAddr == 0 ) {
void* startupSyms = dlopen(0, RTLD_LAZY);
- dynStructureAddr = (Elf32_Dyn*)dlsym(startupSyms, "_DYNAMIC");
+ dynStructureAddr = (ElfW(Dyn)*)dlsym(startupSyms, "_DYNAMIC");
}
# else
dynStructureAddr = &_DYNAMIC;
@@ -114,7 +123,7 @@ GC_FirstDLOpenedLinkMap()
}
if( cachedResult == 0 ) {
int tag;
- for( dp = ((Elf32_Dyn *)(&_DYNAMIC)); (tag = dp->d_tag) != 0; dp++ ) {
+ for( dp = ((ElfW(Dyn) *)(&_DYNAMIC)); (tag = dp->d_tag) != 0; dp++ ) {
if( tag == DT_DEBUG ) {
struct link_map *lm
= ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
@@ -200,14 +209,14 @@ void GC_register_dynamic_libraries()
TRUE);
# endif
# ifdef SUNOS5DL
- Elf32_Ehdr * e;
- Elf32_Phdr * p;
+ ElfW(Ehdr) * e;
+ ElfW(Phdr) * p;
unsigned long offset;
char * start;
register int i;
- e = (Elf32_Ehdr *) lm->l_addr;
- p = ((Elf32_Phdr *)(((char *)(e)) + e->e_phoff));
+ e = (ElfW(Ehdr) *) lm->l_addr;
+ p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
switch( p->p_type ) {
@@ -515,16 +524,6 @@ GC_bool GC_register_dynamic_libraries_dl
#include <link.h>
# endif
-
-/* Newer versions of Linux/Alpha and Linux/x86 define this macro. We
- * define it for those older versions that don't. */
-# ifndef ElfW
-# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
-# define ElfW(type) Elf32_##type
-# else
-# define ElfW(type) Elf64_##type
-# endif
-# endif
static struct link_map *
GC_FirstDLOpenedLinkMap()
Index: include/private/gcconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/include/private/gcconfig.h,v
retrieving revision 1.7
diff -u -p -r1.7 gcconfig.h
--- gcconfig.h 2001/10/17 04:55:30 1.7
+++ gcconfig.h 2001/12/10 04:23:45
@@ -715,6 +715,8 @@
# define MACH_TYPE "SPARC"
# if defined(__arch64__) || defined(__sparcv9)
# define ALIGNMENT 8
+# define CPP_WORDSZ 64
+# define ELF_CLASS ELFCLASS64
# else
# define ALIGNMENT 4 /* Required by hardware */
# endif