2003/09/07 05:30:42
[org.ibex.core.git] / upstream / darwin-linker / patches / cctools.patch
diff --git a/upstream/darwin-linker/patches/cctools.patch b/upstream/darwin-linker/patches/cctools.patch
new file mode 100644 (file)
index 0000000..4826ffe
--- /dev/null
@@ -0,0 +1,939 @@
+diff -rub ./include/architecture/i386/fpu.h ./include/architecture/i386/fpu.h
+--- ./include/architecture/i386/fpu.h  Thu May  6 19:24:30 1999
++++ ./include/architecture/i386/fpu.h  Mon Aug 25 12:56:22 2003
+@@ -121,7 +121,7 @@
+                                       :3;
+ } fp_control_t;
+-#import <architecture/i386/sel.h>
++#include <architecture/i386/sel.h>
+ /*
+  * Floating point 'environment'
+diff -rub ./include/architecture/i386/frame.h ./include/architecture/i386/frame.h
+--- ./include/architecture/i386/frame.h        Thu May  6 19:24:33 1999
++++ ./include/architecture/i386/frame.h        Mon Aug 25 12:56:22 2003
+@@ -63,7 +63,7 @@
+     } pgfault;
+ } err_code_t;
+-#import <architecture/i386/sel.h>
++#include <architecture/i386/sel.h>
+ /*
+  * The actual hardware exception frame
+diff -rub ./include/architecture/m88k/fp_regs.h ./include/architecture/m88k/fp_regs.h
+--- ./include/architecture/m88k/fp_regs.h      Wed Oct  9 18:47:37 2002
++++ ./include/architecture/m88k/fp_regs.h      Mon Aug 25 12:56:22 2003
+@@ -37,7 +37,7 @@
+ #ifndef       _ARCH_M88K_FP_REGS_H_
+ #define       _ARCH_M88K_FP_REGS_H_
+-#import <architecture/m88k/reg_help.h>
++#include <architecture/m88k/reg_help.h>
+ /*
+  * m88k_xrf_t -- data types that MAY be in extended register file
+diff -rub ./include/architecture/m88k/reg_help.h ./include/architecture/m88k/reg_help.h
+--- ./include/architecture/m88k/reg_help.h     Wed Oct  9 18:47:39 2002
++++ ./include/architecture/m88k/reg_help.h     Mon Aug 25 12:56:22 2003
+@@ -37,7 +37,7 @@
+ #ifndef _ARCH_M88K_REG_HELP_H_
+ #define _ARCH_M88K_REG_HELP_H_
+-#import <architecture/nrw/reg_help.h>
++#include <architecture/nrw/reg_help.h>
+ /* Stack pointer must always be a multiple of 16 */
+ #define       STACK_INCR      16
+diff -rub ./include/mach/m88k/thread_status.h ./include/mach/m88k/thread_status.h
+--- ./include/mach/m88k/thread_status.h        Wed Oct  9 18:48:16 2002
++++ ./include/mach/m88k/thread_status.h        Mon Aug 25 12:56:22 2003
+@@ -45,8 +45,8 @@
+ #ifndef       _MACH_M88K_THREAD_STATE_
+ #define       _MACH_M88K_THREAD_STATE_
+-#import <architecture/m88k/fp_regs.h>
+-#import <architecture/m88k/reg_help.h>
++#include <architecture/m88k/fp_regs.h>
++#include <architecture/m88k/reg_help.h>
+ /**************************************************************************
+  * Data Typedefs used by thread_getstatus() and thread_setstatus()        *
+diff -rub ./include/mach/machine.h ./include/mach/machine.h
+--- ./include/mach/machine.h   Mon Feb 10 19:52:25 2003
++++ ./include/mach/machine.h   Mon Aug 25 12:56:22 2003
+@@ -81,8 +81,8 @@
+ #ifndef       _MACH_MACHINE_H_
+ #define _MACH_MACHINE_H_
+-#import <mach/machine/vm_types.h>
+-#import <mach/boolean.h>
++#include <mach/machine/vm_types.h>
++#include <mach/boolean.h>
+ /*
+  *    For each host, there is a maximum possible number of
+diff -rub ./include/mach-o/hppa/swap.h ./include/mach-o/hppa/swap.h
+--- ./include/mach-o/hppa/swap.h       Thu May  6 19:25:11 1999
++++ ./include/mach-o/hppa/swap.h       Mon Aug 25 12:56:22 2003
+@@ -21,8 +21,8 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#import <architecture/byte_order.h>
+-#import <mach/hppa/thread_status.h>
++#include <architecture/byte_order.h>
++#include <mach/hppa/thread_status.h>
+ extern void swap_hppa_integer_thread_state(
+     struct hp_pa_integer_thread_state *regs,
+diff -rub ./include/mach-o/i860/swap.h ./include/mach-o/i860/swap.h
+--- ./include/mach-o/i860/swap.h       Thu May  6 19:25:19 1999
++++ ./include/mach-o/i860/swap.h       Mon Aug 25 12:56:22 2003
+@@ -21,8 +21,8 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#import <architecture/byte_order.h>
+-#import <mach/i860/thread_status.h>
++#include <architecture/byte_order.h>
++#include <mach/i860/thread_status.h>
+ extern void swap_i860_thread_state_regs(
+     struct i860_thread_state_regs *cpu,
+diff -rub ./include/mach-o/m68k/swap.h ./include/mach-o/m68k/swap.h
+--- ./include/mach-o/m68k/swap.h       Thu May  6 19:25:26 1999
++++ ./include/mach-o/m68k/swap.h       Mon Aug 25 12:56:22 2003
+@@ -21,8 +21,8 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#import <architecture/byte_order.h>
+-#import <mach/m68k/thread_status.h>
++#include <architecture/byte_order.h>
++#include <mach/m68k/thread_status.h>
+ extern void swap_m68k_thread_state_regs(
+     struct m68k_thread_state_regs *cpu,
+diff -rub ./include/mach-o/m88k/swap.h ./include/mach-o/m88k/swap.h
+--- ./include/mach-o/m88k/swap.h       Thu May  6 19:25:31 1999
++++ ./include/mach-o/m88k/swap.h       Mon Aug 25 12:56:22 2003
+@@ -21,8 +21,8 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#import <architecture/byte_order.h>
+-#import <mach/m88k/thread_status.h>
++#include <architecture/byte_order.h>
++#include <mach/m88k/thread_status.h>
+ extern void swap_m88k_thread_state_grf_t(
+     m88k_thread_state_grf_t *cpu,
+diff -rub ./include/mach-o/rld.h ./include/mach-o/rld.h
+--- ./include/mach-o/rld.h     Tue Oct  2 15:19:03 2001
++++ ./include/mach-o/rld.h     Mon Aug 25 12:56:22 2003
+@@ -28,7 +28,7 @@
+ #ifndef _MACHO_RLD_H_
+ #define _MACHO_RLD_H_
+-#include <streams/streams.h>
++//~ #include <streams/streams.h>
+ #include <mach-o/loader.h>
+ extern long rld_load(
+diff -rub ./include/mach-o/sparc/swap.h ./include/mach-o/sparc/swap.h
+--- ./include/mach-o/sparc/swap.h      Thu May  6 19:25:56 1999
++++ ./include/mach-o/sparc/swap.h      Mon Aug 25 12:56:22 2003
+@@ -21,8 +21,8 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#import <architecture/byte_order.h>
+-#import <mach/sparc/thread_status.h>
++#include <architecture/byte_order.h>
++#include <mach/sparc/thread_status.h>
+ void swap_sparc_thread_state_regs(
+     struct sparc_thread_state_regs *cpu,
+diff -rub ./include/standalone/libsa.h ./include/standalone/libsa.h
+--- ./include/standalone/libsa.h       Mon Sep 11 15:03:00 2000
++++ ./include/standalone/libsa.h       Mon Aug 25 12:56:22 2003
+@@ -23,13 +23,13 @@
+  */
+ /* Exported API for standalone library */
+ #if !(defined(KLD) && defined(__STATIC__))
+-#import <mach/mach.h>
++#include <mach/mach.h>
+ #else /* defined(KLD) && defined(__STATIC__) */
+ #include <mach/kern_return.h>
+ #endif /* !(defined(KLD) && defined(__STATIC__)) */
+-#import <mach-o/loader.h>
+-#import <stdarg.h>
+-#import <stddef.h>
++#include <mach-o/loader.h>
++#include <stdarg.h>
++#include <stddef.h>
+ #ifndef bcopy
+ #ifdef __OPENSTEP__
+diff -rub ./include/stuff/allocate.h ./include/stuff/allocate.h
+--- ./include/stuff/allocate.h Thu May  6 19:26:24 1999
++++ ./include/stuff/allocate.h Mon Aug 25 13:08:44 2003
+@@ -21,8 +21,10 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+ /* defined in allocate.c */
+diff -rub ./include/stuff/arch.h ./include/stuff/arch.h
+--- ./include/stuff/arch.h     Mon Nov 19 12:09:40 2001
++++ ./include/stuff/arch.h     Mon Aug 25 13:10:15 2003
+@@ -24,15 +24,17 @@
+ #ifndef _STUFF_ARCH_H_
+ #define _STUFF_ARCH_H_
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+ /*
+  * This file contains the current known set of flags and constants for the
+  * known architectures.
+  */
+-#import <mach/machine.h>
+-#import <stuff/bytesex.h>
++#include <mach/machine.h>
++#include <stuff/bytesex.h>
+ /*
+  * The structure describing an architecture flag with the string of the flag
+diff -rub ./include/stuff/best_arch.h ./include/stuff/best_arch.h
+--- ./include/stuff/best_arch.h        Thu May  6 19:26:29 1999
++++ ./include/stuff/best_arch.h        Mon Aug 25 13:10:13 2003
+@@ -21,8 +21,10 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+ #include <mach/machine.h>
+diff -rub ./include/stuff/breakout.h ./include/stuff/breakout.h
+--- ./include/stuff/breakout.h Mon May  6 14:03:46 2002
++++ ./include/stuff/breakout.h Mon Aug 25 13:10:12 2003
+@@ -21,11 +21,13 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+-#import "stuff/ofile.h"
++#include "stuff/ofile.h"
+ /*
+  * The input files are broken out in to their object files and then placed in
+diff -rub ./include/stuff/bytesex.h ./include/stuff/bytesex.h
+--- ./include/stuff/bytesex.h  Mon Nov 19 12:09:42 2001
++++ ./include/stuff/bytesex.h  Mon Aug 25 13:10:10 2003
+@@ -25,23 +25,25 @@
+ #ifndef _STUFF_BYTESEX_H_
+ #define _STUFF_BYTESEX_H_
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+-#import <mach-o/fat.h>
+-#import <mach-o/loader.h>
+-#import <mach/m68k/thread_status.h>
+-#import <mach/ppc/thread_status.h>
+-#import <mach/m88k/thread_status.h>
+-#import <mach/i860/thread_status.h>
+-#import <mach/i386/thread_status.h>
+-#import <mach/hppa/thread_status.h>
+-#import <mach/sparc/thread_status.h>
+-#import <mach-o/nlist.h>
+-#import <mach-o/reloc.h>
+-#import <mach-o/ranlib.h>
+-#import "stuff/bool.h"
++#include <mach-o/fat.h>
++#include <mach-o/loader.h>
++#include <mach/m68k/thread_status.h>
++#include <mach/ppc/thread_status.h>
++#include <mach/m88k/thread_status.h>
++#include <mach/i860/thread_status.h>
++#include <mach/i386/thread_status.h>
++#include <mach/hppa/thread_status.h>
++#include <mach/sparc/thread_status.h>
++#include <mach-o/nlist.h>
++#include <mach-o/reloc.h>
++#include <mach-o/ranlib.h>
++#include "stuff/bool.h"
+ enum byte_sex {
+     UNKNOWN_BYTE_SEX,
+diff -rub ./include/stuff/errors.h ./include/stuff/errors.h
+--- ./include/stuff/errors.h   Thu May  6 19:26:40 1999
++++ ./include/stuff/errors.h   Mon Aug 25 13:09:00 2003
+@@ -21,11 +21,13 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+-#import "mach/mach.h"
++#include "mach/mach.h"
+ /* user defined (imported) */
+ __private_extern__ char *progname;
+diff -rub ./include/stuff/execute.h ./include/stuff/execute.h
+--- ./include/stuff/execute.h  Thu May  6 19:26:42 1999
++++ ./include/stuff/execute.h  Mon Aug 25 13:10:04 2003
+@@ -21,8 +21,10 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+ /*
+diff -rub ./include/stuff/hash_string.h ./include/stuff/hash_string.h
+--- ./include/stuff/hash_string.h      Thu May  6 19:26:45 1999
++++ ./include/stuff/hash_string.h      Mon Aug 25 13:10:32 2003
+@@ -21,8 +21,10 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+ __private_extern__ long hash_string(
+diff -rub ./include/stuff/hppa.h ./include/stuff/hppa.h
+--- ./include/stuff/hppa.h     Thu May  6 19:26:47 1999
++++ ./include/stuff/hppa.h     Mon Aug 25 13:10:40 2003
+@@ -21,8 +21,10 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+ __private_extern__ void calc_hppa_HILO(
+diff -rub ./include/stuff/ofile.h ./include/stuff/ofile.h
+--- ./include/stuff/ofile.h    Mon Feb 10 19:52:33 2003
++++ ./include/stuff/ofile.h    Mon Aug 25 13:10:51 2003
+@@ -25,21 +25,23 @@
+ #ifndef _STUFF_OFILE_H_
+ #define _STUFF_OFILE_H_
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+-#import <ar.h>
++#include <ar.h>
+ #ifndef AR_EFMT1
+ #define       AR_EFMT1        "#1/"           /* extended format #1 */
+ #endif
+-#import <mach-o/loader.h>
++#include <mach-o/loader.h>
+ #ifdef OFI
+-#import <mach-o/dyld.h>
++#include <mach-o/dyld.h>
+ #endif
+-#import "stuff/bytesex.h"
+-#import "stuff/bool.h"
+-#import "stuff/arch.h"
++#include "stuff/bytesex.h"
++#include "stuff/bool.h"
++#include "stuff/arch.h"
+ enum ofile_type {
+     OFILE_UNKNOWN,
+diff -rub ./include/stuff/print.h ./include/stuff/print.h
+--- ./include/stuff/print.h    Thu May  6 19:26:55 1999
++++ ./include/stuff/print.h    Mon Aug 25 13:10:58 2003
+@@ -21,11 +21,13 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+-#import <stdarg.h>
++#include <stdarg.h>
+ __private_extern__ void print(
+     const char *format, ...)
+diff -rub ./include/stuff/reloc.h ./include/stuff/reloc.h
+--- ./include/stuff/reloc.h    Thu May  6 19:26:57 1999
++++ ./include/stuff/reloc.h    Mon Aug 25 13:11:02 2003
+@@ -21,12 +21,14 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+-#import <mach/machine.h>
+-#import "stuff/bool.h"
++#include <mach/machine.h>
++#include "stuff/bool.h"
+ __private_extern__ unsigned long reloc_pair_r_type(
+     cpu_type_t cputype);
+diff -rub ./include/stuff/round.h ./include/stuff/round.h
+--- ./include/stuff/round.h    Fri Mar 14 18:18:29 2003
++++ ./include/stuff/round.h    Mon Aug 25 13:11:06 2003
+@@ -21,8 +21,10 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+ /*
+diff -rub ./include/stuff/symbol_list.h ./include/stuff/symbol_list.h
+--- ./include/stuff/symbol_list.h      Thu Oct 24 17:04:30 2002
++++ ./include/stuff/symbol_list.h      Mon Aug 25 13:19:46 2003
+@@ -1,6 +1,12 @@
+ #include <mach-o/nlist.h>
+ #include <stuff/bool.h>
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
++#define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
++#endif
++
+ /*
+  * Data structures to perform selective stripping of symbol table entries.
+  */
+diff -rub ./include/stuff/vm_flush_cache.h ./include/stuff/vm_flush_cache.h
+--- ./include/stuff/vm_flush_cache.h   Thu May  6 19:27:05 1999
++++ ./include/stuff/vm_flush_cache.h   Mon Aug 25 13:11:15 2003
+@@ -21,11 +21,13 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#if defined(__MWERKS__) && !defined(__private_extern__)
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
+ #define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
+ #endif
+-#import <mach/mach.h>
++#include <mach/mach.h>
+ __private_extern__ kern_return_t vm_flush_cache(
+     mach_port_t target_task,
+     vm_address_t address,
+diff -rub ./ld/Makefile ./ld/Makefile
+--- ./ld/Makefile      Fri Mar 14 18:18:29 2003
++++ ./ld/Makefile      Sat Sep  6 20:17:46 2003
+@@ -9,10 +9,10 @@
+        -DKERNEL -DKERNEL_PRIVATE -DAPPLE -DNeXT -DLIBSA_PRIVATE
+-MIG = $(NEXT_ROOT)/usr/bin/mig
++MIG = mig
+ ifeq "macos" "$(RC_OS)"
+-  X_CFLAGS := $(shell if [ "$(RC_RELEASE)" != "Beaker" ] &&    \
++  X_CFLAGS := $(shell if [ `uname` != "Linux" ] && [ "$(RC_RELEASE)" != "Beaker" ] &&    \
+                        [ "$(RC_RELEASE)" != "Bunsen" ] &&    \
+                        [ "$(RC_RELEASE)" != "Gonzo"  ] &&    \
+                        [ "$(RC_RELEASE)" != "Kodiak" ]; then \
+@@ -21,10 +21,19 @@
+ endif
+ ifneq "mwccppc" "$(notdir $(CC))"
++  ifeq "Linux" "$(shell uname)"
++    GCC_FLAGS = -Wall $(X_CFLAGS) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__  -D__ppc__ -I/usr/include -I../../../macosx-include
++  else
+   GCC_FLAGS = -Wall $(X_CFLAGS)
++  endif
+ endif
+-USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
++# Hack: Add ../misc to the path because it contains seg_hack and ver_string
++ifneq ($(findstring ../misc,$(PATH)),../misc)
++  PATH:=../misc:../../misc:$(PATH)
++endif
++
++USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
+            echo YES ; else echo NO ; \
+            fi; )
+@@ -78,7 +87,7 @@
+        fvmlibs.c layout.c specs.c pass2.c generic_reloc.c rld.c sets.c \
+        4byte_literals.c 8byte_literals.c literal_pointers.c dylibs.c \
+        indirect_sections.c mod_sections.c i860_reloc.c ppc_reloc.c \
+-       m88k_reloc.c hppa_reloc.c sparc_reloc.c coalesced_sections.c
++       m88k_reloc.c hppa_reloc.c sparc_reloc.c coalesced_sections.c fake-mach.c
+ OBJS = $(CFILES:.c=.o)
+ INSTALL_FILES = $(CFILES) $(HFILES) Makefile notes \
+               make.defs make_defs.h librld.ofileList
+@@ -341,8 +350,9 @@
+ makeUser.c ld.c: make.h
+ make.h makeUser.c: make.defs
+-      $(MIG) $(MIG_FLAGS) $(SRCROOT)/make.defs
+-      rm -f makeServer.c
++      #~ $(MIG) $(MIG_FLAGS) $(SRCROOT)/make.defs
++      #~ rm -f makeServer.c
++      cp $(SRCROOT)/makeUser.c .
+ ld_vers.o: ld_vers.c
+ ifeq "mwccppc" "$(notdir $(CC))"
+diff -rub ./ld/layout.c ./ld/layout.c
+--- ./ld/layout.c      Wed May 28 18:29:27 2003
++++ ./ld/layout.c      Mon Aug 25 23:22:05 2003
+@@ -42,18 +42,22 @@
+ #include "stuff/openstep_mach.h"
+ #include <mach-o/fat.h> 
+ #include <mach-o/loader.h> 
+-#import <mach/m68k/thread_status.h>
+-#import <mach/ppc/thread_status.h>
+-#import <mach/m88k/thread_status.h>
+-#import <mach/i860/thread_status.h>
+-#import <mach/i386/thread_status.h>
+-#import <mach/hppa/thread_status.h>
+-#import <mach/sparc/thread_status.h>
++#include <mach/m68k/thread_status.h>
++#include <mach/ppc/thread_status.h>
++#include <mach/m88k/thread_status.h>
++#include <mach/i860/thread_status.h>
++#include <mach/i386/thread_status.h>
++#include <mach/hppa/thread_status.h>
++#include <mach/sparc/thread_status.h>
+ #include <mach-o/nlist.h>
+ #include <mach-o/reloc.h>
++
++#include <mach/kern_return.h>
++
+ #if defined(RLD) && !defined(SA_RLD) && !(defined(KLD) && defined(__STATIC__))
++typedef void NXStream;
+ #include <mach-o/rld.h>
+-#include <streams/streams.h>
++//~ #include <streams/streams.h>
+ #endif /* defined(RLD) && !defined(SA_RLD) &&
+         !(defined(KLD) && defined(__STATIC__)) */
+ #include "stuff/arch.h"
+@@ -72,6 +76,15 @@
+ #include "sets.h"
+ #include "mach-o/sarld.h"
+ #include "indirect_sections.h"
++
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
++#define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
++#endif
++
++/** gcc on Linux defines powerpc, if we are compiling on a powerpc. */
++#undef powerpc
+ #ifdef RLD
+ __private_extern__ long RLD_DEBUG_OUTPUT_FILENAME_flag;
+diff -rub ./ld/rld.c ./ld/rld.c
+--- ./ld/rld.c Wed May 28 18:29:32 2003
++++ ./ld/rld.c Mon Aug 25 22:11:47 2003
+@@ -56,11 +56,13 @@
+ #include "stuff/openstep_mach.h"
+ #include <mach-o/fat.h>
+ #include <mach-o/nlist.h>
+-#ifdef KLD
++//~ #ifdef KLD
+ #include <mach-o/kld.h>
+-#else /* !defined(KLD) */
++#ifndef KLD
++//~ #else /* !defined(KLD) */
++typedef void NXStream;
+ #include <mach-o/rld.h>
+-#include <streams/streams.h>
++//~ #include <streams/streams.h>
+ #include <objc/zone.h>
+ #endif /* KLD */
+ #include <mach-o/rld_state.h>
+diff -rub ./libstuff/Makefile ./libstuff/Makefile
+--- ./libstuff/Makefile        Fri Mar 14 18:18:30 2003
++++ ./libstuff/Makefile        Sat Sep  6 20:12:21 2003
+@@ -1,7 +1,7 @@
+ RC_OS = macos
+ OFLAG = -O
+ ifeq "macos" "$(RC_OS)"
+-  X_CFLAGS := $(shell if [ "$(RC_RELEASE)" != "Beaker" ] &&    \
++  X_CFLAGS := $(shell if [ `uname` != "Linux" ] && [ "$(RC_RELEASE)" != "Beaker" ] &&    \
+                        [ "$(RC_RELEASE)" != "Bunsen" ] &&    \
+                        [ "$(RC_RELEASE)" != "Gonzo"  ] &&    \
+                        [ "$(RC_RELEASE)" != "Kodiak" ]; then \
+@@ -10,14 +10,18 @@
+ endif
+-USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
++USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
+            echo YES ; else echo NO ; \
+            fi; )
+       
+ ifeq "mwccppc" "$(notdir $(CC))"
+   CFLAGS = $(OFLAG) -g -gccinc -I$(SRCROOT)/../include
+ else
++  ifeq "Linux" "$(shell uname)"
++    CFLAGS = $(OFLAG) -g -I$(SRCROOT)/../include -Wall $(X_CFLAGS) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__ -D__ppc__ -I/usr/include -I../../../macosx-include
++  else
+   CFLAGS = $(OFLAG) -g -I$(SRCROOT)/../include -Wall $(X_CFLAGS)
++  endif
+ endif
+ ifneq "" "$(wildcard /bin/mkdirs)"
+@@ -41,7 +45,7 @@
+         breakout.c writeout.c checkout.c fatal_arch.c ofile_get_word.c \
+         vm_flush_cache.c hash_string.c dylib_roots.c guess_short_name.c \
+         SymLoc.c get_arch_from_host.c crc32.c macosx_deployment_target.c \
+-        symbol_list.c
++        symbol_list.c fake-mach.c
+ OBJS = $(CFILES:.c=.o)
+ INSTALL_FILES = $(CFILES) Makefile notes
+@@ -91,7 +95,7 @@
+               OFILE_DIR=.                                             \
+               SRCROOT=..                                              \
+               SYMROOT=..                                              \
+-              COPTS="-dynamic"                                        \
++              COPTS=""                                        \
+               OFLAG="$(OFLAG)"                                        \
+               CFILES="$(CFILES)"                                      \
+               RC_CFLAGS="$(RC_CFLAGS)"                                \
+@@ -104,7 +108,7 @@
+               OFILE_DIR=$(OBJROOT)/dynamic_obj                        \
+               SRCROOT=$(SRCROOT)                                      \
+               SYMROOT=$(SYMROOT)                                      \
+-              COPTS="-dynamic"                                        \
++              COPTS=""                                        \
+               OFLAG="$(OFLAG)"                                        \
+               CFILES="$(CFILES)"                                      \
+               RC_CFLAGS="$(RC_CFLAGS)"                                \
+@@ -121,7 +125,7 @@
+               OFILE_DIR=.                                             \
+               SRCROOT=..                                              \
+               SYMROOT=..                                              \
+-              COPTS="-dynamic -pg"                                    \
++              COPTS="-pg"                                     \
+               OFLAG="$(OFLAG)"                                        \
+               RC_CFLAGS="$(RC_CFLAGS)"                                \
+               RC_ARCHS="$(RC_ARCHS)";                                 \
+@@ -133,7 +137,7 @@
+               OFILE_DIR=$(OBJROOT)/profile_obj                        \
+               SRCROOT=$(SRCROOT)                                      \
+               SYMROOT=$(SYMROOT)                                      \
+-              COPTS="-dynamic -pg"                                    \
++              COPTS="-pg"                                     \
+               OFLAG="$(OFLAG)"                                        \
+               RC_CFLAGS="$(RC_CFLAGS)"                                \
+               RC_ARCHS="$(RC_ARCHS)";                                 \
+@@ -168,7 +172,8 @@
+       fi
+ $(PRODUCT):   $(OFILE_DIR) $(SYMROOT) $(OBJS)
+-      libtool -static -o $(SYMROOT)/$(PRODUCT) $(OBJS)
++      ar r $(SYMROOT)/$(PRODUCT) $(OBJS)
++      ranlib $(SYMROOT)/$(PRODUCT)
+ ifeq "NO" "$(USE_DEPENDENCY_FILE)"
+ .c.o:
+diff -rub ./libstuff/SymLoc.c ./libstuff/SymLoc.c
+--- ./libstuff/SymLoc.c        Thu Oct 24 17:04:50 2002
++++ ./libstuff/SymLoc.c        Mon Aug 25 13:17:40 2003
+@@ -1,15 +1,15 @@
+-#import <libc.h>
+-#import <ctype.h>
+-#import <sys/types.h>
++#include <libc.h>
++#include <ctype.h>
++#include <sys/types.h>
+ #ifdef __OPENSTEP__
+ #define _POSIX_SOURCE
+ #endif
+-#import <dirent.h>
+-#import <pwd.h>
+-#import "stuff/bool.h"
+-#import "stuff/errors.h"
+-#import "stuff/allocate.h"
+-#import "stuff/SymLoc.h"
++#include <dirent.h>
++#include <pwd.h>
++#include "stuff/bool.h"
++#include "stuff/errors.h"
++#include "stuff/allocate.h"
++#include "stuff/SymLoc.h"
+ const char *
+ symLocForDylib(const char *installName, const char *releaseName,
+diff -rub ./libstuff/bytesex.c ./libstuff/bytesex.c
+--- ./libstuff/bytesex.c       Mon Nov 19 12:10:07 2001
++++ ./libstuff/bytesex.c       Mon Aug 25 13:17:40 2003
+@@ -25,13 +25,13 @@
+ #include <string.h>
+ #include <mach-o/fat.h>
+ #include <mach-o/loader.h>
+-#import <mach/m68k/thread_status.h>
+-#import <mach/ppc/thread_status.h>
+-#import <mach/m88k/thread_status.h>
+-#import <mach/i860/thread_status.h>
+-#import <mach/i386/thread_status.h>
+-#import <mach/hppa/thread_status.h>
+-#import <mach/sparc/thread_status.h>
++#include <mach/m68k/thread_status.h>
++#include <mach/ppc/thread_status.h>
++#include <mach/m88k/thread_status.h>
++#include <mach/i860/thread_status.h>
++#include <mach/i386/thread_status.h>
++#include <mach/hppa/thread_status.h>
++#include <mach/sparc/thread_status.h>
+ #include <mach-o/nlist.h>
+ #include <mach-o/reloc.h>
+ #include <mach-o/ranlib.h>
+diff -rub ./libstuff/crc32.c ./libstuff/crc32.c
+--- ./libstuff/crc32.c Wed Feb 13 17:53:36 2002
++++ ./libstuff/crc32.c Mon Aug 25 13:19:21 2003
+@@ -35,6 +35,12 @@
+  */
+ #include <sys/types.h>
++#if ( defined(__MWERKS__) && !defined(__private_extern__) )
++#define __private_extern__ __declspec(private_extern)
++#elif ( defined(__linux__) && !defined(__private_extern__) )
++#define __private_extern__ extern
++#endif
++
+ static const u_int32_t crctab[] = {
+       0x0,
+       0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
+diff -rub ./libstuff/ofile.c ./libstuff/ofile.c
+--- ./libstuff/ofile.c Wed Apr 16 16:15:01 2003
++++ ./libstuff/ofile.c Tue Sep  2 20:15:34 2003
+@@ -21,6 +21,7 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
++#include "machine/endian.h"
+ #ifdef SHLIB
+ #include "shlib.h"
+ #endif
+@@ -36,12 +37,12 @@
+ #include <sys/file.h>
+ #include <mach-o/fat.h>
+ #include <mach-o/loader.h>
+-#import <mach/m68k/thread_status.h>
+-#import <mach/ppc/thread_status.h>
+-#import <mach/m88k/thread_status.h>
+-#import <mach/i860/thread_status.h>
+-#import <mach/i386/thread_status.h>
+-#import <mach/sparc/thread_status.h>
++#include <mach/m68k/thread_status.h>
++#include <mach/ppc/thread_status.h>
++#include <mach/m88k/thread_status.h>
++#include <mach/i860/thread_status.h>
++#include <mach/i386/thread_status.h>
++#include <mach/sparc/thread_status.h>
+ #include <mach-o/nlist.h>
+ #include <mach-o/reloc.h>
+ #include "stuff/bool.h"
+@@ -677,7 +678,7 @@
+       memset(ofile, '\0', sizeof(struct ofile));
+       /* Open the file and map it in */
+-      if((fd = open(file_name, O_RDONLY)) == -1){
++      if((fd = open(file_name, O_RDWR)) == -1){
+ #ifdef OFI
+           return(NSObjectFileImageAccess);
+ #else
+@@ -975,7 +976,7 @@
+               }
+           }
+       }
+-      /* see if this file is Mach-O file */
++
+       else if(size >= sizeof(struct mach_header) &&
+               (magic == MH_MAGIC || magic == SWAP_LONG(MH_MAGIC))){
+           ofile->file_type = OFILE_Mach_O;
+diff -rub ./libstuff/print.c ./libstuff/print.c
+--- ./libstuff/print.c Thu May  6 19:30:58 1999
++++ ./libstuff/print.c Mon Aug 25 13:17:40 2003
+@@ -21,8 +21,8 @@
+  * 
+  * @APPLE_LICENSE_HEADER_END@
+  */
+-#import <stdio.h>
+-#import "stuff/print.h"
++#include <stdio.h>
++#include "stuff/print.h"
+ /*
+  * All printing of all messages for ofile functions goes through this function.
+diff -rub ./libstuff/swap_headers.c ./libstuff/swap_headers.c
+--- ./libstuff/swap_headers.c  Fri Oct  4 17:54:48 2002
++++ ./libstuff/swap_headers.c  Mon Aug 25 13:17:40 2003
+@@ -22,13 +22,13 @@
+  * @APPLE_LICENSE_HEADER_END@
+  */
+ #include <mach-o/loader.h>
+-#import <mach/m68k/thread_status.h>
+-#import <mach/ppc/thread_status.h>
+-#import <mach/m88k/thread_status.h>
+-#import <mach/i860/thread_status.h>
+-#import <mach/i386/thread_status.h>
+-#import <mach/hppa/thread_status.h>
+-#import <mach/sparc/thread_status.h>
++#include <mach/m68k/thread_status.h>
++#include <mach/ppc/thread_status.h>
++#include <mach/m88k/thread_status.h>
++#include <mach/i860/thread_status.h>
++#include <mach/i386/thread_status.h>
++#include <mach/hppa/thread_status.h>
++#include <mach/sparc/thread_status.h>
+ #include "stuff/bool.h"
+ #include "stuff/bytesex.h"
+ #include "stuff/errors.h"
+diff -rub ./misc/Makefile ./misc/Makefile
+--- ./misc/Makefile    Fri Mar 14 18:18:30 2003
++++ ./misc/Makefile    Sat Sep  6 20:17:36 2003
+@@ -2,11 +2,11 @@
+ OFLAG = -O
+ RC_OS = macos
+ ifeq "macos" "$(RC_OS)"
+-  X_CFLAGS := $(shell if [ "$(RC_RELEASE)" != "Beaker" ] &&    \
++  X_CFLAGS := $(shell if [ `uname` != "Linux" ] && [ "$(RC_RELEASE)" != "Beaker" ] &&    \
+                        [ "$(RC_RELEASE)" != "Bunsen" ] &&    \
+                        [ "$(RC_RELEASE)" != "Gonzo"  ] &&    \
+                        [ "$(RC_RELEASE)" != "Kodiak" ]; then \
+-           echo -Wno-long-double -no-cpp-precomp; \
++           echo -Wno-long-double -no-cpp-precomp ; \
+            fi; )
+ endif
+@@ -14,11 +14,16 @@
+   CFLAGS = $(OFLAG) -g \
+        -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR)
+ else
++  ifeq "Linux" "$(shell uname)"
++    CFLAGS = $(OFLAG) -g -Wall $(X_CFLAGS) \
++      -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) -D__LITTLE_ENDIAN__ -U__BIG_ENDIAN__ -D__ppc__ -I/usr/include -I../../macosx-include
++  else
+   CFLAGS = $(OFLAG) -g -Wall $(X_CFLAGS) \
+        -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR)
++  endif
+ endif
+-USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ]; then \
++USE_DEPENDENCY_FILE := $(shell if [ `uname` != "Linux" ] && [ "$(notdir $(CC))" != "mwccppc" ]; then \
+            echo YES ; else echo NO ; \
+            fi; )
+@@ -44,10 +49,7 @@
+ LOCLIBDIR = /usr/local/lib
+ CFILES1 = libtool.c
+-CFILES2 = main.c lipo.c size.c strings.c nm.c checksyms.c inout.c \
+-       indr.c strip.c atom.c segedit.c kern_tool.c cmpdylib.c \
+-       dylib_pcsampler.c pagestuff.c redo_prebinding.c seg_addr_table.c \
+-       check_dylib.c seg_hack.c check_hints.c install_name_tool.c
++CFILES2 = seg_hack.c strip.c
+ ifeq "nextstep" "$(RC_OS)"
+   CFILES3 = file.c ar.c
+ endif
+@@ -56,11 +58,7 @@
+               notes
+-PROGS = lipo.NEW size.NEW strings.NEW nm.NEW \
+-      libtool.NEW checksyms.NEW indr.NEW strip.NEW nmedit.NEW \
+-      segedit.NEW kern_tool.NEW cmpdylib.NEW \
+-      dylib_pcsampler.NEW pagestuff.NEW redo_prebinding.NEW \
+-      seg_addr_table.NEW check_dylib.NEW seg_hack.NEW install_name_tool.NEW
++PROGS = seg_hack.NEW strip.NEW
+ teflon_all macos_all: $(PROGS)
+@@ -71,7 +69,7 @@
+ lib_ofiles: $(OFILE_DIR) $(SYMROOT) libredo_prebinding.a
+ vers.c:
+-      vers_string -c $(VERS_STRING_FLAGS) cctools_misc > $(OFILE_DIR)/$@
++      ./vers_string -c $(VERS_STRING_FLAGS) cctools_misc > $(OFILE_DIR)/$@
+ ifeq "NO" "$(USE_DEPENDENCY_FILE)"
+ .c.o:
+@@ -222,6 +220,7 @@
+               $(OFILE_DIR)/seg_hack.o $(OFILE_DIR)/vers.o $(LIBSTUFF)
+       $(CC) $(CFLAGS) $(RC_CFLAGS) -o $(SYMROOT)/seg_hack.NEW \
+               $(OFILE_DIR)/seg_hack.private.o
++      cp $(SYMROOT)/seg_hack.NEW $(SYMROOT)/seg_hack
+ install_name_tool.NEW: install_name_tool.o vers.o
+       $(CC) $(CFLAGS) $(RC_CFLAGS) -nostdlib -r \
+@@ -331,7 +330,8 @@
+       $(SYMROOT)/redo_prebinding.NEW \
+       $(SYMROOT)/libredo_prebinding.a \
+       $(SYMROOT)/kern_tool.NEW \
+-      $(SYMROOT)/cmpdylib.NEW
++      $(SYMROOT)/cmpdylib.NEW \
++      $(SYMROOT)/seg_hack
+ shlib_clean:
+       -rm -f \