aboutsummaryrefslogtreecommitdiff
path: root/boehm-gc
diff options
context:
space:
mode:
authorJeff Sturm <jsturm@one-point.com>2001-12-17 03:24:50 +0000
committerJeff Sturm <jsturm@gcc.gnu.org>2001-12-17 03:24:50 +0000
commita5b2a65b97966b01b2403e083a0bf49a4e05cf0a (patch)
tree8b76cba31f1da01ca75cbd4757362900e10e882d /boehm-gc
parent8d37a5c0db11afb1c4b6d578ad46d1dfb1213118 (diff)
downloadgcc-a5b2a65b97966b01b2403e083a0bf49a4e05cf0a.zip
gcc-a5b2a65b97966b01b2403e083a0bf49a4e05cf0a.tar.gz
gcc-a5b2a65b97966b01b2403e083a0bf49a4e05cf0a.tar.bz2
dyn_load.c: Define ElfW (if needed) for all targets, not just GNU/Linux.
* 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. From-SVN: r48086
Diffstat (limited to 'boehm-gc')
-rw-r--r--boehm-gc/ChangeLog9
-rw-r--r--boehm-gc/dyn_load.c37
-rw-r--r--boehm-gc/include/private/gcconfig.h2
3 files changed, 29 insertions, 19 deletions
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 24dd511..83e266a 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,12 @@
+2001-12-16 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.
+
2001-12-16 Craig Rodrigues <rodrigc@gcc.gnu.org>
PR other/3725
diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c
index 7dfe667..984253a 100644
--- a/boehm-gc/dyn_load.c
+++ b/boehm-gc/dyn_load.c
@@ -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 ) {
@@ -516,16 +525,6 @@ GC_bool GC_register_dynamic_libraries_dl_iterate_phdr()
# 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()
{
diff --git a/boehm-gc/include/private/gcconfig.h b/boehm-gc/include/private/gcconfig.h
index 4334dbd..75405dc 100644
--- a/boehm-gc/include/private/gcconfig.h
+++ b/boehm-gc/include/private/gcconfig.h
@@ -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