+++ /dev/null
-/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- *
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
- *
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- *
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- *
- * @APPLE_LICENSE_HEADER_END@
- */
-
-/*
- * This file creates a .o file containing the comm page symbols that gdb
- * can use. It is placed in a special segment within libSystem.
- */
-
-#define __APPLE_API_PRIVATE
-#define __COMM_PAGE_SYMBOLS
-
-#include "machine/cpu_capabilities.h"
--- /dev/null
+// See: <rdar://problem/8289209>, <rdar://problem/8351271>, <rdar://problem/8359348>
+
+#include <dlfcn.h>
+
+#if __i386__ || __x86_64__
+
+#define SYM(sym) \
+ __asm__(".globl R8289209$_" #sym "; R8289209$_" #sym ": jmp _" #sym);
+
+/****************/
+
+SYM(close);
+SYM(fork);
+SYM(fsync);
+SYM(getattrlist);
+SYM(getrlimit);
+SYM(getxattr);
+SYM(open);
+SYM(pthread_attr_destroy);
+SYM(pthread_attr_init);
+SYM(pthread_attr_setdetachstate);
+SYM(pthread_create);
+SYM(pthread_mutex_lock);
+SYM(pthread_mutex_unlock);
+SYM(pthread_self);
+SYM(ptrace);
+SYM(read);
+SYM(setattrlist);
+SYM(setrlimit);
+SYM(sigaction);
+SYM(stat);
+SYM(sysctl);
+SYM(time);
+SYM(unlink);
+SYM(write);
+
+#endif
BSD_LIBS = c info m pthread dbm poll dl rpcsvc proc
FPATH = /System/Library/Frameworks/System.framework
-build:: fake libSystem
+build:: libSystem
@set -x && \
cd $(DSTROOT)/usr/lib && \
for i in $(BSD_LIBS); do \
for S in $(SUFFIX); do \
$(LN) -sf ../../../../../../usr/lib/libSystem.$(VersionLetter)$$S.dylib System$$S || exit 1; \
done && \
- $(CP) $(SRCROOT)/Info.plist Resources
-
-# 4993197: force dependency generation for libsyscall.a
-fake:
- @set -x && \
- cd $(OBJROOT) && \
- $(ECHO) 'main() { __getpid(); return 0; }' > fake.c && \
- $(CC) -c $(RC_CFLAGS) fake.c && \
- $(LD) -r -o fake $(foreach ARCH,$(RC_ARCHS),-arch $(ARCH)) fake.o -lsyscall -L$(LIBSYS)
+ plutil -convert binary1 -o Resources/Info.plist $(SRCROOT)/Info.plist
libc:
$(MKDIR) '$(OBJROOT)/libc'
SRCROOT='$(SRCROOT)' \
SYMROOT='$(SYMROOT)'
-libSystem: libc
+libSystem:
$(MKDIR) '$(OBJROOT)/libSystem'
$(BSDMAKE) install \
FEATURE_LIBMATHCOMMON=$(FEATURE_LIBMATHCOMMON) \
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
- <string>10.6</string>
+ <string>11</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CarbonLazyValues</key>
# for now, use the default compiler
MYCC := $(CC)
+.if $(RC_TARGET_CONFIG) == iPhone
MYCCLIBS = -lgcc
-RTLIBS = -lcompiler_rt
-NARCHS != $(ECHO) $(RC_ARCHS) | $(WC) -w
-.ifdef ALTUSRLOCALLIBSYSTEM
-LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
-.else
-LIBSYS = $(SDKROOT)/usr/local/lib/system
.endif
+RTLIBS =
+NARCHS != $(ECHO) $(RC_ARCHS) | $(WC) -w
SLFS_F_PH = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
+CODESIGN != xcrun -find codesign
.ifdef SDKROOT
SDKROOTCFLAGS = -isysroot '$(SDKROOT)'
SDKROOTLDFLAGS = -Wl,-syslibroot,'$(SDKROOT)'
.endif
ORDERFILES = -Wl,-order_file,$(SRCROOT)/SystemInit.order -Wl,-order_file,$(PLATFORM_ORDER_FILE)
-LIBS = -lc -lcommonCrypto -ldyldapis\
- -linfo -ldns_sd -lm -lmacho\
- -lnotify -lkeymgr -llaunch \
- -lcopyfile -lremovefile
-CONDITIONALLIBS = unc sandbox quarantine closure cache dispatch unwind \
- dnsinfo
-LIBSCONDITIONAL != for L in $(CONDITIONALLIBS); do tconf -q --test usr_local_lib_system_Archive:lib$$L && $(ECHO) -l$$L; done
+
+.ifdef ALTUSRLOCALLIBSYSTEM
+LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
+.else
+LIBSYS = $(SDKROOT)/usr/local/lib/system
+.endif
+.ifdef ALTUSRLIBSYSTEM
+LSYS = $(ALTUSRLIBSYSTEM)
+.else
+LSYS = $(SDKROOT)/usr/lib/system
+.endif
+
+ACTUALLIBS = $(SYMROOT)/actuallibs
+ALLLIBS = $(SYMROOT)/alllibs
+FROMUSRLIBSYSTEM = $(SYMROOT)/fromusrlibsystem
+FROMUSRLOCALLIBSYSTEM = $(SYMROOT)/fromusrlocallibsystem
+INUSRLIBSYSTEM = $(SYMROOT)/inusrlibsystem
+INUSRLOCALLIBSYSTEM = $(SYMROOT)/inusrlocallibsystem
+MISSINGLIBS = $(SYMROOT)/missinglibs
+OPTIONALLIBS = $(SRCROOT)/optionallibs
+POSSIBLEUSRLOCALLIBSYSTEM = $(SYMROOT)/possibleusrlocallibsystem
+REQUIREDLIBS = $(SRCROOT)/requiredlibs
+
+$(MISSINGLIBS):
+ cat $(REQUIREDLIBS) $(OPTIONALLIBS) | sort > $(ALLLIBS)
+ cd $(LSYS) && ls lib*.dylib | sed -E -e 's/^lib//' -e 's/\..*$$//' -e 's/_(debug|profile|static)$$//' | sort -u > $(INUSRLIBSYSTEM)
+ cd $(LIBSYS) && ls lib*.a | sed -E -e 's/^lib//' -e 's/\..*$$//' -e 's/_(debug|profile|static)$$//' | sort -u > $(INUSRLOCALLIBSYSTEM)
+ comm -12 $(ALLLIBS) $(INUSRLIBSYSTEM) > $(FROMUSRLIBSYSTEM)
+ comm -12 $(ALLLIBS) $(INUSRLOCALLIBSYSTEM) > $(POSSIBLEUSRLOCALLIBSYSTEM)
+ comm -13 $(FROMUSRLIBSYSTEM) $(POSSIBLEUSRLOCALLIBSYSTEM) > $(FROMUSRLOCALLIBSYSTEM)
+ cat $(FROMUSRLIBSYSTEM) $(FROMUSRLOCALLIBSYSTEM) | sort > $(ACTUALLIBS)
+ comm -23 $(REQUIREDLIBS) $(ACTUALLIBS) > $(MISSINGLIBS)
+ @if [ -s $(MISSINGLIBS) ]; then \
+ echo '*** missing required libs ***' && \
+ cat $(MISSINGLIBS) && \
+ exit 1; \
+ fi ;
# These variables are to guarantee that the left-hand side of an expression is
# always a variable
.endif # RC_ProjectName
.for A in $(RC_ARCHS)
-OBJS-$(A) = $(OBJROOT)/$(A)/SystemMath.o $(OBJROOT)/$(A)/System_vers.o
+OBJS-$(A) = $(OBJROOT)/$(A)/SystemMath.o $(OBJROOT)/$(A)/CompatibilityHacks.o $(OBJROOT)/$(A)/System_vers.o $(OBJROOT)/$(A)/init.o
.endfor # RC_ARCHS
.for F in $(FORMS)
.else
SUFFIX$(F) = _$(F)
.endif
-.if !empty(FEATURE_LIBMATHCOMMON)
-LIBMATHCOMMON$(F) = -L/usr/lib/system -sub_library libmathCommon$(SUFFIX$(F)) -lmathCommon$(SUFFIX$(F))
-.endif
LIPOARGS$(F) != $(PERL) -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/$$_/$(F)/$(NAME)$(SUFFIX$(F)).dylib\"), qw($(RC_ARCHS))))'
.for A in $(RC_ARCHS)
$(DSYMUTIL) "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).dylib"
.for A in $(RC_ARCHS)
+# Hardcode libc.a for now. This will have to be changed when libc becomes
+# its own dylib.
LINKDYLIB-$(F)-$(A) = $(MYCC) -dynamiclib -arch $(A) -pipe $(SDKROOTLDFLAGS) \
-o '$(OBJROOT)/$(A)/$(F)/$(NAME)$(SUFFIX$(F)).dylib' \
-compatibility_version 1 -current_version $(Version) \
-install_name /usr/lib/$(NAME)$(SUFFIX$(F)).dylib \
- -nodefaultlibs -all_load -multi_module -Wl,-search_paths_first \
- -segcreate __DATA __commpage $(OBJROOT)/$(A)/CommPageSymbols.o \
+ -nodefaultlibs -Wl,-search_paths_first \
$(ORDERFILES) $(SKDROOTLDFLAGS) $(OBJS-$(A)) \
- -L$(DSTROOT)/usr/local/lib/system -L$(LIBSYS) $(LIBMATHCOMMON$(F)) \
- $(LIBS:C/$/$(SUFFIX$(F))/) $(LIBSCONDITIONAL:C/$/$(SUFFIX$(F))/)
-
-build-$(A)-$(F): $(OBJROOT)/$(A)/$(F) $(OBJROOT)/$(A)/CommPageSymbols.o $(OBJS-$(A))
- @$(ECHO) $(LINKDYLIB-$(F)-$(A)) $(RTLIBS) && \
- if $(LINKDYLIB-$(F)-$(A)) $(RTLIBS); then \
- $(ECHO) -n; \
- else \
- $(ECHO) '*** Failed. Retrying with -lgcc ***' && \
- $(ECHO) $(LINKDYLIB-$(F)-$(A)) $(MYCCLIBS) && \
- $(LINKDYLIB-$(F)-$(A)) $(MYCCLIBS); \
- fi
+ -L$(LSYS) -L$(LIBSYS) $(LIBMATHCOMMON$(F)) \
+ `sed 's/.*/-Wl,-reexport-l&/' $(FROMUSRLIBSYSTEM)` \
+ `sed -e '/^c$$/d' -e 's|.*|-Wl,-force_load,$(LIBSYS)/lib&$(SUFFIX$(F)).a|' $(FROMUSRLOCALLIBSYSTEM)`
+
+build-$(A)-$(F): $(OBJROOT)/$(A)/$(F) $(OBJS-$(A)) $(MISSINGLIBS)
+ @$(ECHO) '========================================='
+ @$(ECHO) $(LINKDYLIB-$(F)-$(A)) $(RTLIBS) $(MYCCLIBS)
+ @$(LINKDYLIB-$(F)-$(A)) $(RTLIBS) $(MYCCLIBS)
$(OBJROOT)/$(A)/$(F):
$(MKDIR) '$(.TARGET)'
$(SED) -e 's/SGS_VERS/SYSTEM_VERS_STRING/' -e 's/VERS_NUM/SYSTEM_VERS_NUM/' > $(.TARGET)
.for A in $(RC_ARCHS)
-$(OBJROOT)/$(A)/CommPageSymbols.o: $(SRCROOT)/CommPageSymbols.st
- $(MYCC) -c -o '$(.TARGET:R)_intermediate.$(.TARGET:E)' -arch $(A) -x assembler-with-cpp $(CFLAGS) '$(.ALLSRC)'
- $(LD) -arch $(A) -r -seg1addr $(SEG1ADDR_$(A:C/^armv.*$/arm/)) '$(.TARGET:R)_intermediate.$(.TARGET:E)' -o '$(.TARGET)'
-
$(OBJROOT)/$(A)/SystemMath.o: $(SRCROOT)/SystemMath.s
$(MYCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
+$(OBJROOT)/$(A)/CompatibilityHacks.o: $(SRCROOT)/CompatibilityHacks.c
+ $(MYCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
+
$(OBJROOT)/$(A)/System_vers.o: $(OBJROOT)/System_vers.c
$(MYCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
+$(OBJROOT)/$(A)/init.o: $(SRCROOT)/init.c
+ $(MYCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
+
.endfor # RC_ARCHS
installhdrs:
$(STRIP) -S "$(DSTROOT)/usr/lib/$(NAME)$(SUFFIX$(F)).dylib"
$(CHMOD) a-w "$(DSTROOT)/usr/lib/$(NAME)$(SUFFIX$(F)).dylib"
$(LN) -sf "$(NAME)$(SUFFIX$(F)).dylib" "$(DSTROOT)/usr/lib/$(NAME0)$(SUFFIX$(F)).dylib"
+ $(CODESIGN) -s - "$(DSTROOT)/usr/lib/$(NAME)$(SUFFIX$(F)).dylib"
.endfor # FORMS
install-all: build
+++ /dev/null
-#
-# Selectable features for AppleTV
-#
-
-# Build _debug.dylib
-FEATURE_DEBUG_DYLIB = 1
-
-# Link libmathCommon
-FEATURE_LIBMATHCOMMON = 1
-
-# Build _profile.dylib
-FEATURE_PROFILE_DYLIB = 1
+++ /dev/null
-./MacOSX/System.order
\ No newline at end of file
# Build _debug.dylib
FEATURE_DEBUG_DYLIB = 1
-# Link libmathCommon
-FEATURE_LIBMATHCOMMON = 1
-
# Build _profile.dylib
FEATURE_PROFILE_DYLIB = 1
_task_get_special_port
_bootstrap_check_in
_vproc_mig_check_in
-___commpage_dsmos
_malloc_good_size
_szone_good_size
_opendir$UNIX2003
_getsectbyname
_getegid
_gettimeofday
-___commpage_gettimeofday
_strlcpy
_strlcat
_setenv$UNIX2003
# Build _debug.dylib
#FEATURE_DEBUG_DYLIB = 1
-# Link libmathCommon
-#FEATURE_LIBMATHCOMMON = 1
-
# Build _profile.dylib
#FEATURE_PROFILE_DYLIB = 1
--- /dev/null
+/*
+ * Copyright (c) 2007, 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+#ifdef __DYNAMIC__
+
+#include <TargetConditionals.h> // for TARGET_OS_EMBEDDED
+
+#include <_libkernel_init.h>
+#include <dlfcn.h>
+
+struct ProgramVars; /* forward reference */
+
+// system library initialisers
+extern void bootstrap_init(void); // from liblaunch.dylib
+extern void mach_init(void); // from libsystem_mach.dylib
+extern void pthread_init(void); // from libc.a
+extern void __libc_init(const struct ProgramVars *vars, void (*atfork_prepare)(void), void (*atfork_parent)(void), void (*atfork_child)(void), const char *apple[]); // from libc.a
+extern void __keymgr_initializer(void); // from libkeymgr.a
+extern void _dyld_initializer(void); // from libdyld.a
+extern void libdispatch_init(void); // from libdispatch.a
+extern void _libxpc_initializer(void); // from libxpc
+
+// system library atfork handlers
+extern void _cthread_fork_prepare();
+extern void _cthread_fork_parent();
+extern void _cthread_fork_child();
+extern void _cthread_fork_child_postinit();
+
+extern void _mach_fork_child();
+extern void _cproc_fork_child();
+extern void _libc_fork_child();
+extern void _notify_fork_child();
+extern void _dyld_fork_child();
+extern void xpc_atfork_prepare();
+extern void xpc_atfork_parent();
+extern void xpc_atfork_child();
+
+// advance decls for below;
+void libSystem_atfork_prepare();
+void libSystem_atfork_parent();
+void libSystem_atfork_child();
+
+// from mig_support.c in libc
+mach_port_t _mig_get_reply_port();
+void _mig_set_reply_port(mach_port_t);
+
+void cthread_set_errno_self(int);
+int* __error(void);
+
+/*
+ * libsyscall_initializer() initializes all of libSystem.dylib <rdar://problem/4892197>
+ */
+static __attribute__((constructor))
+void libSystem_initializer(int argc, const char* argv[], const char* envp[], const char* apple[], const struct ProgramVars* vars)
+{
+ _libkernel_functions_t libkernel_funcs = {
+ .get_reply_port = _mig_get_reply_port,
+ .set_reply_port = _mig_set_reply_port,
+ .get_errno = __error,
+ .set_errno = cthread_set_errno_self,
+ .dlsym = dlsym,
+ };
+
+ _libkernel_init(libkernel_funcs);
+
+ bootstrap_init();
+ mach_init();
+ pthread_init();
+ __libc_init(vars, libSystem_atfork_prepare, libSystem_atfork_parent, libSystem_atfork_child, apple);
+ __keymgr_initializer();
+ _dyld_initializer();
+ libdispatch_init();
+#if !TARGET_OS_EMBEDDED || __IPHONE_OS_VERSION_MAX_ALLOWED >= 50000 // __IPHONE_5_0
+ _libxpc_initializer();
+#endif
+}
+
+/*
+ * libSystem_atfork_{prepare,parent,child}() are called by libc when we fork, then we deal with running fork handlers
+ * for everyone else.
+ */
+void libSystem_atfork_prepare()
+{
+#if !TARGET_OS_EMBEDDED || __IPHONE_OS_VERSION_MAX_ALLOWED >= 50000 // __IPHONE_5_0
+ xpc_atfork_prepare();
+#endif
+ _cthread_fork_prepare();
+}
+
+void libSystem_atfork_parent()
+{
+ _cthread_fork_parent();
+#if !TARGET_OS_EMBEDDED || __IPHONE_OS_VERSION_MAX_ALLOWED >= 50000 // __IPHONE_5_0
+ xpc_atfork_parent();
+#endif
+}
+
+void libSystem_atfork_child()
+{
+ _dyld_fork_child();
+ _cthread_fork_child();
+
+ bootstrap_init();
+ _mach_fork_child();
+ _cproc_fork_child();
+ _libc_fork_child();
+ _notify_fork_child();
+#if !TARGET_OS_EMBEDDED || __IPHONE_OS_VERSION_MAX_ALLOWED >= 50000 // __IPHONE_5_0
+ xpc_atfork_child();
+#endif
+
+ _cthread_fork_child_postinit();
+}
+
+/*
+ * Old crt1.o glue used to call through mach_init_routine which was used to initialize libSystem.
+ * LibSystem now auto-initializes but mach_init_routine is left for binary compatibility.
+ */
+static void mach_init_old() {}
+void (*mach_init_routine)(void) = &mach_init_old;
+
+/*
+ * This __crashreporter_info__ symbol is for all non-dylib parts of libSystem.
+ */
+const char *__crashreporter_info__;
+asm (".desc __crashreporter_info__, 0x10");
+
+#endif /* __DYNAMIC__ */
+++ /dev/null
-NAME = libc
-
-.include <CoreOS/Standard/Commands.mk>
-.include <CoreOS/Standard/Variables.mk>
-
-NARCHS != $(ECHO) $(RC_ARCHS) | $(WC) -w
-.ifdef ALTUSRLOCALLIBSYSTEM
-LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
-.else
-LIBSYS = $(SDKROOT)/usr/local/lib/system
-.endif
-NJOBS != $(PERL) -e '$$n = `$(SYSCTL) -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
-BSDMAKEJ = $(BSDMAKE) -f Makefile -j $(NJOBS)
-
-# These variables are to guarantee that the left-hand side of an expression is
-# always a variable
-dynamic = dynamic
-
-FORMS := dynamic
-
-.if !empty(FEATURE_DEBUG_DYLIB)
-FORMS += debug
-.endif
-
-.if !empty(FEATURE_PROFILE_DYLIB)
-FORMS += profile
-.endif
-
-all: build
-
-build: build-debug build-dynamic build-profile
-
-# These are the non B&I defaults
-.ifndef RC_ProjectName
-install: installhdrs install-all
-
-.else # RC_ProjectName
-
-.for F in $(FORMS)
-install: BI-install-$(F)
-.endfor # FORMS
-.endif # RC_ProjectName
-
-.for F in $(FORMS)
-.if $(dynamic) == $(F)
-SUFFIX$(F) =
-.else
-SUFFIX$(F) = _$(F)
-.endif
-LIPOARGS$(F) != $(PERL) -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/$$_/$(F)/$(NAME)$(SUFFIX$(F)).a\"), qw($(RC_ARCHS))))'
-
-.for A in $(RC_ARCHS)
-build-$(F): build-$(A)-$(F)
-.endfor # RC_ARCHS
-build-$(F):
-.if $(NARCHS) == 1
- $(CP) "$(OBJROOT)/$(RC_ARCHS)/$(F)/$(NAME)$(SUFFIX$(F)).a" "$(SYMROOT)"
-.else
- $(LIPO) -create $(LIPOARGS$(F)) -output "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a"
-.endif
- $(RANLIB) "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a"
-
-.for A in $(RC_ARCHS)
-build-$(A)-$(F): $(OBJROOT)/$(A)/libsystem.o
- $(MKDIR) '$(OBJROOT)/$(A)/$(F)'
- @set -x && \
- cd '$(OBJROOT)/$(A)/$(F)' && \
- if $(LIPO) -info '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' | $(GREP) -q '^Non-'; then \
- $(CP) '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' .; \
- else \
- arch=`$(LIPO) -detailed_info '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' | $(SED) -E -n 's/.*architecture:? //p' | $(SORT) | $(GREP) '^$(A)' | $(HEAD) -n 1` && \
- $(LIPO) -thin $$arch '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' -output '$(NAME)-partial$(SUFFIX$(F)).a'; \
- fi && \
- $(AR) x '$(NAME)-partial$(SUFFIX$(F)).a' && \
- if $(LIPO) -info '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' | $(GREP) -q '^Non-'; then \
- $(CP) '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' .; \
- else \
- arch=`$(LIPO) -detailed_info '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' | $(SED) -E -n 's/.*architecture:? //p' | $(SORT) | $(GREP) '^$(A)' | $(HEAD) -n 1` && \
- $(LIPO) -thin $$arch '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' -output 'libsyscall$(SUFFIX$(F)).a'; \
- fi && \
- $(AR) x 'libsyscall$(SUFFIX$(F)).a' && \
- NM=$(NM) '$(SRCROOT)/libsys/build-libc.pl' '$(LIBSYS)' '$(OBJROOT)/$(A)/$(F)' && \
- $(LN) -s ../libsystem.o && \
- $(BSDMAKEJ)
-.endfor # RC_ARCHS
-.endfor # FORMS
-
-.for A in $(RC_ARCHS)
-$(OBJROOT)/$(A)/libsystem.o: $(OBJROOT)/libsystem.c
- $(MKDIR) '$(OBJROOT)/$(A)'
- $(CC) -c -o '$(.TARGET)' -arch $(A) '$(.ALLSRC)'
-.endfor # RC_ARCHS
-
-$(OBJROOT)/libsystem.c:
- $(SDKROOT)/Developer/Makefiles/bin/version.pl Libsystem > $(.TARGET)
-
-installhdrs:
-
-.for F in $(FORMS)
-BI-install-$(F): build-$(F)
- $(MKDIR) "$(DSTROOT)/usr/local/lib/system"
- @$(ECHO) "===== Installing $(NAME)$(SUFFIX$(F)).a ====="
- $(INSTALL) "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a" "$(DSTROOT)/usr/local/lib/system"
- $(RANLIB) "$(DSTROOT)/usr/local/lib/system/$(NAME)$(SUFFIX$(F)).a"
- $(CHMOD) 0444 "$(DSTROOT)/usr/local/lib/system/$(NAME)$(SUFFIX$(F)).a"
-.endfor # FORMS
-
-install-all: build
-.for F in $(FORMS)
-install-all: BI-install-$(F)
-.endfor # FORMS
-
-clean:
-.for A in $(RC_ARCHS)
- $(RMDIR) $(OBJROOT)/$(A)
-.endfor # RC_ARCHS
+++ /dev/null
-#!/usr/bin/perl
-#
-# Copyright (c) 2006-2007, 2009 Apple Inc. All rights reserved.
-#
-# @APPLE_LICENSE_HEADER_START@
-#
-# This file contains Original Code and/or Modifications of Original Code
-# as defined in and that are subject to the Apple Public Source License
-# Version 2.0 (the 'License'). You may not use this file except in
-# compliance with the License. Please obtain a copy of the License at
-# http://www.opensource.apple.com/apsl/ and read it before using this
-# file.
-#
-# The Original Code and all software distributed under the License are
-# distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
-# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
-# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
-# Please see the License for the specific language governing rights and
-# limitations under the License.
-#
-# @APPLE_LICENSE_HEADER_END@
-#
-##########################################################################
-#
-# % build-libc.pl usr-local-lib-system out-directory
-#
-# This script takes the directory full of the contents libc-partial*.a and
-# libsyscall*.a, and makes the necessary symbol aliases for those syscalls
-# that aren't being wrapped in Libc. The usr-local-lib-system is the
-# /usr/local/lib/system or equivalent directory where the necessary symbol
-# files from Libc and Libsyscall reside.
-#
-# A Makefile is created that will build libc*.a from the contents of the
-# out-directory after symbol aliasing has been added.
-#
-# The out-directory path must be of the form ".../arch/form", where arch is
-# the architecture being built and form is one of debug, dynamic and profile.
-#
-##########################################################################
-
-use strict;
-use DirHandle;
-use File::Basename ();
-use File::Copy ();
-use File::Spec;
-use IO::File;
-
-my $MyName = File::Basename::basename($0);
-
-my $OutDir;
-my %Stub;
-my %StubArgs;
-my $StubFile = 'libsyscall.list';
-my %Suffix = (
- debug => ['do', '_debug'],,
- dynamic => ['So', ''],,
- profile => ['po', '_profile'],,
-);
-my $SyscallBase = 'libc.syscall';
-
-##########################################################################
-# Scan the archive for existing wrappers, and remove them from the stub
-# list.
-##########################################################################
-sub processLibc {
- my($arch, $dir) = @_;
- local $_;
- my $file = File::Spec->join($dir, 'libc-partial.a');
- my $f = IO::File->new("$ENV{NM} -g -arch $arch $file |");
- die "$MyName: $ENV{NM} -g -arch $arch $file: $!\n" unless defined($f);
- while(<$f>) {
- next unless s/^.* T //;
- chomp;
- delete($Stub{$_});
- }
-}
-
-##########################################################################
-# Read the libc.syscall and any libc.syscall.arch file for additional aliases
-# for the double underbar syscalls.
-##########################################################################
-sub readLibcSyscalls {
- my($arch, $dir) = @_;
- local $_;
- my @files = (File::Spec->join($dir, $SyscallBase));
- my $archfile = File::Spec->join($dir, "$SyscallBase.$arch");
- if(-r $archfile) {
- push(@files, $archfile);
- } elsif($arch =~ s/^armv.*/arm/) {
- $archfile = File::Spec->join($dir, "$SyscallBase.$arch");
- push(@files, $archfile) if -r $archfile;
- }
- foreach my $file (@files) {
- my $f = IO::File->new($file, 'r');
- die "$MyName: $file: $!\n" unless defined($f);
- while(<$f>) {
- next if /^#/;
- chomp;
- my($k, $v) = split;
- if(defined($v)) {
- $Stub{$k} = $v;
- } else {
- delete($Stub{$k});
- }
- }
- }
-}
-
-##########################################################################
-# Read the libsyscall.list file for the system call names and number
-# of arguments and store in %StubArgs. Also, make an entry for a syscall
-# stub.
-##########################################################################
-sub readStub {
- my $dir = shift;
- local $_;
- my $file = File::Spec->join($dir, $StubFile);
- my $f = IO::File->new($file, 'r');
- die "$MyName: $file: $!\n" unless defined($f);
- while(<$f>) {
- chomp;
- my($k, $v) = split;
- if(!($k =~ s/^#//)) {
- $_ = $k;
- s/^__//;
- $Stub{$_} = $k;
- }
- $StubArgs{$k} = $v;
- }
-}
-
-sub usage {
- die "Usage: $MyName usr-local-lib-system out-directory\n";
-}
-
-usage() unless scalar(@ARGV) == 2;
-my($usr_local_lib_system);
-($usr_local_lib_system, $OutDir) = @ARGV;
-die "$MyName: $usr_local_lib_system: No such directory\n" unless -d $usr_local_lib_system;
-die "$MyName: $OutDir: No such directory\n" unless -d $OutDir;
-my @pieces = File::Spec->splitdir($OutDir);
-my $form = pop(@pieces);
-my $arch = pop(@pieces);
-my $suf = $Suffix{$form};
-die "$MyName: $form: Unknown form\n" unless defined($suf);
-my($suffix, $sufname) = @$suf;
-readStub($usr_local_lib_system);
-readLibcSyscalls($arch, $usr_local_lib_system);
-processLibc($arch, $usr_local_lib_system);
-
-##########################################################################
-# Invert the Stub hash, so the key will correspond to the file to process.
-# The value will be an array ref containing all aliases.
-##########################################################################
-my %Inv;
-while(my($k, $v) = each(%Stub)) {
- my $a = $Inv{$v};
- $a = $Inv{$v} = [] if !defined($a);
- push(@$a, $k);
-}
-
-##########################################################################
-# Create the Makefile file
-##########################################################################
-my $path = File::Spec->join($OutDir, 'Makefile');
-my $f = IO::File->new($path, 'w');
-die "$MyName: $path: $!\n" unless defined($f);
-print $f ".include <CoreOS/Standard/Commands.mk>\n\n";
-
-##########################################################################
-# List all the object files
-##########################################################################
-my $dir = DirHandle->new($OutDir);
-die "$MyName: can't open $dir\n" unless defined($dir);
-print $f "OBJS = libsystem.o \\\n";
-my @objs;
-while(defined($_ = $dir->read())) {
- next unless s/\.$suffix$/.o/;
- push(@objs, $_);
-}
-undef $dir;
-printf $f "\t%s\n", join(" \\\n\t", @objs);
-
-##########################################################################
-# Add the build logic
-##########################################################################
-print $f <<XXX;
-
-LIB = libc$sufname.a
-
-all: \$(LIB)
-
-\$(LIB): \$(OBJS)
- \$(AR) cq \$(.TARGET) `\$(LORDER) \$(OBJS) | tsort -q`
-
-.SUFFIXES: .$suffix
-
-.$suffix.o:
- \$(MV) \$(.IMPSRC) \$(.TARGET)
-
-XXX
-
-##########################################################################
-# Special case each binary that needs aliasing
-##########################################################################
-foreach my $k (sort(keys(%Inv))) {
- my $n = $k;
- $n =~ s/^_//;
- print $f "$n.o: $n.$suffix\n";
- print $f "\t\$(LD) -arch $arch -r -keep_private_externs";
- foreach my $i (@{$Inv{$k}}) {
- $_ = $i;
- s/\$/\$\$/g;
- printf $f " -alias '$k' '$_'";
- }
- printf $f " -o \$(.TARGET) \$(.IMPSRC)\n";
-}
--- /dev/null
+cache
+closure
+compiler_rt
+dispatch
+dnsinfo
+dyld
+mathCommon
+quarantine
+sandbox
+system_auto
+system_blocks
+system_dyld
+system_network
+system_objc
+system_sandbox
+unc
+unwind
+xpc
--- /dev/null
+commonCrypto
+copyfile
+keymgr
+launch
+m
+macho
+notify
+removefile
+system_c
+system_dnssd
+system_info
+system_kernel