aboutsummaryrefslogtreecommitdiffstats
path: root/Patches/macppc
blob: c52adc4b9f9cd3b48239a76989b111515e5c8b3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Here is a patch to port GC library to NetBSD/macppc. If you are
using NetBSD on PowerMac, apply this patch first.

This patch is provided by K. Sunagawa (kei_sun@ba2.so-net.ne.jp).

Index: gc/dyn_load.c
===================================================================
RCS file: /cvsroot/w3m/gc/dyn_load.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -u -r1.1.1.2 -r1.2
--- gc/dyn_load.c	1999/06/02 19:29:13	1.1.1.2
+++ gc/dyn_load.c	1999/06/03 12:44:49	1.2
@@ -48,7 +48,8 @@
 #if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
     !defined(MSWIN32) && !(defined(ALPHA) && defined(OSF1)) && \
     !defined(HP_PA) && !(defined(LINUX) && defined(__ELF__)) && \
-    !defined(RS6000) && !defined(SCO_ELF)
+    !defined(RS6000) && !defined(SCO_ELF) && \
+    !(defined(NETBSD) && defined(POWERPC))
  --> We only know how to find data segments of dynamic libraries for the
  --> above.  Additional SVR4 variants might not be too
  --> hard to add.
@@ -260,14 +261,22 @@
 # endif /* !USE_PROC ... */
 # endif /* SUNOS */
 
-#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF)
+#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF) || \
+    (defined(NETBSD) && defined(POWERPC))
 
 /* Dynamic loading code for Linux running ELF. Somewhat tested on
  * Linux/x86, untested but hopefully should work on Linux/Alpha. 
  * This code was derived from the Solaris/ELF support. Thanks to
  * whatever kind soul wrote that.  - Patrick Bridges */
 
+#if defined(NETBSD)
+#include <sys/exec_elf.h>
+#define DT_DEBUG	21
+#define PT_LOAD		1
+#define PF_W		0x2
+#else
 #include <elf.h>
+#endif
 #include <link.h>
 
 /* Newer versions of Linux/Alpha and Linux/x86 define this macro.  We
Index: gc/gcconfig.h
===================================================================
RCS file: /cvsroot/w3m/gc/gcconfig.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -u -r1.1.1.2 -r1.2
--- gc/gcconfig.h	1999/06/02 19:29:18	1.1.1.2
+++ gc/gcconfig.h	1999/06/03 12:44:49	1.2
@@ -48,6 +48,11 @@
 #    define NETBSD
 #    define mach_type_known
 # endif
+# if defined(__NetBSD__) && defined(__powerpc__)
+#    define POWERPC
+#    define NETBSD
+#    define mach_type_known
+# endif
 # if defined(vax)
 #    define VAX
 #    ifdef ultrix
@@ -486,8 +491,8 @@
 
 # ifdef POWERPC
 #   define MACH_TYPE "POWERPC"
-#   define ALIGNMENT 2
 #   ifdef MACOS
+#     define ALIGNMENT 2
 #     ifndef __LOWMEM__
 #     include <LowMem.h>
 #     endif
@@ -497,6 +502,7 @@
 #     define DATAEND  /* not needed */
 #   endif
 #   ifdef LINUX
+#     define ALIGNMENT 2
 #     define OS_TYPE "LINUX"
 #     define HEURISTIC1
 #     undef STACK_GRAN
@@ -504,6 +510,14 @@
 #     define DATASTART GC_data_start
       extern int _end;
 #     define DATAEND (&_end)
+#   endif
+#   ifdef NETBSD
+#     define ALIGNMENT 4
+#     define OS_TYPE "NETBSD"
+#     define HEURISTIC2
+      extern char etext;
+#     define DATASTART GC_data_start
+#     define DYNAMIC_LOADING
 #   endif
 # endif
 
Index: gc/misc.c
===================================================================
RCS file: /cvsroot/w3m/gc/misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -u -r1.1.1.1 -r1.2
--- gc/misc.c	1999/06/02 19:23:56	1.1.1.1
+++ gc/misc.c	1999/06/03 12:44:50	1.2
@@ -433,6 +433,9 @@
 #   if defined(LINUX) && defined(SPARC)
 	GC_init_linuxsparc();
 #   endif
+#   if defined(NETBSD) && defined(POWERPC)
+	GC_init_netbsd_powerpc();
+#   endif
 #   ifdef SOLARIS_THREADS
 	GC_thr_init();
 	/* We need dirty bits in order to find live stack sections.	*/
Index: gc/os_dep.c
===================================================================
RCS file: /cvsroot/w3m/gc/os_dep.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -u -r1.1.1.2 -r1.2
--- gc/os_dep.c	1999/06/02 19:29:10	1.1.1.2
+++ gc/os_dep.c	1999/06/03 12:44:50	1.2
@@ -84,6 +84,19 @@
 #  include <machine/trap.h>
 #endif
 
+#if defined(NETBSD) && defined(POWERPC)
+  ptr_t GC_data_start;
+
+  void GC_init_netbsd_powerpc()
+  {
+    extern ptr_t GC_find_limit();
+    extern char **environ;
+	/* This may need to be environ, without the underscore, for	*/
+	/* some versions.						*/
+    GC_data_start = GC_find_limit((ptr_t)&environ, FALSE);
+  }
+#endif
+
 #ifdef AMIGA
 # include <proto/exec.h>
 # include <proto/dos.h>