0a3e651e25286ce9444c2929fced2f50abe568cb
[org.ibex.core.git] / upstream / darwin-linker / patches / cctools.patch
1 diff -rub ./include/architecture/i386/fpu.h ./include/architecture/i386/fpu.h
2 --- ./include/architecture/i386/fpu.h   Thu May  6 19:24:30 1999
3 +++ ./include/architecture/i386/fpu.h   Mon Aug 25 12:56:22 2003
4 @@ -121,7 +121,7 @@
5                                         :3;
6  } fp_control_t;
7  
8 -#import <architecture/i386/sel.h>
9 +#include <architecture/i386/sel.h>
10  
11  /*
12   * Floating point 'environment'
13 diff -rub ./include/architecture/i386/frame.h ./include/architecture/i386/frame.h
14 --- ./include/architecture/i386/frame.h Thu May  6 19:24:33 1999
15 +++ ./include/architecture/i386/frame.h Mon Aug 25 12:56:22 2003
16 @@ -63,7 +63,7 @@
17      } pgfault;
18  } err_code_t;
19  
20 -#import <architecture/i386/sel.h>
21 +#include <architecture/i386/sel.h>
22  
23  /*
24   * The actual hardware exception frame
25 diff -rub ./include/architecture/m88k/fp_regs.h ./include/architecture/m88k/fp_regs.h
26 --- ./include/architecture/m88k/fp_regs.h       Wed Oct  9 18:47:37 2002
27 +++ ./include/architecture/m88k/fp_regs.h       Mon Aug 25 12:56:22 2003
28 @@ -37,7 +37,7 @@
29  #ifndef        _ARCH_M88K_FP_REGS_H_
30  #define        _ARCH_M88K_FP_REGS_H_
31  
32 -#import <architecture/m88k/reg_help.h>
33 +#include <architecture/m88k/reg_help.h>
34  
35  /*
36   * m88k_xrf_t -- data types that MAY be in extended register file
37 diff -rub ./include/architecture/m88k/reg_help.h ./include/architecture/m88k/reg_help.h
38 --- ./include/architecture/m88k/reg_help.h      Wed Oct  9 18:47:39 2002
39 +++ ./include/architecture/m88k/reg_help.h      Mon Aug 25 12:56:22 2003
40 @@ -37,7 +37,7 @@
41  #ifndef _ARCH_M88K_REG_HELP_H_
42  #define _ARCH_M88K_REG_HELP_H_
43  
44 -#import <architecture/nrw/reg_help.h>
45 +#include <architecture/nrw/reg_help.h>
46  
47  /* Stack pointer must always be a multiple of 16 */
48  #define        STACK_INCR      16
49 diff -rub ./include/mach/m88k/thread_status.h ./include/mach/m88k/thread_status.h
50 --- ./include/mach/m88k/thread_status.h Wed Oct  9 18:48:16 2002
51 +++ ./include/mach/m88k/thread_status.h Mon Aug 25 12:56:22 2003
52 @@ -45,8 +45,8 @@
53  #ifndef        _MACH_M88K_THREAD_STATE_
54  #define        _MACH_M88K_THREAD_STATE_
55  
56 -#import <architecture/m88k/fp_regs.h>
57 -#import <architecture/m88k/reg_help.h>
58 +#include <architecture/m88k/fp_regs.h>
59 +#include <architecture/m88k/reg_help.h>
60  
61  /**************************************************************************
62   * Data Typedefs used by thread_getstatus() and thread_setstatus()        *
63 diff -rub ./include/mach/machine.h ./include/mach/machine.h
64 --- ./include/mach/machine.h    Mon Feb 10 19:52:25 2003
65 +++ ./include/mach/machine.h    Mon Aug 25 12:56:22 2003
66 @@ -81,8 +81,8 @@
67  #ifndef        _MACH_MACHINE_H_
68  #define _MACH_MACHINE_H_
69  
70 -#import <mach/machine/vm_types.h>
71 -#import <mach/boolean.h>
72 +#include <mach/machine/vm_types.h>
73 +#include <mach/boolean.h>
74  
75  /*
76   *     For each host, there is a maximum possible number of
77 diff -rub ./include/mach-o/hppa/swap.h ./include/mach-o/hppa/swap.h
78 --- ./include/mach-o/hppa/swap.h        Thu May  6 19:25:11 1999
79 +++ ./include/mach-o/hppa/swap.h        Mon Aug 25 12:56:22 2003
80 @@ -21,8 +21,8 @@
81   * 
82   * @APPLE_LICENSE_HEADER_END@
83   */
84 -#import <architecture/byte_order.h>
85 -#import <mach/hppa/thread_status.h>
86 +#include <architecture/byte_order.h>
87 +#include <mach/hppa/thread_status.h>
88  
89  extern void swap_hppa_integer_thread_state(
90      struct hp_pa_integer_thread_state *regs,
91 diff -rub ./include/mach-o/i860/swap.h ./include/mach-o/i860/swap.h
92 --- ./include/mach-o/i860/swap.h        Thu May  6 19:25:19 1999
93 +++ ./include/mach-o/i860/swap.h        Mon Aug 25 12:56:22 2003
94 @@ -21,8 +21,8 @@
95   * 
96   * @APPLE_LICENSE_HEADER_END@
97   */
98 -#import <architecture/byte_order.h>
99 -#import <mach/i860/thread_status.h>
100 +#include <architecture/byte_order.h>
101 +#include <mach/i860/thread_status.h>
102  
103  extern void swap_i860_thread_state_regs(
104      struct i860_thread_state_regs *cpu,
105 diff -rub ./include/mach-o/m68k/swap.h ./include/mach-o/m68k/swap.h
106 --- ./include/mach-o/m68k/swap.h        Thu May  6 19:25:26 1999
107 +++ ./include/mach-o/m68k/swap.h        Mon Aug 25 12:56:22 2003
108 @@ -21,8 +21,8 @@
109   * 
110   * @APPLE_LICENSE_HEADER_END@
111   */
112 -#import <architecture/byte_order.h>
113 -#import <mach/m68k/thread_status.h>
114 +#include <architecture/byte_order.h>
115 +#include <mach/m68k/thread_status.h>
116  
117  extern void swap_m68k_thread_state_regs(
118      struct m68k_thread_state_regs *cpu,
119 diff -rub ./include/mach-o/m88k/swap.h ./include/mach-o/m88k/swap.h
120 --- ./include/mach-o/m88k/swap.h        Thu May  6 19:25:31 1999
121 +++ ./include/mach-o/m88k/swap.h        Mon Aug 25 12:56:22 2003
122 @@ -21,8 +21,8 @@
123   * 
124   * @APPLE_LICENSE_HEADER_END@
125   */
126 -#import <architecture/byte_order.h>
127 -#import <mach/m88k/thread_status.h>
128 +#include <architecture/byte_order.h>
129 +#include <mach/m88k/thread_status.h>
130  
131  extern void swap_m88k_thread_state_grf_t(
132      m88k_thread_state_grf_t *cpu,
133 diff -rub ./include/mach-o/rld.h ./include/mach-o/rld.h
134 --- ./include/mach-o/rld.h      Tue Oct  2 15:19:03 2001
135 +++ ./include/mach-o/rld.h      Mon Aug 25 12:56:22 2003
136 @@ -28,7 +28,7 @@
137  #ifndef _MACHO_RLD_H_
138  #define _MACHO_RLD_H_
139  
140 -#include <streams/streams.h>
141 +//~ #include <streams/streams.h>
142  #include <mach-o/loader.h>
143  
144  extern long rld_load(
145 diff -rub ./include/mach-o/sparc/swap.h ./include/mach-o/sparc/swap.h
146 --- ./include/mach-o/sparc/swap.h       Thu May  6 19:25:56 1999
147 +++ ./include/mach-o/sparc/swap.h       Mon Aug 25 12:56:22 2003
148 @@ -21,8 +21,8 @@
149   * 
150   * @APPLE_LICENSE_HEADER_END@
151   */
152 -#import <architecture/byte_order.h>
153 -#import <mach/sparc/thread_status.h>
154 +#include <architecture/byte_order.h>
155 +#include <mach/sparc/thread_status.h>
156  
157  void swap_sparc_thread_state_regs(
158      struct sparc_thread_state_regs *cpu,
159 diff -rub ./include/standalone/libsa.h ./include/standalone/libsa.h
160 --- ./include/standalone/libsa.h        Mon Sep 11 15:03:00 2000
161 +++ ./include/standalone/libsa.h        Mon Aug 25 12:56:22 2003
162 @@ -23,13 +23,13 @@
163   */
164  /* Exported API for standalone library */
165  #if !(defined(KLD) && defined(__STATIC__))
166 -#import <mach/mach.h>
167 +#include <mach/mach.h>
168  #else /* defined(KLD) && defined(__STATIC__) */
169  #include <mach/kern_return.h>
170  #endif /* !(defined(KLD) && defined(__STATIC__)) */
171 -#import <mach-o/loader.h>
172 -#import <stdarg.h>
173 -#import <stddef.h>
174 +#include <mach-o/loader.h>
175 +#include <stdarg.h>
176 +#include <stddef.h>
177  
178  #ifndef bcopy
179  #ifdef __OPENSTEP__
180 diff -rub ./include/stuff/allocate.h ./include/stuff/allocate.h
181 --- ./include/stuff/allocate.h  Thu May  6 19:26:24 1999
182 +++ ./include/stuff/allocate.h  Mon Aug 25 13:08:44 2003
183 @@ -21,8 +21,10 @@
184   * 
185   * @APPLE_LICENSE_HEADER_END@
186   */
187 -#if defined(__MWERKS__) && !defined(__private_extern__)
188 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
189  #define __private_extern__ __declspec(private_extern)
190 +#elif ( defined(__linux__) && !defined(__private_extern__) )
191 +#define __private_extern__ extern
192  #endif
193  
194  /* defined in allocate.c */
195 diff -rub ./include/stuff/arch.h ./include/stuff/arch.h
196 --- ./include/stuff/arch.h      Mon Nov 19 12:09:40 2001
197 +++ ./include/stuff/arch.h      Mon Aug 25 13:10:15 2003
198 @@ -24,15 +24,17 @@
199  #ifndef _STUFF_ARCH_H_
200  #define _STUFF_ARCH_H_
201  
202 -#if defined(__MWERKS__) && !defined(__private_extern__)
203 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
204  #define __private_extern__ __declspec(private_extern)
205 +#elif ( defined(__linux__) && !defined(__private_extern__) )
206 +#define __private_extern__ extern
207  #endif
208  /*
209   * This file contains the current known set of flags and constants for the
210   * known architectures.
211   */
212 -#import <mach/machine.h>
213 -#import <stuff/bytesex.h>
214 +#include <mach/machine.h>
215 +#include <stuff/bytesex.h>
216  
217  /*
218   * The structure describing an architecture flag with the string of the flag
219 diff -rub ./include/stuff/best_arch.h ./include/stuff/best_arch.h
220 --- ./include/stuff/best_arch.h Thu May  6 19:26:29 1999
221 +++ ./include/stuff/best_arch.h Mon Aug 25 13:10:13 2003
222 @@ -21,8 +21,10 @@
223   * 
224   * @APPLE_LICENSE_HEADER_END@
225   */
226 -#if defined(__MWERKS__) && !defined(__private_extern__)
227 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
228  #define __private_extern__ __declspec(private_extern)
229 +#elif ( defined(__linux__) && !defined(__private_extern__) )
230 +#define __private_extern__ extern
231  #endif
232  
233  #include <mach/machine.h>
234 diff -rub ./include/stuff/breakout.h ./include/stuff/breakout.h
235 --- ./include/stuff/breakout.h  Mon May  6 14:03:46 2002
236 +++ ./include/stuff/breakout.h  Mon Aug 25 13:10:12 2003
237 @@ -21,11 +21,13 @@
238   * 
239   * @APPLE_LICENSE_HEADER_END@
240   */
241 -#if defined(__MWERKS__) && !defined(__private_extern__)
242 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
243  #define __private_extern__ __declspec(private_extern)
244 +#elif ( defined(__linux__) && !defined(__private_extern__) )
245 +#define __private_extern__ extern
246  #endif
247  
248 -#import "stuff/ofile.h"
249 +#include "stuff/ofile.h"
250  
251  /*
252   * The input files are broken out in to their object files and then placed in
253 diff -rub ./include/stuff/bytesex.h ./include/stuff/bytesex.h
254 --- ./include/stuff/bytesex.h   Mon Nov 19 12:09:42 2001
255 +++ ./include/stuff/bytesex.h   Mon Aug 25 13:10:10 2003
256 @@ -25,23 +25,25 @@
257  #ifndef _STUFF_BYTESEX_H_
258  #define _STUFF_BYTESEX_H_
259  
260 -#if defined(__MWERKS__) && !defined(__private_extern__)
261 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
262  #define __private_extern__ __declspec(private_extern)
263 +#elif ( defined(__linux__) && !defined(__private_extern__) )
264 +#define __private_extern__ extern
265  #endif
266  
267 -#import <mach-o/fat.h>
268 -#import <mach-o/loader.h>
269 -#import <mach/m68k/thread_status.h>
270 -#import <mach/ppc/thread_status.h>
271 -#import <mach/m88k/thread_status.h>
272 -#import <mach/i860/thread_status.h>
273 -#import <mach/i386/thread_status.h>
274 -#import <mach/hppa/thread_status.h>
275 -#import <mach/sparc/thread_status.h>
276 -#import <mach-o/nlist.h>
277 -#import <mach-o/reloc.h>
278 -#import <mach-o/ranlib.h>
279 -#import "stuff/bool.h"
280 +#include <mach-o/fat.h>
281 +#include <mach-o/loader.h>
282 +#include <mach/m68k/thread_status.h>
283 +#include <mach/ppc/thread_status.h>
284 +#include <mach/m88k/thread_status.h>
285 +#include <mach/i860/thread_status.h>
286 +#include <mach/i386/thread_status.h>
287 +#include <mach/hppa/thread_status.h>
288 +#include <mach/sparc/thread_status.h>
289 +#include <mach-o/nlist.h>
290 +#include <mach-o/reloc.h>
291 +#include <mach-o/ranlib.h>
292 +#include "stuff/bool.h"
293  
294  enum byte_sex {
295      UNKNOWN_BYTE_SEX,
296 diff -rub ./include/stuff/errors.h ./include/stuff/errors.h
297 --- ./include/stuff/errors.h    Thu May  6 19:26:40 1999
298 +++ ./include/stuff/errors.h    Mon Aug 25 13:09:00 2003
299 @@ -21,11 +21,13 @@
300   * 
301   * @APPLE_LICENSE_HEADER_END@
302   */
303 -#if defined(__MWERKS__) && !defined(__private_extern__)
304 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
305  #define __private_extern__ __declspec(private_extern)
306 +#elif ( defined(__linux__) && !defined(__private_extern__) )
307 +#define __private_extern__ extern
308  #endif
309  
310 -#import "mach/mach.h"
311 +#include "mach/mach.h"
312  
313  /* user defined (imported) */
314  __private_extern__ char *progname;
315 diff -rub ./include/stuff/execute.h ./include/stuff/execute.h
316 --- ./include/stuff/execute.h   Thu May  6 19:26:42 1999
317 +++ ./include/stuff/execute.h   Mon Aug 25 13:10:04 2003
318 @@ -21,8 +21,10 @@
319   * 
320   * @APPLE_LICENSE_HEADER_END@
321   */
322 -#if defined(__MWERKS__) && !defined(__private_extern__)
323 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
324  #define __private_extern__ __declspec(private_extern)
325 +#elif ( defined(__linux__) && !defined(__private_extern__) )
326 +#define __private_extern__ extern
327  #endif
328  
329  /*
330 diff -rub ./include/stuff/hash_string.h ./include/stuff/hash_string.h
331 --- ./include/stuff/hash_string.h       Thu May  6 19:26:45 1999
332 +++ ./include/stuff/hash_string.h       Mon Aug 25 13:10:32 2003
333 @@ -21,8 +21,10 @@
334   * 
335   * @APPLE_LICENSE_HEADER_END@
336   */
337 -#if defined(__MWERKS__) && !defined(__private_extern__)
338 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
339  #define __private_extern__ __declspec(private_extern)
340 +#elif ( defined(__linux__) && !defined(__private_extern__) )
341 +#define __private_extern__ extern
342  #endif
343  
344  __private_extern__ long hash_string(
345 diff -rub ./include/stuff/hppa.h ./include/stuff/hppa.h
346 --- ./include/stuff/hppa.h      Thu May  6 19:26:47 1999
347 +++ ./include/stuff/hppa.h      Mon Aug 25 13:10:40 2003
348 @@ -21,8 +21,10 @@
349   * 
350   * @APPLE_LICENSE_HEADER_END@
351   */
352 -#if defined(__MWERKS__) && !defined(__private_extern__)
353 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
354  #define __private_extern__ __declspec(private_extern)
355 +#elif ( defined(__linux__) && !defined(__private_extern__) )
356 +#define __private_extern__ extern
357  #endif
358  
359  __private_extern__ void calc_hppa_HILO(
360 diff -rub ./include/stuff/ofile.h ./include/stuff/ofile.h
361 --- ./include/stuff/ofile.h     Mon Feb 10 19:52:33 2003
362 +++ ./include/stuff/ofile.h     Mon Aug 25 13:10:51 2003
363 @@ -25,21 +25,23 @@
364  #ifndef _STUFF_OFILE_H_
365  #define _STUFF_OFILE_H_
366  
367 -#if defined(__MWERKS__) && !defined(__private_extern__)
368 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
369  #define __private_extern__ __declspec(private_extern)
370 +#elif ( defined(__linux__) && !defined(__private_extern__) )
371 +#define __private_extern__ extern
372  #endif
373  
374 -#import <ar.h>
375 +#include <ar.h>
376  #ifndef AR_EFMT1
377  #define        AR_EFMT1        "#1/"           /* extended format #1 */
378  #endif
379 -#import <mach-o/loader.h>
380 +#include <mach-o/loader.h>
381  #ifdef OFI
382 -#import <mach-o/dyld.h>
383 +#include <mach-o/dyld.h>
384  #endif
385 -#import "stuff/bytesex.h"
386 -#import "stuff/bool.h"
387 -#import "stuff/arch.h"
388 +#include "stuff/bytesex.h"
389 +#include "stuff/bool.h"
390 +#include "stuff/arch.h"
391  
392  enum ofile_type {
393      OFILE_UNKNOWN,
394 diff -rub ./include/stuff/print.h ./include/stuff/print.h
395 --- ./include/stuff/print.h     Thu May  6 19:26:55 1999
396 +++ ./include/stuff/print.h     Mon Aug 25 13:10:58 2003
397 @@ -21,11 +21,13 @@
398   * 
399   * @APPLE_LICENSE_HEADER_END@
400   */
401 -#if defined(__MWERKS__) && !defined(__private_extern__)
402 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
403  #define __private_extern__ __declspec(private_extern)
404 +#elif ( defined(__linux__) && !defined(__private_extern__) )
405 +#define __private_extern__ extern
406  #endif
407  
408 -#import <stdarg.h>
409 +#include <stdarg.h>
410  
411  __private_extern__ void print(
412      const char *format, ...)
413 diff -rub ./include/stuff/reloc.h ./include/stuff/reloc.h
414 --- ./include/stuff/reloc.h     Thu May  6 19:26:57 1999
415 +++ ./include/stuff/reloc.h     Mon Aug 25 13:11:02 2003
416 @@ -21,12 +21,14 @@
417   * 
418   * @APPLE_LICENSE_HEADER_END@
419   */
420 -#if defined(__MWERKS__) && !defined(__private_extern__)
421 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
422  #define __private_extern__ __declspec(private_extern)
423 +#elif ( defined(__linux__) && !defined(__private_extern__) )
424 +#define __private_extern__ extern
425  #endif
426  
427 -#import <mach/machine.h>
428 -#import "stuff/bool.h"
429 +#include <mach/machine.h>
430 +#include "stuff/bool.h"
431  
432  __private_extern__ unsigned long reloc_pair_r_type(
433      cpu_type_t cputype);
434 diff -rub ./include/stuff/round.h ./include/stuff/round.h
435 --- ./include/stuff/round.h     Fri Mar 14 18:18:29 2003
436 +++ ./include/stuff/round.h     Mon Aug 25 13:11:06 2003
437 @@ -21,8 +21,10 @@
438   * 
439   * @APPLE_LICENSE_HEADER_END@
440   */
441 -#if defined(__MWERKS__) && !defined(__private_extern__)
442 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
443  #define __private_extern__ __declspec(private_extern)
444 +#elif ( defined(__linux__) && !defined(__private_extern__) )
445 +#define __private_extern__ extern
446  #endif
447  
448  /*
449 diff -rub ./include/stuff/symbol_list.h ./include/stuff/symbol_list.h
450 --- ./include/stuff/symbol_list.h       Thu Oct 24 17:04:30 2002
451 +++ ./include/stuff/symbol_list.h       Mon Aug 25 13:19:46 2003
452 @@ -1,6 +1,12 @@
453  #include <mach-o/nlist.h>
454  #include <stuff/bool.h>
455  
456 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
457 +#define __private_extern__ __declspec(private_extern)
458 +#elif ( defined(__linux__) && !defined(__private_extern__) )
459 +#define __private_extern__ extern
460 +#endif
461 +
462  /*
463   * Data structures to perform selective stripping of symbol table entries.
464   */
465 diff -rub ./include/stuff/vm_flush_cache.h ./include/stuff/vm_flush_cache.h
466 --- ./include/stuff/vm_flush_cache.h    Thu May  6 19:27:05 1999
467 +++ ./include/stuff/vm_flush_cache.h    Mon Aug 25 13:11:15 2003
468 @@ -21,11 +21,13 @@
469   * 
470   * @APPLE_LICENSE_HEADER_END@
471   */
472 -#if defined(__MWERKS__) && !defined(__private_extern__)
473 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
474  #define __private_extern__ __declspec(private_extern)
475 +#elif ( defined(__linux__) && !defined(__private_extern__) )
476 +#define __private_extern__ extern
477  #endif
478  
479 -#import <mach/mach.h>
480 +#include <mach/mach.h>
481  __private_extern__ kern_return_t vm_flush_cache(
482      mach_port_t target_task,
483      vm_address_t address,
484 diff -rub ./ld/Makefile ./ld/Makefile
485 --- ./ld/Makefile       Fri Mar 14 18:18:29 2003
486 +++ ./ld/Makefile       Sat Sep  6 20:17:46 2003
487 @@ -9,10 +9,10 @@
488         -DKERNEL -DKERNEL_PRIVATE -DAPPLE -DNeXT -DLIBSA_PRIVATE
489  
490  
491 -MIG = $(NEXT_ROOT)/usr/bin/mig
492 +MIG = mig
493  
494  ifeq "macos" "$(RC_OS)"
495 -  X_CFLAGS := $(shell if [ "$(RC_RELEASE)" != "Beaker" ] &&    \
496 +  X_CFLAGS := $(shell if [ `uname` != "Linux" ] && [ "$(RC_RELEASE)" != "Beaker" ] &&    \
497                          [ "$(RC_RELEASE)" != "Bunsen" ] &&    \
498                          [ "$(RC_RELEASE)" != "Gonzo"  ] &&    \
499                          [ "$(RC_RELEASE)" != "Kodiak" ]; then \
500 @@ -21,10 +21,19 @@
501  endif
502  
503  ifneq "mwccppc" "$(notdir $(CC))"
504 +  ifeq "Linux" "$(shell uname)"
505 +    GCC_FLAGS = -Wall $(X_CFLAGS) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__  -D__ppc__ -I/usr/include -I../../../macosx-include
506 +  else
507    GCC_FLAGS = -Wall $(X_CFLAGS)
508 +  endif
509  endif
510  
511 -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
512 +# Hack: Add ../misc to the path because it contains seg_hack and ver_string
513 +ifneq ($(findstring ../misc,$(PATH)),../misc)
514 +  PATH:=../misc:../../misc:$(PATH)
515 +endif
516 +
517 +USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
518              echo YES ; else echo NO ; \
519              fi; )
520  
521 @@ -78,7 +87,7 @@
522          fvmlibs.c layout.c specs.c pass2.c generic_reloc.c rld.c sets.c \
523          4byte_literals.c 8byte_literals.c literal_pointers.c dylibs.c \
524          indirect_sections.c mod_sections.c i860_reloc.c ppc_reloc.c \
525 -        m88k_reloc.c hppa_reloc.c sparc_reloc.c coalesced_sections.c
526 +        m88k_reloc.c hppa_reloc.c sparc_reloc.c coalesced_sections.c fake-mach.c
527  OBJS = $(CFILES:.c=.o)
528  INSTALL_FILES = $(CFILES) $(HFILES) Makefile notes \
529                 make.defs make_defs.h librld.ofileList
530 @@ -341,8 +350,9 @@
531  makeUser.c ld.c: make.h
532  
533  make.h makeUser.c: make.defs
534 -       $(MIG) $(MIG_FLAGS) $(SRCROOT)/make.defs
535 -       rm -f makeServer.c
536 +       #~ $(MIG) $(MIG_FLAGS) $(SRCROOT)/make.defs
537 +       #~ rm -f makeServer.c
538 +       cp $(SRCROOT)/makeUser.c .
539  
540  ld_vers.o: ld_vers.c
541  ifeq "mwccppc" "$(notdir $(CC))"
542 diff -rub ./ld/layout.c ./ld/layout.c
543 --- ./ld/layout.c       Wed May 28 18:29:27 2003
544 +++ ./ld/layout.c       Mon Aug 25 23:22:05 2003
545 @@ -42,18 +42,22 @@
546  #include "stuff/openstep_mach.h"
547  #include <mach-o/fat.h> 
548  #include <mach-o/loader.h> 
549 -#import <mach/m68k/thread_status.h>
550 -#import <mach/ppc/thread_status.h>
551 -#import <mach/m88k/thread_status.h>
552 -#import <mach/i860/thread_status.h>
553 -#import <mach/i386/thread_status.h>
554 -#import <mach/hppa/thread_status.h>
555 -#import <mach/sparc/thread_status.h>
556 +#include <mach/m68k/thread_status.h>
557 +#include <mach/ppc/thread_status.h>
558 +#include <mach/m88k/thread_status.h>
559 +#include <mach/i860/thread_status.h>
560 +#include <mach/i386/thread_status.h>
561 +#include <mach/hppa/thread_status.h>
562 +#include <mach/sparc/thread_status.h>
563  #include <mach-o/nlist.h>
564  #include <mach-o/reloc.h>
565 +
566 +#include <mach/kern_return.h>
567 +
568  #if defined(RLD) && !defined(SA_RLD) && !(defined(KLD) && defined(__STATIC__))
569 +typedef void NXStream;
570  #include <mach-o/rld.h>
571 -#include <streams/streams.h>
572 +//~ #include <streams/streams.h>
573  #endif /* defined(RLD) && !defined(SA_RLD) &&
574           !(defined(KLD) && defined(__STATIC__)) */
575  #include "stuff/arch.h"
576 @@ -72,6 +76,15 @@
577  #include "sets.h"
578  #include "mach-o/sarld.h"
579  #include "indirect_sections.h"
580 +
581 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
582 +#define __private_extern__ __declspec(private_extern)
583 +#elif ( defined(__linux__) && !defined(__private_extern__) )
584 +#define __private_extern__ extern
585 +#endif
586 +
587 +/** gcc on Linux defines powerpc, if we are compiling on a powerpc. */
588 +#undef powerpc
589  
590  #ifdef RLD
591  __private_extern__ long RLD_DEBUG_OUTPUT_FILENAME_flag;
592 diff -rub ./ld/rld.c ./ld/rld.c
593 --- ./ld/rld.c  Wed May 28 18:29:32 2003
594 +++ ./ld/rld.c  Mon Aug 25 22:11:47 2003
595 @@ -56,11 +56,13 @@
596  #include "stuff/openstep_mach.h"
597  #include <mach-o/fat.h>
598  #include <mach-o/nlist.h>
599 -#ifdef KLD
600 +//~ #ifdef KLD
601  #include <mach-o/kld.h>
602 -#else /* !defined(KLD) */
603 +#ifndef KLD
604 +//~ #else /* !defined(KLD) */
605 +typedef void NXStream;
606  #include <mach-o/rld.h>
607 -#include <streams/streams.h>
608 +//~ #include <streams/streams.h>
609  #include <objc/zone.h>
610  #endif /* KLD */
611  #include <mach-o/rld_state.h>
612 diff -rub ./libstuff/Makefile ./libstuff/Makefile
613 --- ./libstuff/Makefile Fri Mar 14 18:18:30 2003
614 +++ ./libstuff/Makefile Sat Sep  6 20:12:21 2003
615 @@ -1,7 +1,7 @@
616  RC_OS = macos
617  OFLAG = -O
618  ifeq "macos" "$(RC_OS)"
619 -  X_CFLAGS := $(shell if [ "$(RC_RELEASE)" != "Beaker" ] &&    \
620 +  X_CFLAGS := $(shell if [ `uname` != "Linux" ] && [ "$(RC_RELEASE)" != "Beaker" ] &&    \
621                          [ "$(RC_RELEASE)" != "Bunsen" ] &&    \
622                          [ "$(RC_RELEASE)" != "Gonzo"  ] &&    \
623                          [ "$(RC_RELEASE)" != "Kodiak" ]; then \
624 @@ -10,14 +10,18 @@
625  endif
626  
627  
628 -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
629 +USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
630              echo YES ; else echo NO ; \
631              fi; )
632         
633  ifeq "mwccppc" "$(notdir $(CC))"
634    CFLAGS = $(OFLAG) -g -gccinc -I$(SRCROOT)/../include
635  else
636 +  ifeq "Linux" "$(shell uname)"
637 +    CFLAGS = $(OFLAG) -g -I$(SRCROOT)/../include -Wall $(X_CFLAGS) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__ -D__ppc__ -I/usr/include -I../../../macosx-include
638 +  else
639    CFLAGS = $(OFLAG) -g -I$(SRCROOT)/../include -Wall $(X_CFLAGS)
640 +  endif
641  endif
642  
643  ifneq "" "$(wildcard /bin/mkdirs)"
644 @@ -41,7 +45,7 @@
645           breakout.c writeout.c checkout.c fatal_arch.c ofile_get_word.c \
646           vm_flush_cache.c hash_string.c dylib_roots.c guess_short_name.c \
647           SymLoc.c get_arch_from_host.c crc32.c macosx_deployment_target.c \
648 -         symbol_list.c
649 +         symbol_list.c fake-mach.c
650  OBJS = $(CFILES:.c=.o)
651  INSTALL_FILES = $(CFILES) Makefile notes
652  
653 @@ -91,7 +95,7 @@
654                 OFILE_DIR=.                                             \
655                 SRCROOT=..                                              \
656                 SYMROOT=..                                              \
657 -               COPTS="-dynamic"                                        \
658 +               COPTS=""                                        \
659                 OFLAG="$(OFLAG)"                                        \
660                 CFILES="$(CFILES)"                                      \
661                 RC_CFLAGS="$(RC_CFLAGS)"                                \
662 @@ -104,7 +108,7 @@
663                 OFILE_DIR=$(OBJROOT)/dynamic_obj                        \
664                 SRCROOT=$(SRCROOT)                                      \
665                 SYMROOT=$(SYMROOT)                                      \
666 -               COPTS="-dynamic"                                        \
667 +               COPTS=""                                        \
668                 OFLAG="$(OFLAG)"                                        \
669                 CFILES="$(CFILES)"                                      \
670                 RC_CFLAGS="$(RC_CFLAGS)"                                \
671 @@ -121,7 +125,7 @@
672                 OFILE_DIR=.                                             \
673                 SRCROOT=..                                              \
674                 SYMROOT=..                                              \
675 -               COPTS="-dynamic -pg"                                    \
676 +               COPTS="-pg"                                     \
677                 OFLAG="$(OFLAG)"                                        \
678                 RC_CFLAGS="$(RC_CFLAGS)"                                \
679                 RC_ARCHS="$(RC_ARCHS)";                                 \
680 @@ -133,7 +137,7 @@
681                 OFILE_DIR=$(OBJROOT)/profile_obj                        \
682                 SRCROOT=$(SRCROOT)                                      \
683                 SYMROOT=$(SYMROOT)                                      \
684 -               COPTS="-dynamic -pg"                                    \
685 +               COPTS="-pg"                                     \
686                 OFLAG="$(OFLAG)"                                        \
687                 RC_CFLAGS="$(RC_CFLAGS)"                                \
688                 RC_ARCHS="$(RC_ARCHS)";                                 \
689 @@ -168,7 +172,8 @@
690         fi
691  
692  $(PRODUCT):    $(OFILE_DIR) $(SYMROOT) $(OBJS)
693 -       libtool -static -o $(SYMROOT)/$(PRODUCT) $(OBJS)
694 +       ar r $(SYMROOT)/$(PRODUCT) $(OBJS)
695 +       ranlib $(SYMROOT)/$(PRODUCT)
696  
697  ifeq "NO" "$(USE_DEPENDENCY_FILE)"
698  .c.o:
699 diff -rub ./libstuff/SymLoc.c ./libstuff/SymLoc.c
700 --- ./libstuff/SymLoc.c Thu Oct 24 17:04:50 2002
701 +++ ./libstuff/SymLoc.c Mon Aug 25 13:17:40 2003
702 @@ -1,15 +1,15 @@
703 -#import <libc.h>
704 -#import <ctype.h>
705 -#import <sys/types.h>
706 +#include <libc.h>
707 +#include <ctype.h>
708 +#include <sys/types.h>
709  #ifdef __OPENSTEP__
710  #define _POSIX_SOURCE
711  #endif
712 -#import <dirent.h>
713 -#import <pwd.h>
714 -#import "stuff/bool.h"
715 -#import "stuff/errors.h"
716 -#import "stuff/allocate.h"
717 -#import "stuff/SymLoc.h"
718 +#include <dirent.h>
719 +#include <pwd.h>
720 +#include "stuff/bool.h"
721 +#include "stuff/errors.h"
722 +#include "stuff/allocate.h"
723 +#include "stuff/SymLoc.h"
724  
725  const char *
726  symLocForDylib(const char *installName, const char *releaseName,
727 diff -rub ./libstuff/bytesex.c ./libstuff/bytesex.c
728 --- ./libstuff/bytesex.c        Mon Nov 19 12:10:07 2001
729 +++ ./libstuff/bytesex.c        Mon Aug 25 13:17:40 2003
730 @@ -25,13 +25,13 @@
731  #include <string.h>
732  #include <mach-o/fat.h>
733  #include <mach-o/loader.h>
734 -#import <mach/m68k/thread_status.h>
735 -#import <mach/ppc/thread_status.h>
736 -#import <mach/m88k/thread_status.h>
737 -#import <mach/i860/thread_status.h>
738 -#import <mach/i386/thread_status.h>
739 -#import <mach/hppa/thread_status.h>
740 -#import <mach/sparc/thread_status.h>
741 +#include <mach/m68k/thread_status.h>
742 +#include <mach/ppc/thread_status.h>
743 +#include <mach/m88k/thread_status.h>
744 +#include <mach/i860/thread_status.h>
745 +#include <mach/i386/thread_status.h>
746 +#include <mach/hppa/thread_status.h>
747 +#include <mach/sparc/thread_status.h>
748  #include <mach-o/nlist.h>
749  #include <mach-o/reloc.h>
750  #include <mach-o/ranlib.h>
751 diff -rub ./libstuff/crc32.c ./libstuff/crc32.c
752 --- ./libstuff/crc32.c  Wed Feb 13 17:53:36 2002
753 +++ ./libstuff/crc32.c  Mon Aug 25 13:19:21 2003
754 @@ -35,6 +35,12 @@
755   */
756  #include <sys/types.h>
757  
758 +#if ( defined(__MWERKS__) && !defined(__private_extern__) )
759 +#define __private_extern__ __declspec(private_extern)
760 +#elif ( defined(__linux__) && !defined(__private_extern__) )
761 +#define __private_extern__ extern
762 +#endif
763 +
764  static const u_int32_t crctab[] = {
765         0x0,
766         0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
767 diff -rub ./libstuff/ofile.c ./libstuff/ofile.c
768 --- ./libstuff/ofile.c  Wed Apr 16 16:15:01 2003
769 +++ ./libstuff/ofile.c  Tue Sep  2 20:15:34 2003
770 @@ -21,6 +21,7 @@
771   * 
772   * @APPLE_LICENSE_HEADER_END@
773   */
774 +#include "machine/endian.h"
775  #ifdef SHLIB
776  #include "shlib.h"
777  #endif
778 @@ -36,12 +37,12 @@
779  #include <sys/file.h>
780  #include <mach-o/fat.h>
781  #include <mach-o/loader.h>
782 -#import <mach/m68k/thread_status.h>
783 -#import <mach/ppc/thread_status.h>
784 -#import <mach/m88k/thread_status.h>
785 -#import <mach/i860/thread_status.h>
786 -#import <mach/i386/thread_status.h>
787 -#import <mach/sparc/thread_status.h>
788 +#include <mach/m68k/thread_status.h>
789 +#include <mach/ppc/thread_status.h>
790 +#include <mach/m88k/thread_status.h>
791 +#include <mach/i860/thread_status.h>
792 +#include <mach/i386/thread_status.h>
793 +#include <mach/sparc/thread_status.h>
794  #include <mach-o/nlist.h>
795  #include <mach-o/reloc.h>
796  #include "stuff/bool.h"
797 @@ -677,7 +678,7 @@
798         memset(ofile, '\0', sizeof(struct ofile));
799  
800         /* Open the file and map it in */
801 -       if((fd = open(file_name, O_RDONLY)) == -1){
802 +       if((fd = open(file_name, O_RDWR)) == -1){
803  #ifdef OFI
804             return(NSObjectFileImageAccess);
805  #else
806 @@ -975,7 +976,7 @@
807                 }
808             }
809         }
810 -       /* see if this file is Mach-O file */
811 +
812         else if(size >= sizeof(struct mach_header) &&
813                 (magic == MH_MAGIC || magic == SWAP_LONG(MH_MAGIC))){
814             ofile->file_type = OFILE_Mach_O;
815 diff -rub ./libstuff/print.c ./libstuff/print.c
816 --- ./libstuff/print.c  Thu May  6 19:30:58 1999
817 +++ ./libstuff/print.c  Mon Aug 25 13:17:40 2003
818 @@ -21,8 +21,8 @@
819   * 
820   * @APPLE_LICENSE_HEADER_END@
821   */
822 -#import <stdio.h>
823 -#import "stuff/print.h"
824 +#include <stdio.h>
825 +#include "stuff/print.h"
826  
827  /*
828   * All printing of all messages for ofile functions goes through this function.
829 diff -rub ./libstuff/swap_headers.c ./libstuff/swap_headers.c
830 --- ./libstuff/swap_headers.c   Fri Oct  4 17:54:48 2002
831 +++ ./libstuff/swap_headers.c   Mon Aug 25 13:17:40 2003
832 @@ -22,13 +22,13 @@
833   * @APPLE_LICENSE_HEADER_END@
834   */
835  #include <mach-o/loader.h>
836 -#import <mach/m68k/thread_status.h>
837 -#import <mach/ppc/thread_status.h>
838 -#import <mach/m88k/thread_status.h>
839 -#import <mach/i860/thread_status.h>
840 -#import <mach/i386/thread_status.h>
841 -#import <mach/hppa/thread_status.h>
842 -#import <mach/sparc/thread_status.h>
843 +#include <mach/m68k/thread_status.h>
844 +#include <mach/ppc/thread_status.h>
845 +#include <mach/m88k/thread_status.h>
846 +#include <mach/i860/thread_status.h>
847 +#include <mach/i386/thread_status.h>
848 +#include <mach/hppa/thread_status.h>
849 +#include <mach/sparc/thread_status.h>
850  #include "stuff/bool.h"
851  #include "stuff/bytesex.h"
852  #include "stuff/errors.h"
853 diff -rub ./misc/Makefile ./misc/Makefile
854 --- ./misc/Makefile     Fri Mar 14 18:18:30 2003
855 +++ ./misc/Makefile     Sat Sep  6 20:17:36 2003
856 @@ -2,11 +2,11 @@
857  OFLAG = -O
858  RC_OS = macos
859  ifeq "macos" "$(RC_OS)"
860 -  X_CFLAGS := $(shell if [ "$(RC_RELEASE)" != "Beaker" ] &&    \
861 +  X_CFLAGS := $(shell if [ `uname` != "Linux" ] && [ "$(RC_RELEASE)" != "Beaker" ] &&    \
862                          [ "$(RC_RELEASE)" != "Bunsen" ] &&    \
863                          [ "$(RC_RELEASE)" != "Gonzo"  ] &&    \
864                          [ "$(RC_RELEASE)" != "Kodiak" ]; then \
865 -            echo -Wno-long-double -no-cpp-precomp; \
866 +            echo -Wno-long-double -no-cpp-precomp ; \
867              fi; )
868  endif
869  
870 @@ -14,11 +14,16 @@
871    CFLAGS = $(OFLAG) -g \
872          -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR)
873  else
874 +  ifeq "Linux" "$(shell uname)"
875 +    CFLAGS = $(OFLAG) -g -Wall $(X_CFLAGS) \
876 +      -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__ -D__ppc__ -I/usr/include -I../../macosx-include
877 +  else
878    CFLAGS = $(OFLAG) -g -Wall $(X_CFLAGS) \
879          -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR)
880 +  endif
881  endif
882  
883 -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
884 +USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
885              echo YES ; else echo NO ; \
886              fi; )
887  
888 @@ -44,10 +49,7 @@
889  LOCLIBDIR = /usr/local/lib
890  
891  CFILES1 = libtool.c
892 -CFILES2 = main.c lipo.c size.c strings.c nm.c checksyms.c inout.c \
893 -        indr.c strip.c atom.c segedit.c kern_tool.c cmpdylib.c \
894 -        dylib_pcsampler.c pagestuff.c redo_prebinding.c seg_addr_table.c \
895 -        check_dylib.c seg_hack.c check_hints.c install_name_tool.c
896 +CFILES2 = seg_hack.c strip.c
897  ifeq "nextstep" "$(RC_OS)"
898    CFILES3 = file.c ar.c
899  endif
900 @@ -56,11 +58,7 @@
901                 notes
902  
903  
904 -PROGS = lipo.NEW size.NEW strings.NEW nm.NEW \
905 -       libtool.NEW checksyms.NEW indr.NEW strip.NEW nmedit.NEW \
906 -       segedit.NEW kern_tool.NEW cmpdylib.NEW \
907 -       dylib_pcsampler.NEW pagestuff.NEW redo_prebinding.NEW \
908 -       seg_addr_table.NEW check_dylib.NEW seg_hack.NEW install_name_tool.NEW
909 +PROGS = seg_hack.NEW strip.NEW
910  
911  teflon_all macos_all: $(PROGS)
912  
913 @@ -71,7 +69,7 @@
914  lib_ofiles: $(OFILE_DIR) $(SYMROOT) libredo_prebinding.a
915  
916  vers.c:
917 -       vers_string -c $(VERS_STRING_FLAGS) cctools_misc > $(OFILE_DIR)/$@
918 +       ./vers_string -c $(VERS_STRING_FLAGS) cctools_misc > $(OFILE_DIR)/$@
919  
920  ifeq "NO" "$(USE_DEPENDENCY_FILE)"
921  .c.o:
922 @@ -222,6 +220,7 @@
923                 $(OFILE_DIR)/seg_hack.o $(OFILE_DIR)/vers.o $(LIBSTUFF)
924         $(CC) $(CFLAGS) $(RC_CFLAGS) -o $(SYMROOT)/seg_hack.NEW \
925                 $(OFILE_DIR)/seg_hack.private.o
926 +       cp $(SYMROOT)/seg_hack.NEW $(SYMROOT)/seg_hack
927  
928  install_name_tool.NEW: install_name_tool.o vers.o
929         $(CC) $(CFLAGS) $(RC_CFLAGS) -nostdlib -r \
930 @@ -331,7 +330,8 @@
931         $(SYMROOT)/redo_prebinding.NEW \
932         $(SYMROOT)/libredo_prebinding.a \
933         $(SYMROOT)/kern_tool.NEW \
934 -       $(SYMROOT)/cmpdylib.NEW
935 +       $(SYMROOT)/cmpdylib.NEW \
936 +       $(SYMROOT)/seg_hack
937  
938  shlib_clean:
939         -rm -f \
940 --- ld/fake-mach.c      Sat Sep  6 21:32:56 2003
941 +++ ld/fake-mach.c      Tue Aug 26 11:40:24 2003
942 @@ -0,0 +1,160 @@
943 +/** fake-mach.c - A half baked implementation of mach kernel functions using the POSIX UNIX API.
944 +*
945 +* This was used to port Apple's Darwin linker (ld) to Linux. This allows Mac OS X applications to
946 +* be cross complied on Linux. */
947 +
948 +#include <stdlib.h>
949 +#include <assert.h>
950 +#include <sys/types.h>
951 +#include <sys/uio.h>
952 +#include <unistd.h>
953 +
954 +#include <errno.h>
955 +
956 +#include <sys/mman.h>
957 +
958 +// Mach include files for typedefs, return values, etc
959 +//~ #include <mach/mach.h>
960 +#include <mach/kern_return.h>
961 +#include <mach/vm_types.h>
962 +#include <mach/mach_types.h>
963 +#include <mach/message.h>
964 +#include <servers/bootstrap_defs.h>
965 +
966 +/** The port for the current task. Ignored in this implementation. */
967 +mach_port_t mach_task_self_ = 0;
968 +
969 +/** The bootstrap port. Ignored in this implementation. */
970 +mach_port_t bootstrap_port = 0;
971 +
972 +#include <mach/ppc/ndr_def.h>
973 +
974 +/** Maps the file descriptor into memory. Free the memory using  vm_deallocate. Ignores findspace and offset. */
975 +kern_return_t map_fd( int fd, vm_offset_t offset, vm_offset_t *va, boolean_t findspace, vm_size_t size)
976 +{
977 +       void* space = NULL;
978 +
979 +       assert( fd > 0 );
980 +       assert( offset == 0 );
981 +       //~ assert( *va == 0 );
982 +       assert( findspace == TRUE );
983 +       
984 +       //~ // Allocate memory
985 +       //~ space = malloc( size );
986 +       //~ assert( space != NULL );
987 +       
988 +       //~ // Read file into space
989 +       //~ bytes = read( fd, space, size );
990 +       //~ assert( bytes == size );
991 +       
992 +       space = mmap( (void*) offset, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
993 +       // No permission: try to make it read only
994 +       if ( space == (void*) -1 && errno == EACCES )
995 +       {
996 +               space = mmap( (void*) offset, size, PROT_READ, MAP_SHARED, fd, 0 );
997 +       }
998 +       assert( space != NULL && space != (void*) -1 );
999 +       
1000 +       // Copy back the pointer
1001 +       *va = (vm_offset_t) space;
1002 +       
1003 +       // Return success
1004 +       return KERN_SUCCESS;
1005 +}
1006 +
1007 +/** Returns a string appropriate to the error argument given. */
1008 +char* mach_error_string( int error_value )
1009 +{
1010 +       char errorString[] = "Some fake mach error string.";
1011 +       
1012 +       return errorString;
1013 +}
1014 +
1015 +/** Returns the mach port for the current host. We fake it by returning zero. */
1016 +mach_port_t mach_host_self( void )
1017 +{
1018 +       return 0;
1019 +}
1020 +
1021 +/** Returns the mach port for the current task. We fake it by returning zero. */
1022 +//~ mach_port_t mach_task_self( void )
1023 +//~ {
1024 +       //~ return 0;
1025 +//~ }
1026 +
1027 +/**The function vm_allocate allocates a region of virtual memory, placing it in the specified task's address space. Anywhere must be true, as the memory will be allocated anywhere. */
1028 +extern kern_return_t vm_allocate( mach_port_t target_task, vm_address_t *address, vm_size_t size, boolean_t anywhere )
1029 +{
1030 +       assert( anywhere == TRUE );
1031 +       
1032 +       // Anonymous memory map
1033 +       *address = (vm_address_t) mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANON, 0, 0 );
1034 +       //~ *address = (vm_address_t) malloc( size );
1035 +       assert( address != (vm_address_t) NULL );
1036 +       
1037 +       return KERN_SUCCESS;
1038 +}
1039 +
1040 +/**vm_deallocate relinquishes access to a region of a task's address space, causing further access to that memory to fail. This memory must have been allocated with vm_allocate. size is ignored. */
1041 +kern_return_t vm_deallocate( mach_port_t target_task, vm_address_t address, vm_size_t size ) 
1042 +{
1043 +       int ret = 0;
1044 +       
1045 +       assert( address != (vm_address_t) NULL );
1046 +       
1047 +       // Free the memory
1048 +       ret = munmap( (void*) address, size );
1049 +       assert( ret == 0 );
1050 +       
1051 +       //~ free( (void*) address );
1052 +       
1053 +       return KERN_SUCCESS;
1054 +}
1055 +
1056 +/** The function mach_port_allocate_name creates a new right in the specified task, with a specified name for the new right. In this implementation it does nothing. */
1057 +kern_return_t mach_port_allocate_name (mach_port_t task, mach_port_right_t right, mach_port_t name)
1058 +{
1059 +       return KERN_SUCCESS;
1060 +}
1061 +
1062 +/** The function mach_port_deallocate releases a user reference for a right in task's IPC name space. In this implementation it does nothing. */
1063 +kern_return_t mach_port_deallocate (mach_port_t task, mach_port_t name)
1064 +{
1065 +       return KERN_SUCCESS;
1066 +}
1067 +
1068 +/** host_info returns information about the host. It is not implemented in this implementation. */
1069 +kern_return_t host_info( host_t host, host_flavor_t flavor, host_info_t host_info_out, mach_msg_type_number_t *host_info_outCnt )
1070 +{
1071 +       assert( 0 );
1072 +       return KERN_FAILURE;
1073 +}
1074 +
1075 +/** vm_msync unimplemented: It does nothing. */
1076 +kern_return_t vm_msync ( vm_map_t target_task, vm_address_t address, vm_size_t size, vm_sync_t sync_flags )
1077 +{
1078 +       //~ assert( address != (vm_address_t) NULL );
1079 +       //~ int ret = 0;
1080 +       //~ ret = msync( (void*) address, size, int flags);
1081 +       //~ assert( 0 );
1082 +       return KERN_SUCCESS;
1083 +}
1084 +
1085 +/** bootstrap_look_up unimplemented. */
1086 +kern_return_t bootstrap_look_up( mach_port_t bootstrap_port, name_t service_name, mach_port_t *service_port )
1087 +{
1088 +       assert( 0 );
1089 +       return KERN_FAILURE;
1090 +}
1091 +
1092 +/** mach_msg unimplemented. Send and/or receive a message.  If the message operation
1093 + *             is interrupted, and the user did not request an indication
1094 + *             of that fact, then restart the appropriate parts of the
1095 + *             operation silently (trap version does not restart).
1096 + */
1097 +mach_msg_return_t mach_msg( mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size,
1098 +       mach_msg_size_t rcv_size, mach_port_name_t rcv_name, mach_msg_timeout_t timeout, mach_port_name_t notify)
1099 +{
1100 +       //~ assert( 0 );
1101 +       return KERN_SUCCESS;
1102 +}
1103 \ No newline at end of file
1104 --- ld/makeUser.c       Sat Sep  6 21:52:24 2003
1105 +++ ld/makeUser.c       Mon Aug 25 22:54:46 2003
1106 @@ -0,0 +1,305 @@
1107 +/*
1108 + * IDENTIFICATION:
1109 + * stub generated Mon Aug 25 15:06:30 2003
1110 + * with a MiG generated Tue Nov 5 01:17:50 PST 2002 by root@brixen
1111 + * OPTIONS: 
1112 + */
1113 +#include "make.h"
1114 +
1115 +
1116 +#ifndef        mig_internal
1117 +#define        mig_internal    static
1118 +#endif /* mig_internal */
1119 +
1120 +#ifndef        mig_external
1121 +#define mig_external
1122 +#endif /* mig_external */
1123 +
1124 +#ifndef        TypeCheck
1125 +#define        TypeCheck 0
1126 +#endif /* TypeCheck */
1127 +
1128 +#ifndef        LimitCheck
1129 +#define        LimitCheck 0
1130 +#endif /* LimitCheck */
1131 +
1132 +#ifndef        min
1133 +#define        min(a,b)  ( ((a) < (b))? (a): (b) )
1134 +#endif /* min */
1135 +
1136 +#ifndef        UseStaticTemplates
1137 +#define        UseStaticTemplates      0
1138 +#endif /* UseStaticTemplates */
1139 +
1140 +#define _WALIGN_(x) (((x) + 3) & ~3)
1141 +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
1142 +#ifndef        __MachMsgErrorWithTimeout
1143 +#define        __MachMsgErrorWithTimeout(_R_) { \
1144 +       switch (_R_) { \
1145 +       case MACH_SEND_INVALID_REPLY: \
1146 +       case MACH_RCV_INVALID_NAME: \
1147 +       case MACH_RCV_PORT_DIED: \
1148 +       case MACH_RCV_PORT_CHANGED: \
1149 +       case MACH_RCV_TIMED_OUT: \
1150 +               mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
1151 +               break; \
1152 +       default: \
1153 +               mig_put_reply_port(InP->Head.msgh_reply_port); \
1154 +       } \
1155 +}
1156 +#endif /* __MachMsgErrorWithTimeout */
1157 +
1158 +#ifndef        __MachMsgErrorWithoutTimeout
1159 +#define        __MachMsgErrorWithoutTimeout(_R_) { \
1160 +       switch (_R_) { \
1161 +       case MACH_SEND_INVALID_REPLY: \
1162 +       case MACH_RCV_INVALID_NAME: \
1163 +       case MACH_RCV_PORT_DIED: \
1164 +       case MACH_RCV_PORT_CHANGED: \
1165 +               mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
1166 +               break; \
1167 +       default: \
1168 +               mig_put_reply_port(InP->Head.msgh_reply_port); \
1169 +       } \
1170 +}
1171 +#endif /* __MachMsgErrorWithoutTimeout */
1172 +
1173 +#ifndef        __DeclareSendRpc
1174 +#define        __DeclareSendRpc(_NUM_, _NAME_)
1175 +#endif /* __DeclareSendRpc */
1176 +
1177 +#ifndef        __BeforeSendRpc
1178 +#define        __BeforeSendRpc(_NUM_, _NAME_)
1179 +#endif /* __BeforeSendRpc */
1180 +
1181 +#ifndef        __AfterSendRpc
1182 +#define        __AfterSendRpc(_NUM_, _NAME_)
1183 +#endif /* __AfterSendRpc */
1184 +
1185 +#ifndef        __DeclareSendSimple
1186 +#define        __DeclareSendSimple(_NUM_, _NAME_)
1187 +#endif /* __DeclareSendSimple */
1188 +
1189 +#ifndef        __BeforeSendSimple
1190 +#define        __BeforeSendSimple(_NUM_, _NAME_)
1191 +#endif /* __BeforeSendSimple */
1192 +
1193 +#ifndef        __AfterSendSimple
1194 +#define        __AfterSendSimple(_NUM_, _NAME_)
1195 +#endif /* __AfterSendSimple */
1196 +
1197 +#define msgh_request_port      msgh_remote_port
1198 +#define msgh_reply_port                msgh_local_port
1199 +
1200 +
1201 +
1202 +/* SimpleRoutine alert_old */
1203 +mig_external kern_return_t make_alert_old
1204 +(
1205 +       mach_port_t makePort,
1206 +       int eventType,
1207 +       make_string_t functionName,
1208 +       mach_msg_type_number_t functionNameCnt,
1209 +       make_string_t fileName,
1210 +       mach_msg_type_number_t fileNameCnt,
1211 +       int line,
1212 +       make_string_t message,
1213 +       mach_msg_type_number_t messageCnt
1214 +)
1215 +{
1216 +    {
1217 +       typedef struct {
1218 +               mach_msg_header_t Head;
1219 +               NDR_record_t NDR;
1220 +               int eventType;
1221 +               mach_msg_type_number_t functionNameCnt;
1222 +               char functionName[1024];
1223 +               mach_msg_type_number_t fileNameCnt;
1224 +               char fileName[1024];
1225 +               int line;
1226 +               mach_msg_type_number_t messageCnt;
1227 +               char message[1024];
1228 +       } Request;
1229 +
1230 +       /*
1231 +        * typedef struct {
1232 +        *      mach_msg_header_t Head;
1233 +        *      NDR_record_t NDR;
1234 +        *      kern_return_t RetCode;
1235 +        * } mig_reply_error_t;
1236 +        */
1237 +
1238 +       union {
1239 +               Request In;
1240 +       } Mess;
1241 +
1242 +       register Request *InP = &Mess.In;
1243 +
1244 +       mach_msg_return_t msg_result;
1245 +       unsigned int msgh_size;
1246 +       unsigned int msgh_size_delta;
1247 +       __DeclareSendSimple(100, "alert_old")
1248 +
1249 +       InP->NDR = NDR_record;
1250 +
1251 +       InP->eventType = eventType;
1252 +
1253 +       if (functionNameCnt > 1024) {
1254 +               { return MIG_ARRAY_TOO_LARGE; }
1255 +       }
1256 +       (void)memcpy((char *) InP->functionName, (const char *) functionName, functionNameCnt);
1257 +
1258 +       InP->functionNameCnt = functionNameCnt;
1259 +
1260 +       msgh_size_delta = _WALIGN_(functionNameCnt);
1261 +       msgh_size = (sizeof(Request) - 3072) + msgh_size_delta;
1262 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
1263 +
1264 +       if (fileNameCnt > 1024) {
1265 +               { return MIG_ARRAY_TOO_LARGE; }
1266 +       }
1267 +       (void)memcpy((char *) InP->fileName, (const char *) fileName, fileNameCnt);
1268 +
1269 +       InP->fileNameCnt = fileNameCnt;
1270 +
1271 +       msgh_size_delta = _WALIGN_(fileNameCnt);
1272 +       msgh_size += msgh_size_delta;
1273 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
1274 +
1275 +       InP->line = line;
1276 +
1277 +       if (messageCnt > 1024) {
1278 +               { return MIG_ARRAY_TOO_LARGE; }
1279 +       }
1280 +       (void)memcpy((char *) InP->message, (const char *) message, messageCnt);
1281 +
1282 +       InP->messageCnt = messageCnt;
1283 +
1284 +       msgh_size += _WALIGN_(messageCnt);
1285 +       InP = &Mess.In;
1286 +       InP->Head.msgh_bits =
1287 +               MACH_MSGH_BITS(19, 0);
1288 +       /* msgh_size passed as argument */
1289 +       InP->Head.msgh_request_port = makePort;
1290 +       InP->Head.msgh_reply_port = MACH_PORT_NULL;
1291 +       InP->Head.msgh_id = 100;
1292 +
1293 +       __BeforeSendSimple(100, "alert_old")
1294 +       msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
1295 +       __AfterSendSimple(100, "alert_old")
1296 +               return msg_result;
1297 +    }
1298 +}
1299 +
1300 +/* SimpleRoutine alert */
1301 +mig_external kern_return_t make_alert
1302 +(
1303 +       mach_port_t makePort,
1304 +       int eventType,
1305 +       make_string_t functionName,
1306 +       mach_msg_type_number_t functionNameCnt,
1307 +       make_string_t fileName,
1308 +       mach_msg_type_number_t fileNameCnt,
1309 +       make_string_t directory,
1310 +       mach_msg_type_number_t directoryCnt,
1311 +       int line,
1312 +       make_string_t message,
1313 +       mach_msg_type_number_t messageCnt
1314 +)
1315 +{
1316 +    {
1317 +       typedef struct {
1318 +               mach_msg_header_t Head;
1319 +               NDR_record_t NDR;
1320 +               int eventType;
1321 +               mach_msg_type_number_t functionNameCnt;
1322 +               char functionName[1024];
1323 +               mach_msg_type_number_t fileNameCnt;
1324 +               char fileName[1024];
1325 +               mach_msg_type_number_t directoryCnt;
1326 +               char directory[1024];
1327 +               int line;
1328 +               mach_msg_type_number_t messageCnt;
1329 +               char message[1024];
1330 +       } Request;
1331 +
1332 +       /*
1333 +        * typedef struct {
1334 +        *      mach_msg_header_t Head;
1335 +        *      NDR_record_t NDR;
1336 +        *      kern_return_t RetCode;
1337 +        * } mig_reply_error_t;
1338 +        */
1339 +
1340 +       union {
1341 +               Request In;
1342 +       } Mess;
1343 +
1344 +       register Request *InP = &Mess.In;
1345 +
1346 +       mach_msg_return_t msg_result;
1347 +       unsigned int msgh_size;
1348 +       unsigned int msgh_size_delta;
1349 +       __DeclareSendSimple(101, "alert")
1350 +
1351 +       InP->NDR = NDR_record;
1352 +
1353 +       InP->eventType = eventType;
1354 +
1355 +       if (functionNameCnt > 1024) {
1356 +               { return MIG_ARRAY_TOO_LARGE; }
1357 +       }
1358 +       (void)memcpy((char *) InP->functionName, (const char *) functionName, functionNameCnt);
1359 +
1360 +       InP->functionNameCnt = functionNameCnt;
1361 +
1362 +       msgh_size_delta = _WALIGN_(functionNameCnt);
1363 +       msgh_size = (sizeof(Request) - 4096) + msgh_size_delta;
1364 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
1365 +
1366 +       if (fileNameCnt > 1024) {
1367 +               { return MIG_ARRAY_TOO_LARGE; }
1368 +       }
1369 +       (void)memcpy((char *) InP->fileName, (const char *) fileName, fileNameCnt);
1370 +
1371 +       InP->fileNameCnt = fileNameCnt;
1372 +
1373 +       msgh_size_delta = _WALIGN_(fileNameCnt);
1374 +       msgh_size += msgh_size_delta;
1375 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
1376 +
1377 +       if (directoryCnt > 1024) {
1378 +               { return MIG_ARRAY_TOO_LARGE; }
1379 +       }
1380 +       (void)memcpy((char *) InP->directory, (const char *) directory, directoryCnt);
1381 +
1382 +       InP->directoryCnt = directoryCnt;
1383 +
1384 +       msgh_size_delta = _WALIGN_(directoryCnt);
1385 +       msgh_size += msgh_size_delta;
1386 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
1387 +
1388 +       InP->line = line;
1389 +
1390 +       if (messageCnt > 1024) {
1391 +               { return MIG_ARRAY_TOO_LARGE; }
1392 +       }
1393 +       (void)memcpy((char *) InP->message, (const char *) message, messageCnt);
1394 +
1395 +       InP->messageCnt = messageCnt;
1396 +
1397 +       msgh_size += _WALIGN_(messageCnt);
1398 +       InP = &Mess.In;
1399 +       InP->Head.msgh_bits =
1400 +               MACH_MSGH_BITS(19, 0);
1401 +       /* msgh_size passed as argument */
1402 +       InP->Head.msgh_request_port = makePort;
1403 +       InP->Head.msgh_reply_port = MACH_PORT_NULL;
1404 +       InP->Head.msgh_id = 101;
1405 +
1406 +       __BeforeSendSimple(101, "alert")
1407 +       msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
1408 +       __AfterSendSimple(101, "alert")
1409 +               return msg_result;
1410 +    }
1411 +}
1412 diff -bur ./Makefile /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/Makefile
1413 --- as/Makefile Fri Sep  6 18:27:10 2002
1414 +++ as/Makefile Sat Sep  6 23:52:22 2003
1415 @@ -2,7 +2,7 @@
1416  export USE_APPLE_PB_SUPPORT = all
1417  OFLAG = -O
1418  ifeq "macos" "$(RC_OS)"
1419 -  X_CFLAGS := $(shell if [ "$(RC_RELEASE)" != "Beaker" ] &&    \
1420 +  X_CFLAGS := $(shell if [ `uname` != "Linux" ] && [ "$(RC_RELEASE)" != "Beaker" ] &&    \
1421                          [ "$(RC_RELEASE)" != "Bunsen" ] &&    \
1422                          [ "$(RC_RELEASE)" != "Gonzo"  ] &&    \
1423                          [ "$(RC_RELEASE)" != "Kodiak" ]; then \
1424 @@ -11,10 +11,14 @@
1425  endif
1426  
1427  ifneq "mwccppc" "$(notdir $(CC))"
1428 +  ifeq "Linux" "$(shell uname)"
1429 +    GCC_FLAGS = -Wall $(X_CFLAGS) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__  -D__ppc__ -I/usr/include -I../../../macosx-include
1430 +  else
1431    GCC_FLAGS = -Wall -Wno-precomp $(X_CFLAGS)
1432 +  endif
1433  endif
1434  
1435 -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
1436 +USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
1437              echo YES ; else echo NO ; \
1438              fi; )
1439  
1440 diff -bur ./app.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/app.h
1441 --- as/app.h    Tue Apr 30 00:37:17 2002
1442 +++ as/app.h    Sat Sep  6 23:49:28 2003
1443 @@ -1,4 +1,4 @@
1444 -#import <stdio.h>
1445 +#include <stdio.h>
1446  
1447  extern FILE *scrub_file;
1448  extern char *scrub_string;
1449 diff -bur ./as.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/as.h
1450 --- as/as.h     Tue Apr 30 00:37:17 2002
1451 +++ as/as.h     Sat Sep  6 23:49:28 2003
1452 @@ -43,10 +43,10 @@
1453   */
1454  #undef SUSPECT
1455  
1456 -/* These #imports are for type definitions etc. */
1457 -#import <stdio.h>
1458 -#import <assert.h>
1459 -#import <mach/machine.h>
1460 +/* These #includes are for type definitions etc. */
1461 +#include <stdio.h>
1462 +#include <assert.h>
1463 +#include <mach/machine.h>
1464  
1465  /* These defines are potentially useful */
1466  #undef FALSE
1467 Only in /home/megacz/xwt/upstream/darwin-linker/src/cctools/as: asparc_dir
1468 diff -bur ./atof-ieee.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/atof-ieee.h
1469 --- as/atof-ieee.h      Tue Apr 30 00:37:17 2002
1470 +++ as/atof-ieee.h      Sat Sep  6 23:49:28 2003
1471 @@ -1,4 +1,4 @@
1472 -#import "flonum.h"
1473 +#include "flonum.h"
1474  
1475  extern char *atof_ieee(
1476      char *str,
1477 diff -bur ./bignum.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/bignum.h
1478 --- as/bignum.h Tue Apr 30 00:37:17 2002
1479 +++ as/bignum.h Sat Sep  6 23:53:27 2003
1480 @@ -28,6 +28,8 @@
1481  *      Bignums are >= 0.                                               *
1482  *                                                                      *
1483  \***********************************************************************/
1484 +#ifndef __BIGNUM_H__
1485 +#define __BIGNUM_H__
1486  
1487  #define        LITTLENUM_NUMBER_OF_BITS        (16)
1488  #define        LITTLENUM_RADIX                 (1 << LITTLENUM_NUMBER_OF_BITS)
1489 @@ -44,3 +46,4 @@
1490  /* JF truncated this to get around a problem with GCC */
1491  #define        LOG_TO_BASE_2_OF_10     (3.3219280948873623478703194294893901758651)
1492  /* WARNING: I haven't checked that the trailing digits are correct! */
1493 +#endif
1494 diff -bur ./expr.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/expr.h
1495 --- as/expr.h   Fri Sep  6 18:27:10 2002
1496 +++ as/expr.h   Sat Sep  6 23:49:28 2003
1497 @@ -19,9 +19,9 @@
1498  along with GAS; see the file COPYING.  If not, write to
1499  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
1500  
1501 -#import "struc-symbol.h"
1502 -#import "bignum.h"
1503 -#import "flonum.h"
1504 +#include "struc-symbol.h"
1505 +#include "bignum.h"
1506 +#include "flonum.h"
1507  
1508  /*
1509   * This table describes the use of segments as EXPRESSION types.
1510 diff -bur ./flonum.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/flonum.h
1511 --- as/flonum.h Fri Sep  6 18:27:10 2002
1512 +++ as/flonum.h Sat Sep  6 23:49:28 2003
1513 @@ -32,7 +32,7 @@
1514  *                                                                      *
1515  \***********************************************************************/
1516  
1517 -#import "bignum.h"
1518 +#include "bignum.h"
1519  
1520  /***********************************************************************\
1521  *                                                                      *
1522 diff -bur ./frags.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/frags.h
1523 --- as/frags.h  Tue Jan 14 23:35:18 2003
1524 +++ as/frags.h  Sat Sep  6 23:49:28 2003
1525 @@ -19,8 +19,8 @@
1526  along with GAS; see the file COPYING.  If not, write to
1527  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
1528  
1529 -#import "relax.h"
1530 -#import "struc-symbol.h"
1531 +#include "relax.h"
1532 +#include "struc-symbol.h"
1533  
1534  /*
1535   * A code fragment (frag) is some known number of chars, followed by some
1536 diff -bur ./md.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/md.h
1537 --- as/md.h     Tue Apr 30 00:37:17 2002
1538 +++ as/md.h     Sat Sep  6 23:49:29 2003
1539 @@ -19,13 +19,13 @@
1540  in a file named COPYING.  Among other things, the copyright
1541  notice and this notice must be preserved on all copies.  */
1542  
1543 -#import <mach/machine.h>
1544 -#import "stuff/bytesex.h"
1545 -#import "frags.h"
1546 -#import "relax.h"
1547 -#import "struc-symbol.h"
1548 -#import "fixes.h"
1549 -#import "read.h"
1550 +#include <mach/machine.h>
1551 +#include "stuff/bytesex.h"
1552 +#include "frags.h"
1553 +#include "relax.h"
1554 +#include "struc-symbol.h"
1555 +#include "fixes.h"
1556 +#include "read.h"
1557  
1558  /* These are the default cputype and cpusubtype for this target MACHINE */
1559  extern const cpu_type_t md_cputype;
1560 diff -bur ./read.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/read.h
1561 --- as/read.h   Fri Sep  6 18:27:13 2002
1562 +++ as/read.h   Sat Sep  6 23:49:29 2003
1563 @@ -19,7 +19,7 @@
1564  along with GAS; see the file COPYING.  If not, write to
1565  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
1566  
1567 -#import "expr.h"
1568 +#include "expr.h"
1569  
1570  #define PERMIT_WHITESPACE      /* Define to make whitespace be allowed in */
1571                                 /* many syntactically unnecessary places. */
1572 diff -bur ./relax.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/relax.h
1573 --- as/relax.h  Tue Apr 30 00:37:17 2002
1574 +++ as/relax.h  Sat Sep  6 23:53:35 2003
1575 @@ -1,3 +1,5 @@
1576 +#ifndef __RELAX_H__
1577 +#define __RELAX_H__
1578  /* The type used for a target address */
1579  typedef unsigned long relax_addressT;
1580  
1581 @@ -42,3 +44,4 @@
1582      relax_substateT rlx_more;    /* Next longer relax-state. */
1583                                   /* 0 means there is no 'next' relax-state. */
1584  } relax_typeS;
1585 +#endif
1586 diff -bur ./sections.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/sections.h
1587 --- as/sections.h       Tue Apr 30 00:37:17 2002
1588 +++ as/sections.h       Sat Sep  6 23:49:29 2003
1589 @@ -17,8 +17,8 @@
1590  along with GAS; see the file COPYING.  If not, write to
1591  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
1592  
1593 -#import <mach-o/loader.h>
1594 -#import "struc-symbol.h"
1595 +#include <mach-o/loader.h>
1596 +#include "struc-symbol.h"
1597  
1598  /*
1599   * For every section the user mentions in the assembley program, we make one
1600 diff -bur ./struc-symbol.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/struc-symbol.h
1601 --- as/struc-symbol.h   Fri Sep  6 18:27:14 2002
1602 +++ as/struc-symbol.h   Sat Sep  6 23:49:29 2003
1603 @@ -20,7 +20,7 @@
1604  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
1605  
1606  #ifdef NeXT_MOD
1607 -#import <mach-o/nlist.h>
1608 +#include <mach-o/nlist.h>
1609  #else /* !defined(NeXT_MOD) */
1610  #ifndef                VMS
1611  #include "a.out.h"             /* Needed to define struct nlist. Sigh. */
1612 diff -bur ./symbols.h /home/megacz/xwt/upstream/darwin-linker/src/cctools/as/symbols.h
1613 --- as/symbols.h        Tue Apr 30 00:37:17 2002
1614 +++ as/symbols.h        Sat Sep  6 23:49:29 2003
1615 @@ -17,8 +17,8 @@
1616  along with GAS; see the file COPYING.  If not, write to
1617  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
1618  
1619 -#import "struc-symbol.h"
1620 -#import "hash.h"
1621 +#include "struc-symbol.h"
1622 +#include "hash.h"
1623  
1624  extern struct hash_control *sy_hash;
1625  extern struct obstack notes;
1626 --- as/make.h   Sun Sep  7 00:01:26 2003
1627 +++ as/make.h   Sat Sep  6 23:55:11 2003
1628 @@ -0,0 +1,161 @@
1629 +#ifndef        _make_user_
1630 +#define        _make_user_
1631 +
1632 +/* Module make */
1633 +
1634 +#include <string.h>
1635 +#include <mach/ndr.h>
1636 +#include <mach/boolean.h>
1637 +#include <mach/kern_return.h>
1638 +#include <mach/notify.h>
1639 +#include <mach/mach_types.h>
1640 +#include <mach/message.h>
1641 +#include <mach/mig_errors.h>
1642 +#include <mach/port.h>
1643 +
1644 +#ifdef AUTOTEST
1645 +#ifndef FUNCTION_PTR_T
1646 +#define FUNCTION_PTR_T
1647 +typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
1648 +typedef struct {
1649 +        char            *name;
1650 +        function_ptr_t  function;
1651 +} function_table_entry;
1652 +typedef function_table_entry   *function_table_t;
1653 +#endif /* FUNCTION_PTR_T */
1654 +#endif /* AUTOTEST */
1655 +
1656 +#ifndef        make_MSG_COUNT
1657 +#define        make_MSG_COUNT  2
1658 +#endif /* make_MSG_COUNT */
1659 +
1660 +#include <mach/std_types.h>
1661 +#include <mach/mig.h>
1662 +#include "make_defs.h"
1663 +
1664 +#ifdef __BeforeMigUserHeader
1665 +__BeforeMigUserHeader
1666 +#endif /* __BeforeMigUserHeader */
1667 +
1668 +
1669 +/* SimpleRoutine alert_old */
1670 +#ifdef mig_external
1671 +mig_external
1672 +#else
1673 +extern
1674 +#endif /* mig_external */
1675 +kern_return_t make_alert_old
1676 +(
1677 +       mach_port_t makePort,
1678 +       int eventType,
1679 +       make_string_t functionName,
1680 +       mach_msg_type_number_t functionNameCnt,
1681 +       make_string_t fileName,
1682 +       mach_msg_type_number_t fileNameCnt,
1683 +       int line,
1684 +       make_string_t message,
1685 +       mach_msg_type_number_t messageCnt
1686 +);
1687 +
1688 +/* SimpleRoutine alert */
1689 +#ifdef mig_external
1690 +mig_external
1691 +#else
1692 +extern
1693 +#endif /* mig_external */
1694 +kern_return_t make_alert
1695 +(
1696 +       mach_port_t makePort,
1697 +       int eventType,
1698 +       make_string_t functionName,
1699 +       mach_msg_type_number_t functionNameCnt,
1700 +       make_string_t fileName,
1701 +       mach_msg_type_number_t fileNameCnt,
1702 +       make_string_t directory,
1703 +       mach_msg_type_number_t directoryCnt,
1704 +       int line,
1705 +       make_string_t message,
1706 +       mach_msg_type_number_t messageCnt
1707 +);
1708 +/* typedefs for all requests */
1709 +
1710 +#ifndef __Request__make_subsystem__defined
1711 +#define __Request__make_subsystem__defined
1712 +       typedef struct {
1713 +               mach_msg_header_t Head;
1714 +               NDR_record_t NDR;
1715 +               int eventType;
1716 +               mach_msg_type_number_t functionNameCnt;
1717 +               char functionName[1024];
1718 +               mach_msg_type_number_t fileNameCnt;
1719 +               char fileName[1024];
1720 +               int line;
1721 +               mach_msg_type_number_t messageCnt;
1722 +               char message[1024];
1723 +       } __Request__alert_old_t;
1724 +
1725 +       typedef struct {
1726 +               mach_msg_header_t Head;
1727 +               NDR_record_t NDR;
1728 +               int eventType;
1729 +               mach_msg_type_number_t functionNameCnt;
1730 +               char functionName[1024];
1731 +               mach_msg_type_number_t fileNameCnt;
1732 +               char fileName[1024];
1733 +               mach_msg_type_number_t directoryCnt;
1734 +               char directory[1024];
1735 +               int line;
1736 +               mach_msg_type_number_t messageCnt;
1737 +               char message[1024];
1738 +       } __Request__alert_t;
1739 +
1740 +#endif /* !__Request__make_subsystem__defined */
1741 +
1742 +/* union of all requests */
1743 +
1744 +#ifndef __RequestUnion__make_make_subsystem__defined
1745 +#define __RequestUnion__make_make_subsystem__defined
1746 +union __RequestUnion__make_make_subsystem {
1747 +       __Request__alert_old_t Request_make_alert_old;
1748 +       __Request__alert_t Request_make_alert;
1749 +};
1750 +#endif /* !__RequestUnion__make_make_subsystem__defined */
1751 +/* typedefs for all replies */
1752 +
1753 +#ifndef __Reply__make_subsystem__defined
1754 +#define __Reply__make_subsystem__defined
1755 +       typedef struct {
1756 +               mach_msg_header_t Head;
1757 +               NDR_record_t NDR;
1758 +               kern_return_t RetCode;
1759 +       } __Reply__alert_old_t;
1760 +
1761 +       typedef struct {
1762 +               mach_msg_header_t Head;
1763 +               NDR_record_t NDR;
1764 +               kern_return_t RetCode;
1765 +       } __Reply__alert_t;
1766 +
1767 +#endif /* !__Reply__make_subsystem__defined */
1768 +
1769 +/* union of all replies */
1770 +
1771 +#ifndef __ReplyUnion__make_make_subsystem__defined
1772 +#define __ReplyUnion__make_make_subsystem__defined
1773 +union __ReplyUnion__make_make_subsystem {
1774 +       __Reply__alert_old_t Reply_make_alert_old;
1775 +       __Reply__alert_t Reply_make_alert;
1776 +};
1777 +#endif /* !__RequestUnion__make_make_subsystem__defined */
1778 +
1779 +#ifndef subsystem_to_name_map_make
1780 +#define subsystem_to_name_map_make \
1781 +    { "alert_old", 100 },\
1782 +    { "alert", 101 }
1783 +#endif
1784 +
1785 +#ifdef __AfterMigUserHeader
1786 +__AfterMigUserHeader
1787 +#endif /* __AfterMigUserHeader */
1788 +
1789 +#endif  /* _make_user_ */
1790 --- as/makeUser.c       Sun Sep  7 00:01:26 2003
1791 +++ as/makeUser.c       Sat Sep  6 23:55:11 2003
1792 @@ -0,0 +1,305 @@
1793 +/*
1794 + * IDENTIFICATION:
1795 + * stub generated Sat Sep  6 23:50:34 2003
1796 + * with a MiG generated Tue Nov 5 01:17:50 PST 2002 by root@brixen
1797 + * OPTIONS: 
1798 + */
1799 +#include "make.h"
1800 +
1801 +
1802 +#ifndef        mig_internal
1803 +#define        mig_internal    static
1804 +#endif /* mig_internal */
1805 +
1806 +#ifndef        mig_external
1807 +#define mig_external
1808 +#endif /* mig_external */
1809 +
1810 +#ifndef        TypeCheck
1811 +#define        TypeCheck 0
1812 +#endif /* TypeCheck */
1813 +
1814 +#ifndef        LimitCheck
1815 +#define        LimitCheck 0
1816 +#endif /* LimitCheck */
1817 +
1818 +#ifndef        min
1819 +#define        min(a,b)  ( ((a) < (b))? (a): (b) )
1820 +#endif /* min */
1821 +
1822 +#ifndef        UseStaticTemplates
1823 +#define        UseStaticTemplates      0
1824 +#endif /* UseStaticTemplates */
1825 +
1826 +#define _WALIGN_(x) (((x) + 3) & ~3)
1827 +#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
1828 +#ifndef        __MachMsgErrorWithTimeout
1829 +#define        __MachMsgErrorWithTimeout(_R_) { \
1830 +       switch (_R_) { \
1831 +       case MACH_SEND_INVALID_REPLY: \
1832 +       case MACH_RCV_INVALID_NAME: \
1833 +       case MACH_RCV_PORT_DIED: \
1834 +       case MACH_RCV_PORT_CHANGED: \
1835 +       case MACH_RCV_TIMED_OUT: \
1836 +               mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
1837 +               break; \
1838 +       default: \
1839 +               mig_put_reply_port(InP->Head.msgh_reply_port); \
1840 +       } \
1841 +}
1842 +#endif /* __MachMsgErrorWithTimeout */
1843 +
1844 +#ifndef        __MachMsgErrorWithoutTimeout
1845 +#define        __MachMsgErrorWithoutTimeout(_R_) { \
1846 +       switch (_R_) { \
1847 +       case MACH_SEND_INVALID_REPLY: \
1848 +       case MACH_RCV_INVALID_NAME: \
1849 +       case MACH_RCV_PORT_DIED: \
1850 +       case MACH_RCV_PORT_CHANGED: \
1851 +               mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
1852 +               break; \
1853 +       default: \
1854 +               mig_put_reply_port(InP->Head.msgh_reply_port); \
1855 +       } \
1856 +}
1857 +#endif /* __MachMsgErrorWithoutTimeout */
1858 +
1859 +#ifndef        __DeclareSendRpc
1860 +#define        __DeclareSendRpc(_NUM_, _NAME_)
1861 +#endif /* __DeclareSendRpc */
1862 +
1863 +#ifndef        __BeforeSendRpc
1864 +#define        __BeforeSendRpc(_NUM_, _NAME_)
1865 +#endif /* __BeforeSendRpc */
1866 +
1867 +#ifndef        __AfterSendRpc
1868 +#define        __AfterSendRpc(_NUM_, _NAME_)
1869 +#endif /* __AfterSendRpc */
1870 +
1871 +#ifndef        __DeclareSendSimple
1872 +#define        __DeclareSendSimple(_NUM_, _NAME_)
1873 +#endif /* __DeclareSendSimple */
1874 +
1875 +#ifndef        __BeforeSendSimple
1876 +#define        __BeforeSendSimple(_NUM_, _NAME_)
1877 +#endif /* __BeforeSendSimple */
1878 +
1879 +#ifndef        __AfterSendSimple
1880 +#define        __AfterSendSimple(_NUM_, _NAME_)
1881 +#endif /* __AfterSendSimple */
1882 +
1883 +#define msgh_request_port      msgh_remote_port
1884 +#define msgh_reply_port                msgh_local_port
1885 +
1886 +
1887 +
1888 +/* SimpleRoutine alert_old */
1889 +mig_external kern_return_t make_alert_old
1890 +(
1891 +       mach_port_t makePort,
1892 +       int eventType,
1893 +       make_string_t functionName,
1894 +       mach_msg_type_number_t functionNameCnt,
1895 +       make_string_t fileName,
1896 +       mach_msg_type_number_t fileNameCnt,
1897 +       int line,
1898 +       make_string_t message,
1899 +       mach_msg_type_number_t messageCnt
1900 +)
1901 +{
1902 +    {
1903 +       typedef struct {
1904 +               mach_msg_header_t Head;
1905 +               NDR_record_t NDR;
1906 +               int eventType;
1907 +               mach_msg_type_number_t functionNameCnt;
1908 +               char functionName[1024];
1909 +               mach_msg_type_number_t fileNameCnt;
1910 +               char fileName[1024];
1911 +               int line;
1912 +               mach_msg_type_number_t messageCnt;
1913 +               char message[1024];
1914 +       } Request;
1915 +
1916 +       /*
1917 +        * typedef struct {
1918 +        *      mach_msg_header_t Head;
1919 +        *      NDR_record_t NDR;
1920 +        *      kern_return_t RetCode;
1921 +        * } mig_reply_error_t;
1922 +        */
1923 +
1924 +       union {
1925 +               Request In;
1926 +       } Mess;
1927 +
1928 +       register Request *InP = &Mess.In;
1929 +
1930 +       mach_msg_return_t msg_result;
1931 +       unsigned int msgh_size;
1932 +       unsigned int msgh_size_delta;
1933 +       __DeclareSendSimple(100, "alert_old")
1934 +
1935 +       InP->NDR = NDR_record;
1936 +
1937 +       InP->eventType = eventType;
1938 +
1939 +       if (functionNameCnt > 1024) {
1940 +               { return MIG_ARRAY_TOO_LARGE; }
1941 +       }
1942 +       (void)memcpy((char *) InP->functionName, (const char *) functionName, functionNameCnt);
1943 +
1944 +       InP->functionNameCnt = functionNameCnt;
1945 +
1946 +       msgh_size_delta = _WALIGN_(functionNameCnt);
1947 +       msgh_size = (sizeof(Request) - 3072) + msgh_size_delta;
1948 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
1949 +
1950 +       if (fileNameCnt > 1024) {
1951 +               { return MIG_ARRAY_TOO_LARGE; }
1952 +       }
1953 +       (void)memcpy((char *) InP->fileName, (const char *) fileName, fileNameCnt);
1954 +
1955 +       InP->fileNameCnt = fileNameCnt;
1956 +
1957 +       msgh_size_delta = _WALIGN_(fileNameCnt);
1958 +       msgh_size += msgh_size_delta;
1959 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
1960 +
1961 +       InP->line = line;
1962 +
1963 +       if (messageCnt > 1024) {
1964 +               { return MIG_ARRAY_TOO_LARGE; }
1965 +       }
1966 +       (void)memcpy((char *) InP->message, (const char *) message, messageCnt);
1967 +
1968 +       InP->messageCnt = messageCnt;
1969 +
1970 +       msgh_size += _WALIGN_(messageCnt);
1971 +       InP = &Mess.In;
1972 +       InP->Head.msgh_bits =
1973 +               MACH_MSGH_BITS(19, 0);
1974 +       /* msgh_size passed as argument */
1975 +       InP->Head.msgh_request_port = makePort;
1976 +       InP->Head.msgh_reply_port = MACH_PORT_NULL;
1977 +       InP->Head.msgh_id = 100;
1978 +
1979 +       __BeforeSendSimple(100, "alert_old")
1980 +       msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
1981 +       __AfterSendSimple(100, "alert_old")
1982 +               return msg_result;
1983 +    }
1984 +}
1985 +
1986 +/* SimpleRoutine alert */
1987 +mig_external kern_return_t make_alert
1988 +(
1989 +       mach_port_t makePort,
1990 +       int eventType,
1991 +       make_string_t functionName,
1992 +       mach_msg_type_number_t functionNameCnt,
1993 +       make_string_t fileName,
1994 +       mach_msg_type_number_t fileNameCnt,
1995 +       make_string_t directory,
1996 +       mach_msg_type_number_t directoryCnt,
1997 +       int line,
1998 +       make_string_t message,
1999 +       mach_msg_type_number_t messageCnt
2000 +)
2001 +{
2002 +    {
2003 +       typedef struct {
2004 +               mach_msg_header_t Head;
2005 +               NDR_record_t NDR;
2006 +               int eventType;
2007 +               mach_msg_type_number_t functionNameCnt;
2008 +               char functionName[1024];
2009 +               mach_msg_type_number_t fileNameCnt;
2010 +               char fileName[1024];
2011 +               mach_msg_type_number_t directoryCnt;
2012 +               char directory[1024];
2013 +               int line;
2014 +               mach_msg_type_number_t messageCnt;
2015 +               char message[1024];
2016 +       } Request;
2017 +
2018 +       /*
2019 +        * typedef struct {
2020 +        *      mach_msg_header_t Head;
2021 +        *      NDR_record_t NDR;
2022 +        *      kern_return_t RetCode;
2023 +        * } mig_reply_error_t;
2024 +        */
2025 +
2026 +       union {
2027 +               Request In;
2028 +       } Mess;
2029 +
2030 +       register Request *InP = &Mess.In;
2031 +
2032 +       mach_msg_return_t msg_result;
2033 +       unsigned int msgh_size;
2034 +       unsigned int msgh_size_delta;
2035 +       __DeclareSendSimple(101, "alert")
2036 +
2037 +       InP->NDR = NDR_record;
2038 +
2039 +       InP->eventType = eventType;
2040 +
2041 +       if (functionNameCnt > 1024) {
2042 +               { return MIG_ARRAY_TOO_LARGE; }
2043 +       }
2044 +       (void)memcpy((char *) InP->functionName, (const char *) functionName, functionNameCnt);
2045 +
2046 +       InP->functionNameCnt = functionNameCnt;
2047 +
2048 +       msgh_size_delta = _WALIGN_(functionNameCnt);
2049 +       msgh_size = (sizeof(Request) - 4096) + msgh_size_delta;
2050 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
2051 +
2052 +       if (fileNameCnt > 1024) {
2053 +               { return MIG_ARRAY_TOO_LARGE; }
2054 +       }
2055 +       (void)memcpy((char *) InP->fileName, (const char *) fileName, fileNameCnt);
2056 +
2057 +       InP->fileNameCnt = fileNameCnt;
2058 +
2059 +       msgh_size_delta = _WALIGN_(fileNameCnt);
2060 +       msgh_size += msgh_size_delta;
2061 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
2062 +
2063 +       if (directoryCnt > 1024) {
2064 +               { return MIG_ARRAY_TOO_LARGE; }
2065 +       }
2066 +       (void)memcpy((char *) InP->directory, (const char *) directory, directoryCnt);
2067 +
2068 +       InP->directoryCnt = directoryCnt;
2069 +
2070 +       msgh_size_delta = _WALIGN_(directoryCnt);
2071 +       msgh_size += msgh_size_delta;
2072 +       InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
2073 +
2074 +       InP->line = line;
2075 +
2076 +       if (messageCnt > 1024) {
2077 +               { return MIG_ARRAY_TOO_LARGE; }
2078 +       }
2079 +       (void)memcpy((char *) InP->message, (const char *) message, messageCnt);
2080 +
2081 +       InP->messageCnt = messageCnt;
2082 +
2083 +       msgh_size += _WALIGN_(messageCnt);
2084 +       InP = &Mess.In;
2085 +       InP->Head.msgh_bits =
2086 +               MACH_MSGH_BITS(19, 0);
2087 +       /* msgh_size passed as argument */
2088 +       InP->Head.msgh_request_port = makePort;
2089 +       InP->Head.msgh_reply_port = MACH_PORT_NULL;
2090 +       InP->Head.msgh_id = 101;
2091 +
2092 +       __BeforeSendSimple(101, "alert")
2093 +       msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, msgh_size, 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
2094 +       __AfterSendSimple(101, "alert")
2095 +               return msg_result;
2096 +    }
2097 +}
2098 --- ar/contents.c       30 Apr 2002 07:37:17 -0000      1.1.1.1
2099 +++ ar/contents.c       7 Sep 2003 08:55:11 -0000
2100 @@ -76,7 +76,6 @@
2101  #include <fcntl.h>
2102  #include <stdio.h>
2103  #include <string.h>
2104 -#include <tzfile.h>
2105  #include <unistd.h>
2106  
2107  #include "archive.h"
2108 @@ -103,12 +102,14 @@
2109                 else if (!(file = files(argv)))
2110                         goto next;
2111                 if (options & AR_V) {
2112 +/*
2113                         (void)strmode(chdr.mode, buf);
2114                         (void)printf("%s %6d/%-6d %8qd ",
2115                             buf + 1, chdr.uid, chdr.gid, chdr.size);
2116                         tp = localtime(&chdr.date);
2117                         (void)strftime(buf, sizeof(buf), "%b %e %H:%M %Y", tp);
2118                         (void)printf("%s %s\n", buf, file);
2119 +*/
2120                 } else
2121                         (void)printf("%s\n", file);
2122                 if (!all && !*argv)
2123 --- ar/misc.c   30 Apr 2002 07:37:17 -0000      1.1.1.1
2124 +++ ar/misc.c   7 Sep 2003 08:55:11 -0000
2125 @@ -68,6 +68,7 @@
2126  #endif /* not lint */
2127  
2128  #include <sys/param.h>
2129 +#define EFTYPE          79              /* Inappropriate file type or format */
2130  
2131  #include <dirent.h>
2132  #include <err.h>
2133 --- ar/vers_string      Sun Sep  7 01:55:10 2003
2134 +++ ar/vers_string      Sun Sep  7 01:53:23 2003
2135 @@ -0,0 +1,125 @@
2136 +#!/bin/sh
2137 +##
2138 +# Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
2139 +#
2140 +# @APPLE_LICENSE_HEADER_START@
2141 +# 
2142 +# "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
2143 +# Reserved.  This file contains Original Code and/or Modifications of
2144 +# Original Code as defined in and that are subject to the Apple Public
2145 +# Source License Version 1.0 (the 'License').  You may not use this file
2146 +# except in compliance with the License.  Please obtain a copy of the
2147 +# License at http://www.apple.com/publicsource and read it before using
2148 +# this file.
2149 +# 
2150 +# The Original Code and all software distributed under the License are
2151 +# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
2152 +# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
2153 +# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2154 +# FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
2155 +# License for the specific language governing rights and limitations
2156 +# under the License."
2157 +# 
2158 +# @APPLE_LICENSE_HEADER_END@
2159 +##
2160 +#
2161 +# vers_string PROGRAM [STAMPED_NAME]
2162 +#
2163 +# Output a string suitable for use as a version identifier
2164 +#
2165 +
2166 +##
2167 +# Usage
2168 +##
2169 +
2170 +program=$(basename $0);
2171 +
2172 +usage ()
2173 +{
2174 +    echo "Usage: ${program} [<options>] <program> [<stamped_name>]";
2175 +    echo "     <program>: ???";
2176 +    echo "     <stamped_name>: ???";
2177 +    echo "Options: ???";
2178 +}
2179 +
2180 +##
2181 +# Handle command line
2182 +##
2183 +
2184 +  Date=$(date);
2185 +Format=''\''PROGRAM:'\''"${Program}"'\''  PROJECT:'\''"${Version}"'\''  DEVELOPER:'\''"${USER}"'\''  BUILT:'\''"${Date}"'\'''\''';
2186 +
2187 +if ! args=$(getopt cflBn $*); then usage; fi;
2188 +set -- ${args};
2189 +for option; do
2190 +    case "${option}" in
2191 +      -c)
2192 +        Format=''\''#include <sys/cdefs.h>
2193 +#ifndef __IDSTRING
2194 +#define __IDSTRING(name,string) \
2195 +     static const char name[] __attribute__((__unused__)) = string
2196 +#endif
2197 +__IDSTRING(SGS_VERS,"@(#)PROGRAM:'\''"${Program}"'\''  PROJECT:'\''"${Version}"'\''  DEVELOPER:'\''"${USER}"'\''  BUILT:'\''"${Date}"'\''\n");
2198 +__IDSTRING(VERS_NUM,"'\''${Revision}'\''");'\''';
2199 +       shift;
2200 +       ;;
2201 +      -f)
2202 +        Format='"${Program}"'\''-'\''"${Revision}"';
2203 +       shift;
2204 +       ;;
2205 +      -l)
2206 +        Format=''\''#include <sys/cdefs.h>
2207 +#ifndef __IDSTRING
2208 +#define __IDSTRING(name,string) \
2209 +       const char name[] __attribute__((__unused__)) = string
2210 +#endif
2211 +__IDSTRING(SGS_VERS,"@(#)LIBRARY:'\''"${Program}"'\''  PROJECT:'\''"${Version}"'\''  DEVELOPER:'\''"${USER}"'\''  BUILT:'\''"${Date}"'\''\n");'\''';
2212 +       shift;
2213 +       ;;
2214 +      -B)
2215 +        date="NO DATE SET (-B used)";
2216 +       shift;
2217 +       ;;
2218 +      -n)
2219 +        Format='"${Revision}"';
2220 +       shift;
2221 +       ;;
2222 +      --)
2223 +       shift;
2224 +       break;
2225 +       ;;
2226 +    esac;
2227 +done;
2228 +
2229 +Program=$1; if [ $# != 0 ]; then shift; fi;
2230 +Version=$1; if [ $# != 0 ]; then shift; fi;
2231 +
2232 +if [ $# != 0 ]; then usage; fi;
2233 +
2234 +if [ -z "${Program}" ]; then Program="Unknown"; fi;
2235 +
2236 +if [ -n "${Version}" ]; then
2237 +    if ! Revision=$(expr "${Version}" : '.*-\(.*\)'); then
2238 +       echo "${program}: No hyphen in project root ${Version}" >&2
2239 +       exit 1;
2240 +    fi;
2241 +else
2242 +    CurrentDir=$(/bin/pwd);
2243 +       Version=$(basename "${CurrentDir}");
2244 +    while [ "${Version}" != "${CurrentDir}" ]; do
2245 +       if Revision=$(expr "${Version}" : '.*-\(.*\)'); then break; fi;
2246 +       CurrentDir=$(dirname  "${CurrentDir}");
2247 +          Version=$(basename "${CurrentDir}");
2248 +    done;
2249 +    if [ "${Version}" = "${CurrentDir}" ]; then
2250 +       CurrentDir=$(/bin/pwd);
2251 +       echo "${program}: No hyphen in project root ${CurrentDir}" >&2
2252 +       echo "${program}: Could not determine version" >&2
2253 +        Version="Unknown";
2254 +       Revision="";
2255 +    fi;
2256 +fi;
2257 +
2258 +if [ -z "${USER}" ]; then USER=$(whoami); fi;
2259 +
2260 +echo "$(eval echo "${Format}")";
2261 --- ar/Makefile 7 Sep 2002 01:27:09 -0000       1.1.1.2
2262 +++ ar/Makefile 7 Sep 2003 09:03:52 -0000
2263 @@ -2,12 +2,16 @@
2264  ifeq "mwccppc" "$(notdir $(CC))"
2265    CFLAGS = -g $(OFLAG) -I$(SRCROOT)/../include
2266  else
2267 -  CFLAGS = -g $(OFLAG) -Wall -Wno-precomp -I$(SRCROOT)/../include
2268 +  ifeq "Linux" "$(shell uname)"
2269 +    CFLAGS = -Wall $(X_CFLAGS) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__  -D__ppc__ -I/usr/include -I../../macosx-include -I../include
2270 +  else
2271 +    CFLAGS = -g $(OFLAG) -Wall -Wno-precomp -I$(SRCROOT)/../include
2272 +  endif
2273  endif
2274  
2275  LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff
2276  
2277 -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
2278 +USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
2279              echo YES ; else echo NO ; \
2280              fi; )
2281  
2282 @@ -43,7 +47,8 @@
2283         $(CC) $(CFLAGS) $(RC_CFLAGS) -o $(SYMROOT)/$@ $(OBJS) $(LIBSTUFF)
2284  
2285  vers.c:
2286 -       vers_string -c $(VERS_STRING_FLAGS) $(PRODUCT) > $(OFILE_DIR)/$@
2287 +       chmod +x vers_string
2288 +       ./vers_string -c $(VERS_STRING_FLAGS) $(PRODUCT) > $(OFILE_DIR)/$@
2289  
2290  ifeq "NO" "$(USE_DEPENDENCY_FILE)"
2291  .c.o:
2292 --- ar/archive.c        30 Apr 2002 07:37:17 -0000      1.1.1.1
2293 +++ ar/archive.c        7 Sep 2003 10:15:36 -0000
2294 @@ -69,6 +69,7 @@
2295  
2296  #include <sys/param.h>
2297  #include <sys/stat.h>
2298 +#include <stuff/ofile.h>
2299  
2300  #include <ar.h>
2301  #include <dirent.h>
2302 @@ -261,32 +262,17 @@
2303                  * a space, use extended format 1.
2304                  */
2305                 lname = strlen(name);
2306 -               if (options & AR_TR) {
2307                         if (lname > OLDARMAXNAME) {
2308                                 (void)fflush(stdout);
2309                                 warnx("warning: %s truncated to %.*s",
2310                                     name, OLDARMAXNAME, name);
2311                                 (void)fflush(stderr);
2312                         }
2313 -                       (void)sprintf(hb, HDR3, name, (long int)sb->st_mtimespec.tv_sec,
2314 +                       (void)sprintf(hb, HDR3, name, (long int)0,
2315                             (unsigned int)(u_short)sb->st_uid,
2316                             (unsigned int)(u_short)sb->st_gid,
2317                             sb->st_mode, sb->st_size, ARFMAG);
2318                         lname = 0;
2319 -               } else if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
2320 -                       (void)sprintf(hb, HDR1, AR_EFMT1, (lname + 3) & ~3,
2321 -                           (long int)sb->st_mtimespec.tv_sec,
2322 -                           (unsigned int)(u_short)sb->st_uid,
2323 -                           (unsigned int)(u_short)sb->st_gid,
2324 -                           sb->st_mode, sb->st_size + ((lname + 3) & ~3),
2325 -                           ARFMAG);
2326 -               else {
2327 -                       lname = 0;
2328 -                       (void)sprintf(hb, HDR2, name, (long int)sb->st_mtimespec.tv_sec,
2329 -                           (unsigned int)(u_short)sb->st_uid,
2330 -                           (unsigned int)(u_short)sb->st_gid,
2331 -                           sb->st_mode, sb->st_size, ARFMAG);
2332 -               }
2333                 size = sb->st_size;
2334         } else {
2335                 lname = chdr.lname;