shlib_clean:
-rm -f \
+--- ld/fake-mach.c Sat Sep 6 21:32:56 2003
++++ ld/fake-mach.c Tue Aug 26 11:40:24 2003
+@@ -0,0 +1,160 @@
++/** fake-mach.c - A half baked implementation of mach kernel functions using the POSIX UNIX API.
++*
++* This was used to port Apple's Darwin linker (ld) to Linux. This allows Mac OS X applications to
++* be cross complied on Linux. */
++
++#include <stdlib.h>
++#include <assert.h>
++#include <sys/types.h>
++#include <sys/uio.h>
++#include <unistd.h>
++
++#include <errno.h>
++
++#include <sys/mman.h>
++
++// Mach include files for typedefs, return values, etc
++//~ #include <mach/mach.h>
++#include <mach/kern_return.h>
++#include <mach/vm_types.h>
++#include <mach/mach_types.h>
++#include <mach/message.h>
++#include <servers/bootstrap_defs.h>
++
++/** The port for the current task. Ignored in this implementation. */
++mach_port_t mach_task_self_ = 0;
++
++/** The bootstrap port. Ignored in this implementation. */
++mach_port_t bootstrap_port = 0;
++
++#include <mach/ppc/ndr_def.h>
++
++/** Maps the file descriptor into memory. Free the memory using vm_deallocate. Ignores findspace and offset. */
++kern_return_t map_fd( int fd, vm_offset_t offset, vm_offset_t *va, boolean_t findspace, vm_size_t size)
++{
++ void* space = NULL;
++
++ assert( fd > 0 );
++ assert( offset == 0 );
++ //~ assert( *va == 0 );
++ assert( findspace == TRUE );
++
++ //~ // Allocate memory
++ //~ space = malloc( size );
++ //~ assert( space != NULL );
++
++ //~ // Read file into space
++ //~ bytes = read( fd, space, size );
++ //~ assert( bytes == size );
++
++ space = mmap( (void*) offset, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0 );
++ // No permission: try to make it read only
++ if ( space == (void*) -1 && errno == EACCES )
++ {
++ space = mmap( (void*) offset, size, PROT_READ, MAP_SHARED, fd, 0 );
++ }
++ assert( space != NULL && space != (void*) -1 );
++
++ // Copy back the pointer
++ *va = (vm_offset_t) space;
++
++ // Return success
++ return KERN_SUCCESS;
++}
++
++/** Returns a string appropriate to the error argument given. */
++char* mach_error_string( int error_value )
++{
++ char errorString[] = "Some fake mach error string.";
++
++ return errorString;
++}
++
++/** Returns the mach port for the current host. We fake it by returning zero. */
++mach_port_t mach_host_self( void )
++{
++ return 0;
++}
++
++/** Returns the mach port for the current task. We fake it by returning zero. */
++//~ mach_port_t mach_task_self( void )
++//~ {
++ //~ return 0;
++//~ }
++
++/**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. */
++extern kern_return_t vm_allocate( mach_port_t target_task, vm_address_t *address, vm_size_t size, boolean_t anywhere )
++{
++ assert( anywhere == TRUE );
++
++ // Anonymous memory map
++ *address = (vm_address_t) mmap( NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANON, 0, 0 );
++ //~ *address = (vm_address_t) malloc( size );
++ assert( address != (vm_address_t) NULL );
++
++ return KERN_SUCCESS;
++}
++
++/**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. */
++kern_return_t vm_deallocate( mach_port_t target_task, vm_address_t address, vm_size_t size )
++{
++ int ret = 0;
++
++ assert( address != (vm_address_t) NULL );
++
++ // Free the memory
++ ret = munmap( (void*) address, size );
++ assert( ret == 0 );
++
++ //~ free( (void*) address );
++
++ return KERN_SUCCESS;
++}
++
++/** 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. */
++kern_return_t mach_port_allocate_name (mach_port_t task, mach_port_right_t right, mach_port_t name)
++{
++ return KERN_SUCCESS;
++}
++
++/** The function mach_port_deallocate releases a user reference for a right in task's IPC name space. In this implementation it does nothing. */
++kern_return_t mach_port_deallocate (mach_port_t task, mach_port_t name)
++{
++ return KERN_SUCCESS;
++}
++
++/** host_info returns information about the host. It is not implemented in this implementation. */
++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 )
++{
++ assert( 0 );
++ return KERN_FAILURE;
++}
++
++/** vm_msync unimplemented: It does nothing. */
++kern_return_t vm_msync ( vm_map_t target_task, vm_address_t address, vm_size_t size, vm_sync_t sync_flags )
++{
++ //~ assert( address != (vm_address_t) NULL );
++ //~ int ret = 0;
++ //~ ret = msync( (void*) address, size, int flags);
++ //~ assert( 0 );
++ return KERN_SUCCESS;
++}
++
++/** bootstrap_look_up unimplemented. */
++kern_return_t bootstrap_look_up( mach_port_t bootstrap_port, name_t service_name, mach_port_t *service_port )
++{
++ assert( 0 );
++ return KERN_FAILURE;
++}
++
++/** mach_msg unimplemented. Send and/or receive a message. If the message operation
++ * is interrupted, and the user did not request an indication
++ * of that fact, then restart the appropriate parts of the
++ * operation silently (trap version does not restart).
++ */
++mach_msg_return_t mach_msg( mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size,
++ mach_msg_size_t rcv_size, mach_port_name_t rcv_name, mach_msg_timeout_t timeout, mach_port_name_t notify)
++{
++ //~ assert( 0 );
++ return KERN_SUCCESS;
++}
+\ No newline at end of file
+--- ld/makeUser.c Sat Sep 6 21:52:24 2003
++++ ld/makeUser.c Mon Aug 25 22:54:46 2003
+@@ -0,0 +1,305 @@
++/*
++ * IDENTIFICATION:
++ * stub generated Mon Aug 25 15:06:30 2003
++ * with a MiG generated Tue Nov 5 01:17:50 PST 2002 by root@brixen
++ * OPTIONS:
++ */
++#include "make.h"
++
++
++#ifndef mig_internal
++#define mig_internal static
++#endif /* mig_internal */
++
++#ifndef mig_external
++#define mig_external
++#endif /* mig_external */
++
++#ifndef TypeCheck
++#define TypeCheck 0
++#endif /* TypeCheck */
++
++#ifndef LimitCheck
++#define LimitCheck 0
++#endif /* LimitCheck */
++
++#ifndef min
++#define min(a,b) ( ((a) < (b))? (a): (b) )
++#endif /* min */
++
++#ifndef UseStaticTemplates
++#define UseStaticTemplates 0
++#endif /* UseStaticTemplates */
++
++#define _WALIGN_(x) (((x) + 3) & ~3)
++#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
++#ifndef __MachMsgErrorWithTimeout
++#define __MachMsgErrorWithTimeout(_R_) { \
++ switch (_R_) { \
++ case MACH_SEND_INVALID_REPLY: \
++ case MACH_RCV_INVALID_NAME: \
++ case MACH_RCV_PORT_DIED: \
++ case MACH_RCV_PORT_CHANGED: \
++ case MACH_RCV_TIMED_OUT: \
++ mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
++ break; \
++ default: \
++ mig_put_reply_port(InP->Head.msgh_reply_port); \
++ } \
++}
++#endif /* __MachMsgErrorWithTimeout */
++
++#ifndef __MachMsgErrorWithoutTimeout
++#define __MachMsgErrorWithoutTimeout(_R_) { \
++ switch (_R_) { \
++ case MACH_SEND_INVALID_REPLY: \
++ case MACH_RCV_INVALID_NAME: \
++ case MACH_RCV_PORT_DIED: \
++ case MACH_RCV_PORT_CHANGED: \
++ mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
++ break; \
++ default: \
++ mig_put_reply_port(InP->Head.msgh_reply_port); \
++ } \
++}
++#endif /* __MachMsgErrorWithoutTimeout */
++
++#ifndef __DeclareSendRpc
++#define __DeclareSendRpc(_NUM_, _NAME_)
++#endif /* __DeclareSendRpc */
++
++#ifndef __BeforeSendRpc
++#define __BeforeSendRpc(_NUM_, _NAME_)
++#endif /* __BeforeSendRpc */
++
++#ifndef __AfterSendRpc
++#define __AfterSendRpc(_NUM_, _NAME_)
++#endif /* __AfterSendRpc */
++
++#ifndef __DeclareSendSimple
++#define __DeclareSendSimple(_NUM_, _NAME_)
++#endif /* __DeclareSendSimple */
++
++#ifndef __BeforeSendSimple
++#define __BeforeSendSimple(_NUM_, _NAME_)
++#endif /* __BeforeSendSimple */
++
++#ifndef __AfterSendSimple
++#define __AfterSendSimple(_NUM_, _NAME_)
++#endif /* __AfterSendSimple */
++
++#define msgh_request_port msgh_remote_port
++#define msgh_reply_port msgh_local_port
++
++
++
++/* SimpleRoutine alert_old */
++mig_external kern_return_t make_alert_old
++(
++ mach_port_t makePort,
++ int eventType,
++ make_string_t functionName,
++ mach_msg_type_number_t functionNameCnt,
++ make_string_t fileName,
++ mach_msg_type_number_t fileNameCnt,
++ int line,
++ make_string_t message,
++ mach_msg_type_number_t messageCnt
++)
++{
++ {
++ typedef struct {
++ mach_msg_header_t Head;
++ NDR_record_t NDR;
++ int eventType;
++ mach_msg_type_number_t functionNameCnt;
++ char functionName[1024];
++ mach_msg_type_number_t fileNameCnt;
++ char fileName[1024];
++ int line;
++ mach_msg_type_number_t messageCnt;
++ char message[1024];
++ } Request;
++
++ /*
++ * typedef struct {
++ * mach_msg_header_t Head;
++ * NDR_record_t NDR;
++ * kern_return_t RetCode;
++ * } mig_reply_error_t;
++ */
++
++ union {
++ Request In;
++ } Mess;
++
++ register Request *InP = &Mess.In;
++
++ mach_msg_return_t msg_result;
++ unsigned int msgh_size;
++ unsigned int msgh_size_delta;
++ __DeclareSendSimple(100, "alert_old")
++
++ InP->NDR = NDR_record;
++
++ InP->eventType = eventType;
++
++ if (functionNameCnt > 1024) {
++ { return MIG_ARRAY_TOO_LARGE; }
++ }
++ (void)memcpy((char *) InP->functionName, (const char *) functionName, functionNameCnt);
++
++ InP->functionNameCnt = functionNameCnt;
++
++ msgh_size_delta = _WALIGN_(functionNameCnt);
++ msgh_size = (sizeof(Request) - 3072) + msgh_size_delta;
++ InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
++
++ if (fileNameCnt > 1024) {
++ { return MIG_ARRAY_TOO_LARGE; }
++ }
++ (void)memcpy((char *) InP->fileName, (const char *) fileName, fileNameCnt);
++
++ InP->fileNameCnt = fileNameCnt;
++
++ msgh_size_delta = _WALIGN_(fileNameCnt);
++ msgh_size += msgh_size_delta;
++ InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
++
++ InP->line = line;
++
++ if (messageCnt > 1024) {
++ { return MIG_ARRAY_TOO_LARGE; }
++ }
++ (void)memcpy((char *) InP->message, (const char *) message, messageCnt);
++
++ InP->messageCnt = messageCnt;
++
++ msgh_size += _WALIGN_(messageCnt);
++ InP = &Mess.In;
++ InP->Head.msgh_bits =
++ MACH_MSGH_BITS(19, 0);
++ /* msgh_size passed as argument */
++ InP->Head.msgh_request_port = makePort;
++ InP->Head.msgh_reply_port = MACH_PORT_NULL;
++ InP->Head.msgh_id = 100;
++
++ __BeforeSendSimple(100, "alert_old")
++ 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);
++ __AfterSendSimple(100, "alert_old")
++ return msg_result;
++ }
++}
++
++/* SimpleRoutine alert */
++mig_external kern_return_t make_alert
++(
++ mach_port_t makePort,
++ int eventType,
++ make_string_t functionName,
++ mach_msg_type_number_t functionNameCnt,
++ make_string_t fileName,
++ mach_msg_type_number_t fileNameCnt,
++ make_string_t directory,
++ mach_msg_type_number_t directoryCnt,
++ int line,
++ make_string_t message,
++ mach_msg_type_number_t messageCnt
++)
++{
++ {
++ typedef struct {
++ mach_msg_header_t Head;
++ NDR_record_t NDR;
++ int eventType;
++ mach_msg_type_number_t functionNameCnt;
++ char functionName[1024];
++ mach_msg_type_number_t fileNameCnt;
++ char fileName[1024];
++ mach_msg_type_number_t directoryCnt;
++ char directory[1024];
++ int line;
++ mach_msg_type_number_t messageCnt;
++ char message[1024];
++ } Request;
++
++ /*
++ * typedef struct {
++ * mach_msg_header_t Head;
++ * NDR_record_t NDR;
++ * kern_return_t RetCode;
++ * } mig_reply_error_t;
++ */
++
++ union {
++ Request In;
++ } Mess;
++
++ register Request *InP = &Mess.In;
++
++ mach_msg_return_t msg_result;
++ unsigned int msgh_size;
++ unsigned int msgh_size_delta;
++ __DeclareSendSimple(101, "alert")
++
++ InP->NDR = NDR_record;
++
++ InP->eventType = eventType;
++
++ if (functionNameCnt > 1024) {
++ { return MIG_ARRAY_TOO_LARGE; }
++ }
++ (void)memcpy((char *) InP->functionName, (const char *) functionName, functionNameCnt);
++
++ InP->functionNameCnt = functionNameCnt;
++
++ msgh_size_delta = _WALIGN_(functionNameCnt);
++ msgh_size = (sizeof(Request) - 4096) + msgh_size_delta;
++ InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
++
++ if (fileNameCnt > 1024) {
++ { return MIG_ARRAY_TOO_LARGE; }
++ }
++ (void)memcpy((char *) InP->fileName, (const char *) fileName, fileNameCnt);
++
++ InP->fileNameCnt = fileNameCnt;
++
++ msgh_size_delta = _WALIGN_(fileNameCnt);
++ msgh_size += msgh_size_delta;
++ InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
++
++ if (directoryCnt > 1024) {
++ { return MIG_ARRAY_TOO_LARGE; }
++ }
++ (void)memcpy((char *) InP->directory, (const char *) directory, directoryCnt);
++
++ InP->directoryCnt = directoryCnt;
++
++ msgh_size_delta = _WALIGN_(directoryCnt);
++ msgh_size += msgh_size_delta;
++ InP = (Request *) ((pointer_t) InP + msgh_size_delta - 1024);
++
++ InP->line = line;
++
++ if (messageCnt > 1024) {
++ { return MIG_ARRAY_TOO_LARGE; }
++ }
++ (void)memcpy((char *) InP->message, (const char *) message, messageCnt);
++
++ InP->messageCnt = messageCnt;
++
++ msgh_size += _WALIGN_(messageCnt);
++ InP = &Mess.In;
++ InP->Head.msgh_bits =
++ MACH_MSGH_BITS(19, 0);
++ /* msgh_size passed as argument */
++ InP->Head.msgh_request_port = makePort;
++ InP->Head.msgh_reply_port = MACH_PORT_NULL;
++ InP->Head.msgh_id = 101;
++
++ __BeforeSendSimple(101, "alert")
++ 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);
++ __AfterSendSimple(101, "alert")
++ return msg_result;
++ }
++}