Skip to content

Commit

Permalink
PR libgcj/49451
Browse files Browse the repository at this point in the history
	* 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
  • Loading branch information
ro committed Jun 29, 2011
1 parent 7b07f8e commit a3a3fd0
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 7 deletions.
19 changes: 19 additions & 0 deletions boehm-gc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2011-06-29 Rainer Orth <[email protected]>

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 <[email protected]>

* configure.ac (THREADS): Remove decosf1, irix, mach, os2.
Expand Down
77 changes: 70 additions & 7 deletions boehm-gc/dyn_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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:
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions boehm-gc/include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a3a3fd0

Please sign in to comment.