summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorro@138bc75d-0d04-0410-961f-82ee72b054a4 <ro@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-29 08:19:08 +0000
committerguest <ivmai@mail.ru>2011-07-29 10:54:30 +0400
commit9f6ae6b3c19f65d21757269676bf44170bd6c945 (patch)
treeb8d6345c3e1f114e91ecbf99d7a604a2f9bab27f
parent8295a10cb71cd28f312170cc73408b949d592f81 (diff)
downloadbdwgc-9f6ae6b3c19f65d21757269676bf44170bd6c945.tar.gz
PR libgcj/49451
* include/private/gcconfig.h [IRIX5 && _MIPS_SZPTR == 64] (ELF_CLASS): Define. * dyn_load.c [IRIX5]: Include <elf.h>. Include <obj.h> for O32, <objlist.h> for N32, N64. [SUNOS5DL && USE_PROC_FOR_LIBRARIES] (obj_offset): Define. [SUNOS4 && USE_PROC_FOR_LIBRARIES] (obj_offset): Define. [IRIX5 && !USE_PROC_FOR_LIBRARIES] (struct link_map): Define. (__rld_obj_head): Declare. (l_next, l_addr, obj_offset): Define. (GC_FirstDLOpenedLinkMap): New function. [SUNOS4 || SUNOS5DL] (GC_register_dynamic_libraries): Also use on IRIX5. Use obj_offset. [IRIX5 || (USE_PROC_FOR_LIBRARIES && !LINUX] (GC_register_dynamic_libraries): Don't use /proc version on IRIX5. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175623 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog19
-rw-r--r--dyn_load.c77
-rw-r--r--include/private/gcconfig.h3
3 files changed, 92 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 24b5fa7e..d08acc01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2011-06-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR libgcj/49451
+ * include/private/gcconfig.h [IRIX5 && _MIPS_SZPTR == 64]
+ (ELF_CLASS): Define.
+ * dyn_load.c [IRIX5]: Include <elf.h>.
+ Include <obj.h> for O32, <objlist.h> for N32, N64.
+ [SUNOS5DL && USE_PROC_FOR_LIBRARIES] (obj_offset): Define.
+ [SUNOS4 && USE_PROC_FOR_LIBRARIES] (obj_offset): Define.
+ [IRIX5 && !USE_PROC_FOR_LIBRARIES] (struct link_map): Define.
+ (__rld_obj_head): Declare.
+ (l_next, l_addr, obj_offset): Define.
+ (GC_FirstDLOpenedLinkMap): New function.
+ [SUNOS4 || SUNOS5DL] (GC_register_dynamic_libraries): Also use on
+ IRIX5.
+ Use obj_offset.
+ [IRIX5 || (USE_PROC_FOR_LIBRARIES && !LINUX]
+ (GC_register_dynamic_libraries): Don't use /proc version on IRIX5.
+
2011-04-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (THREADS): Remove decosf1, irix, mach, os2.
diff --git a/dyn_load.c b/dyn_load.c
index 4bfa56ca..f1e3e8ec 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -82,6 +82,15 @@
# define l_addr lm_addr
# define l_name lm_name
#endif
+#ifdef IRIX5
+# include <elf.h>
+# if _MIPS_SIM == _MIPS_SIM_ABI32 /* O32 ABI */
+ /* Don't include <obj_list.h> here. */
+# include <obj.h>
+# else /* N32 or N64 ABIs */
+# include <objlist.h>
+# endif
+#endif
#if defined(NETBSD)
# include <machine/elf_machdep.h>
@@ -139,6 +148,8 @@ GC_register_has_static_roots_callback
Elf32_Dyn _DYNAMIC;
#endif
+#define obj_offset(lm) ((unsigned long)(lm->l_addr))
+
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
@@ -192,6 +203,8 @@ GC_FirstDLOpenedLinkMap()
struct link_dynamic _DYNAMIC;
#endif
+#define obj_offset(lm) ((unsigned long)(lm->l_addr))
+
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
@@ -226,9 +239,59 @@ static ptr_t GC_first_common()
#endif /* SUNOS4 ... */
-# if defined(SUNOS4) || defined(SUNOS5DL)
+#if defined(IRIX5) && !defined(USE_PROC_FOR_LIBRARIES)
+
+/* Provide struct link map. */
+# if _MIPS_SIM == _MIPS_SIM_ABI32 /* O32 ABI */
+/* Provide our own version of struct obj_list in <obj_list.h> with
+ correctly typed data member. */
+struct obj_list {
+ struct obj *data;
+ struct obj_list *next;
+ struct obj_list *prev;
+} objList;
+
+struct link_map {
+ objList l_ol;
+};
+
+extern objList *__rld_obj_head;
+
+/* Map field names */
+# define l_next l_ol.next
+# define l_addr l_ol.data->o_pelfhdr
+
+# define obj_offset(lm) \
+ ((unsigned long)(lm->l_ol.o_praw - (char *)lm->l_ol.o_base_address))
+# else /* N32 or N64 ABIs */
+struct link_map {
+ ElfW(Obj_Info) l_oi;
+};
+
+extern ElfW(Obj_Info) *__rld_obj_head;
+
+/* Map field names */
+# define l_next l_oi.oi_next
+# define l_addr l_oi.oi_ehdr
+
+/* See gdb/solib-irix.c (fetch_lm_info). */
+# define obj_offset(lm) \
+ ((unsigned long)(lm->l_oi.oi_ehdr - lm->l_oi.oi_orig_ehdr))
+# endif
+
+static struct link_map *
+GC_FirstDLOpenedLinkMap()
+{
+ return (struct link_map *)__rld_obj_head;
+}
+
+#endif /* IRIX5 ... */
+
+# if defined(SUNOS4) || defined(SUNOS5DL) || defined(IRIX5)
/* Add dynamic library data sections to the root set. */
-# if !defined(PCR) && !defined(GC_SOLARIS_PTHREADS) && defined(THREADS)
+# if !defined(PCR) \
+ && !defined(GC_SOLARIS_PTHREADS) && !defined(GC_IRIX_THREADS) \
+ && defined(THREADS)
# ifndef SRC_M3
--> fix mutual exclusion with dlopen
# endif /* We assume M3 programs don't call dlopen for now */
@@ -241,7 +304,7 @@ void GC_register_dynamic_libraries()
for (lm = GC_FirstDLOpenedLinkMap();
- lm != (struct link_map *) 0; lm = lm->l_next)
+ lm != (struct link_map *) 0; lm = (struct link_map *) lm->l_next)
{
# ifdef SUNOS4
struct exec *e;
@@ -252,7 +315,7 @@ void GC_register_dynamic_libraries()
((char *) (N_BSSADDR(*e) + e->a_bss + lm->lm_addr)),
TRUE);
# endif
-# ifdef SUNOS5DL
+# if defined(SUNOS5DL) || defined(IRIX5)
ElfW(Ehdr) * e;
ElfW(Phdr) * p;
unsigned long offset;
@@ -261,7 +324,7 @@ void GC_register_dynamic_libraries()
e = (ElfW(Ehdr) *) lm->l_addr;
p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
- offset = ((unsigned long)(lm->l_addr));
+ offset = obj_offset(lm);
for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
switch( p->p_type ) {
case PT_LOAD:
@@ -589,7 +652,7 @@ void GC_register_dynamic_libraries()
#endif /* LINUX */
-#if defined(IRIX5) || (defined(USE_PROC_FOR_LIBRARIES) && !defined(LINUX))
+#if defined(USE_PROC_FOR_LIBRARIES) && !defined(LINUX)
#include <sys/procfs.h>
#include <sys/stat.h>
@@ -718,7 +781,7 @@ void GC_register_dynamic_libraries()
fd = -1;
}
-# endif /* USE_PROC || IRIX5 */
+# endif /* USE_PROC */
# if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index c729130c..25fff6e7 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -1445,6 +1445,9 @@
# if CPP_WORDSZ != 64
# define ALIGN_DOUBLE
# endif
+# if _MIPS_SZPTR == 64
+# define ELF_CLASS ELFCLASS64
+# endif
# else
# define ALIGNMENT 4
# define ALIGN_DOUBLE