From 809271e4ffbc957d063b093e55a39c85c61f6aaa Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 28 Mar 2006 20:50:21 +0000 Subject: [PATCH] objc4-267.1.tar.gz --- Makefile | 342 +++++++++++++++++++++ objc-exports-i386 | 187 +++++++++++ objc-exports => objc-exports-ppc | 0 runtime/Messengers.subproj/objc-msg-i386.s | 96 ++++++ runtime/objc-runtime.h | 19 ++ 5 files changed, 644 insertions(+) create mode 100644 objc-exports-i386 rename objc-exports => objc-exports-ppc (100%) diff --git a/Makefile b/Makefile index 53ea4d2..65f4cb1 100644 --- a/Makefile +++ b/Makefile @@ -158,3 +158,345 @@ MODULE_SOURCES= OTHER_SOURCES= # headers to install in /usr/include/objc PUBLIC_HEADERS= +# headers that don't get installed +PRIVATE_HEADERS= +# headers to install in /usr/local/include/objc +OTHER_HEADERS= + +# runtime +SOURCES += $(addprefix runtime/, \ + Object.m Protocol.m hashtable2.m maptable.m objc-class.m objc-errors.m \ + objc-file.m objc-load.m objc-moninit.c objc-runtime.m objc-sel.m \ + objc-sync.m objc-exception.m objc-auto.m objc-sel-set.m objc-rtp.m \ + ) +PUBLIC_HEADERS += $(addprefix runtime/, \ + objc-class.h objc-api.h objc-load.h objc-runtime.h objc.h Object.h \ + objc-sync.h objc-exception.h objc-auto.h \ + Protocol.h error.h hashtable2.h \ + ) +PRIVATE_HEADERS += runtime/objc-private.h runtime/objc-config.h runtime/objc-sel-table.h runtime/objc-sel-set.h runtime/objc-rtp.h +OTHER_HEADERS += runtime/maptable.h runtime/objc-auto.h + +# OldClasses +SOURCES += runtime/OldClasses.subproj/List.m +PUBLIC_HEADERS += runtime/OldClasses.subproj/List.h + +# Messengers +SOURCES += runtime/Messengers.subproj/objc-msg.s +OTHER_SOURCES += runtime/Messengers.subproj/objc-msg-ppc.s runtime/Messengers.subproj/objc-msg-i386.s + +# Auto support +SOURCES += runtime/Auto.subproj/objc-auto.s +OTHER_SOURCES += runtime/Auto.subproj/objc-auto-ppc.s runtime/Auto.subproj/objc-auto-i386.s + +# RTP symbols for gdb +# See also $(OBJROOT)/runtime/objc-rtp-sym.ppc.o rule below. +OTHER_SOURCES += runtime/objc-rtp-sym.s + +# Interposing support. +# This code is built into a second module so dyld's function interposing +# can manipulate the calls. +MODULE_SOURCES += runtime/Messengers.subproj/objc-msg-stub.s +OTHER_SOURCES += runtime/Messengers.subproj/objc-msg-stub-ppc.s runtime/Messengers.subproj/objc-msg-stub-i386.s + +# project root +OTHER_SOURCES += Makefile APPLE_LICENSE objc-exports-i386 objc-exports-ppc + +OBJECTS = $(addprefix $(OBJROOT)/, $(addsuffix .o, $(basename $(SOURCES) ) ) ) +OBJECTS_OPTIMIZED = $(OBJECTS:.o=.opt.o) +OBJECTS_DEBUG = $(OBJECTS:.o=.debug.o) +OBJECTS_PROFILE = $(OBJECTS:.o=.profile.o) + +MODULE_OBJECTS = $(addprefix $(OBJROOT)/, $(addsuffix .o, $(basename $(MODULE_SOURCES) ) ) ) +MODULE_OBJECTS_OPTIMIZED = $(MODULE_OBJECTS:.o=.opt.o) +MODULE_OBJECTS_DEBUG = $(MODULE_OBJECTS:.o=.debug.o) +MODULE_OBJECTS_PROFILE = $(MODULE_OBJECTS:.o=.profile.o) + +# For simplicity, each object target depends on all objc headers. Most of +# them come close to requiring this anyway, and rebuild from scratch is fast. +DEPEND_HEADERS = $(addprefix $(SRCROOT)/, \ + $(PUBLIC_HEADERS) $(PRIVATE_HEADERS) $(OTHER_HEADERS) ) + +$(OBJROOT)/%.opt.o : $(SRCROOT)/%.m $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) "$<" -c -o "$@" + +$(OBJROOT)/%.debug.o : $(SRCROOT)/%.m $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_DEBUG) "$<" -c -o "$@" + +$(OBJROOT)/%.profile.o : $(SRCROOT)/%.m $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_PROFILE) "$<" -c -o "$@" + +$(OBJROOT)/%.opt.o : $(SRCROOT)/%.c $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) "$<" -c -o "$@" + +$(OBJROOT)/%.debug.o : $(SRCROOT)/%.c $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_DEBUG) "$<" -c -o "$@" + +$(OBJROOT)/%.profile.o : $(SRCROOT)/%.c $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_PROFILE) "$<" -c -o "$@" + +$(OBJROOT)/%.opt.o : $(SRCROOT)/%.s $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) "$<" -c -o "$@" + +$(OBJROOT)/%.debug.o : $(SRCROOT)/%.s $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_DEBUG) "$<" -c -o "$@" + +$(OBJROOT)/%.profile.o : $(SRCROOT)/%.s $(DEPEND_HEADERS) + $(SILENT) $(ECHO) " ... $<" + $(SILENT) $(CC) $(CFLAGS_PROFILE) "$<" -c -o "$@" + +# Additional dependency: objc-msg.s depends on objc-msg-ppc.s and +# objc-msg-i386.s, which it includes. +$(OBJROOT)/runtime/Messengers.subproj/objc-msg.opt.o \ +$(OBJROOT)/runtime/Messengers.subproj/objc-msg.debug.o \ +$(OBJROOT)/runtime/Messengers.subproj/objc-msg.profile.o : \ + $(SRCROOT)/runtime/Messengers.subproj/objc-msg-ppc.s \ + $(SRCROOT)/runtime/Messengers.subproj/objc-msg-i386.s + +# Additional dependency: objc-msg-sutb.s depends on objc-msg-stub-ppc.s and +# objc-msg-stub-i386.s, which it includes. +$(OBJROOT)/runtime/Messengers.subproj/objc-msg-stub.opt.o \ +$(OBJROOT)/runtime/Messengers.subproj/objc-msg-stub.debug.o \ +$(OBJROOT)/runtime/Messengers.subproj/objc-msg-stub.profile.o : \ + $(SRCROOT)/runtime/Messengers.subproj/objc-msg-stub-ppc.s \ + $(SRCROOT)/runtime/Messengers.subproj/objc-msg-stub-i386.s + +# Additional dependency: objc-auto.s depends on objc-auto-ppc.s and +# objc-auto-i386.s, which it includes. +$(OBJROOT)/runtime/Auto.subproj/objc-auto.opt.o \ +$(OBJROOT)/runtime/Auto.subproj/objc-auto.debug.o \ +$(OBJROOT)/runtime/Auto.subproj/objc-auto.profile.o : \ + $(SRCROOT)/runtime/Auto.subproj/objc-auto-ppc.s \ + $(SRCROOT)/runtime/Auto.subproj/objc-auto-i386.s + +# Additional rules: objc-rtp-sym.s needs to be built with a per-arch seg1addr, +# and need to be stripped here because stripping the dylib does not remove +# debug info from the magic sections. +# objc-rtp-sym.s is not in SOURCES, and objc-rtp-sym.o is not in OBJECTS +$(OBJROOT)/runtime/objc-rtp-sym.ppc.o: $(SRCROOT)/runtime/objc-rtp-sym.s + $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) -arch ppc "$<" -c -o "$@.temp" + $(SILENT) $(STRIP) -S "$@.temp" + $(SILENT) $(LD) -arch ppc -seg1addr 0xfffec000 "$@.temp" -r -o "$@" + +$(OBJROOT)/runtime/objc-rtp-sym.i386.o: $(SRCROOT)/runtime/objc-rtp-sym.s + $(SILENT) $(CC) $(CFLAGS_OPTIMIZED) -arch i386 "$<" -c -o "$@.temp" + $(SILENT) $(STRIP) -S "$@.temp" + $(SILENT) $(LD) -arch i386 -seg1addr 0xfffe8000 "$@.temp" -r -o "$@" + + +# These are the main targets: +# build builds the library to OBJROOT and SYMROOT +# installsrc copies the sources to SRCROOT +# installhdrs install only the headers to DSTROOT +# install build, then install the headers and library to DSTROOT +# clean removes build products in OBJROOT and SYMROOT +# +# optimized same as 'build' but builds optimized library only +# debug same as 'build' but builds debug library only +# profile same as 'build' but builds profile library only + +# Default build doesn't currently build the debug library. +build: prebuild build-optimized build-profile postbuild + +optimized: prebuild build-optimized postbuild +debug: prebuild build-debug postbuild +profile: prebuild build-profile postbuild + +installsrc: + $(SILENT) $(ECHO) "Installing source from . to $(SRCROOT)..." +ifeq "$(SRCROOT)" "." + $(SILENT) $(ECHO) "SRCROOT must be defined to be the destination directory; it cannot be '.'" + exit 1 +endif + $(SILENT) $(TAR) -cf $(SRCROOT)/objc4.sources.tar $(SOURCES) $(PUBLIC_HEADERS) $(PRIVATE_HEADERS) $(OTHER_HEADERS) $(OTHER_SOURCES) $(MODULE_SOURCES) + $(SILENT) $(CD) $(SRCROOT) && $(TAR) -xf $(SRCROOT)/objc4.sources.tar + $(SILENT) $(REMOVE) -f $(SRCROOT)/objc4.sources.tar + +installhdrs: + $(SILENT) $(ECHO) "Installing headers from $(SRCROOT) to $(DSTROOT)/$(HEADER_INSTALLDIR)..." + + $(SILENT) $(MKDIRS) $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR) + -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/*.h + $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(PUBLIC_HEADERS) ) \ + $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR) +# duplicate hashtable2.h to hashtable.h + $(SILENT) $(COPY) $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/hashtable2.h \ + $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/hashtable.h + $(SILENT) $(CHMOD) -w $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/*.h + $(SILENT) $(CHMOD) a+r $(DSTROOT)/$(PUBLIC_HEADER_INSTALLDIR)/*.h + + $(SILENT) $(MKDIRS) $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR) + -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)/*.h + $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(OTHER_HEADERS) ) \ + $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR) + $(SILENT) $(CHMOD) -w $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)/*.h + $(SILENT) $(CHMOD) a+r $(DSTROOT)/$(OTHER_HEADER_INSTALLDIR)/*.h + + + $(SILENT) $(RM) -f $(DSTROOT)$(PUBLIC_HEADER_DIR)$(PUBLIC_HEADER_DIR_SUFFIX)/hashtable.h + + +install: build installhdrs + $(SILENT) $(ECHO) "Installing products from $(SYMROOT) to $(DSTROOT)..." + + $(SILENT) $(MKDIRS) $(DSTROOT)/$(INSTALLDIR) + -$(SILENT) $(CHMOD) +w $(DSTROOT)/$(INSTALLDIR) + + $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT) + $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) + $(SILENT) $(REMOVE) -f $(DSTROOT)/$(INSTALLDIR)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) + +# optimized + $(SILENT) $(COPY) $(SYMROOT)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR) + $(SILENT) $(STRIP) -S $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT) + -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT) + $(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT) + $(SILENT) $(CD) $(DSTROOT)/$(INSTALLDIR) && \ + $(SYMLINK) libobjc.$(VERSION_NAME)$(LIBRARY_EXT) libobjc$(LIBRARY_EXT) + +# debug (allowed not to exist) + -$(SILENT) $(COPY) $(SYMROOT)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR) + -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) + -$(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) + -$(SILENT) $(CD) $(DSTROOT)/$(INSTALLDIR) && \ + test -e libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) && \ + $(SYMLINK) libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) libobjc_debug$(LIBRARY_EXT) && \ + $(SYMLINK) libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) libobjc.$(VERSION_NAME)_debug$(LIBRARY_EXT) + + +# profile (allowed not to exist) + -$(SILENT) $(COPY) $(SYMROOT)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) $(DSTROOT)/$(INSTALLDIR) + -$(SILENT) $(CHOWN) root:wheel $(DSTROOT)/$(INSTALLDIR)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) + -$(SILENT) $(CHMOD) 755 $(DSTROOT)/$(INSTALLDIR)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) + -$(SILENT) $(CD) $(DSTROOT)/$(INSTALLDIR) && \ + test -e libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) && \ + $(SYMLINK) libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) libobjc_profile$(LIBRARY_EXT) && \ + $(SYMLINK) libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) libobjc.$(VERSION_NAME)_profile$(LIBRARY_EXT) + + +clean: + $(SILENT) $(ECHO) "Deleting build products..." + $(SILENT) $(REMOVE) -f \ + $(foreach A, $(ARCH_LIST), \ + $(OBJROOT)/libobjc_debug.$A.$(VERSION_NAME)$(LIBRARY_EXT) \ + $(OBJROOT)/libobjc_profile.$A.$(VERSION_NAME)$(LIBRARY_EXT) \ + $(OBJROOT)/libobjc.$A.$(VERSION_NAME)$(LIBRARY_EXT) \ + $(OBJROOT)/runtime/objc-rtp-sym.$A.o \ + $(OBJROOT)/runtime/objc-rtp-sym.$A.o.temp \ + ) + + $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.optimized.o + $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.debug.o + $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.profile.o + + $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc.$(VERSION_NAME)$(LIBRARY_EXT) + $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc_debug.$(VERSION_NAME)$(LIBRARY_EXT) + $(SILENT) $(REMOVE) -f $(SYMROOT)/libobjc_profile.$(VERSION_NAME)$(LIBRARY_EXT) + + $(SILENT) $(REMOVE) -f $(OBJECTS_OPTIMIZED) + $(SILENT) $(REMOVE) -f $(OBJECTS_DEBUG) + $(SILENT) $(REMOVE) -f $(OBJECTS_PROFILE) + + $(SILENT) $(REMOVE) -f $(MODULE_OBJECTS_OPTIMIZED) + $(SILENT) $(REMOVE) -f $(MODULE_OBJECTS_DEBUG) + $(SILENT) $(REMOVE) -f $(MODULE_OBJECTS_PROFILE) + + $(SILENT) $(REMOVE) -rf $(SYMROOT)/ProjectHeaders + +prebuild: + $(SILENT) $(ECHO) "Prebuild-setup..." + +# Install headers into $(SYMROOT)/ProjectHeaders so #includes can find them +# even if they're not installed in /usr. + $(SILENT) $(MKDIRS) $(SYMROOT) + $(SILENT) $(REMOVE_RECUR) $(SYMROOT)/ProjectHeaders + $(SILENT) $(MKDIRS) $(SYMROOT)/ProjectHeaders + $(SILENT) $(ECHO) "Copying headers from $(SRCROOT) to $(SYMROOT)/ProjectHeaders..." + $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(PRIVATE_HEADERS) ) $(SYMROOT)/ProjectHeaders + $(SILENT) $(MKDIRS) $(SYMROOT)/ProjectHeaders/objc + $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(PUBLIC_HEADERS) ) $(SYMROOT)/ProjectHeaders/objc + $(SILENT) $(COPY) $(addprefix $(SRCROOT)/, $(OTHER_HEADERS) ) $(SYMROOT)/ProjectHeaders/objc + + + +build-optimized: prebuild-optimized compile-optimized link-optimized +build-debug: prebuild-debug compile-debug link-debug +build-profile: prebuild-profile compile-profile link-profile + + +prebuild-optimized: + $(SILENT) $(ECHO) "Building (optimized) ..." + $(SILENT) $(MKDIRS) $(foreach S, $(SUBDIRS), $(OBJROOT)/$(S) ) + +prebuild-debug: + $(SILENT) $(ECHO) "Building (debug) ..." + $(SILENT) $(MKDIRS) $(foreach S, $(SUBDIRS), $(OBJROOT)/$(S) ) + +prebuild-profile: + $(SILENT) $(ECHO) "Building (profile) ..." + $(SILENT) $(MKDIRS) $(foreach S, $(SUBDIRS), $(OBJROOT)/$(S) ) + + +compile-optimized: $(OBJECTS_OPTIMIZED) $(MODULE_OBJECTS_OPTIMIZED) $(foreach A, $(ARCH_LIST), $(OBJROOT)/runtime/objc-rtp-sym.$A.o ) +compile-debug: $(OBJECTS_DEBUG) $(MODULE_OBJECTS_DEBUG) $(foreach A, $(ARCH_LIST), $(OBJROOT)/runtime/objc-rtp-sym.$A.o ) +compile-profile: $(OBJECTS_PROFILE) $(MODULE_OBJECTS_PROFILE) $(foreach A, $(ARCH_LIST), $(OBJROOT)/runtime/objc-rtp-sym.$A.o ) + + +# link lib-suffix, LDFLAGS, OBJECTS, MODULE_OBJECTS +# libsuffix should be "" or _debug or _profile +ifeq "$(PLATFORM)" "Darwin" + +define link + $(foreach A, $(ARCH_LIST), \ + $(SILENT) $(LD) -r \ + -arch $A \ + -o $(OBJROOT)/libobjc$1.$A.o \ + $3 ; \ + $(SILENT) $(CC) $2 \ + -arch $A \ + -Wl,-exported_symbols_list,$(SRCROOT)/objc-exports-$(A) \ + $(ORDER) \ + -sectcreate __DATA __commpage $(OBJROOT)/runtime/objc-rtp-sym.$A.o \ + -install_name /$(INSTALLDIR)/libobjc$1.$(VERSION_NAME)$(LIBRARY_EXT) \ + -o $(OBJROOT)/libobjc$1.$A.$(VERSION_NAME)$(LIBRARY_EXT) \ + $(OBJROOT)/libobjc$1.$A.o $4 ; \ + ) + $(SILENT) $(LIPO) \ + -create -output $(SYMROOT)/libobjc$1.$(VERSION_NAME)$(LIBRARY_EXT) \ + $(foreach A, $(ARCH_LIST), -arch $A $(OBJROOT)/libobjc$1.$A.$(VERSION_NAME)$(LIBRARY_EXT) ) +endef + +else +# PLATFORM != Darwin +define link + $(SILENT) $(ECHO) "Don't know how to link for platform '$(PLATFORM)'" +endef + +endif + + +link-optimized: + $(SILENT) $(ECHO) "Linking (optimized)..." + $(call link,,$(LDFLAGS_OPTIMIZED),$(OBJECTS_OPTIMIZED),$(MODULE_OBJECTS_OPTIMIZED) ) + +link-debug: + $(SILENT) $(ECHO) "Linking (debug)..." + $(call link,_debug,$(LDFLAGS_DEBUG),$(OBJECTS_DEBUG),$(MODULE_OBJECTS_DEBUG) ) + +link-profile: + $(SILENT) $(ECHO) "Linking (profile)..." + $(call link,_profile,$(LDFLAGS_PROFILE),$(OBJECTS_PROFILE),$(MODULE_OBJECTS_PROFILE) ) + + +postbuild: + $(SILENT) $(ECHO) "Done!" + + diff --git a/objc-exports-i386 b/objc-exports-i386 new file mode 100644 index 0000000..b42dfb8 --- /dev/null +++ b/objc-exports-i386 @@ -0,0 +1,187 @@ +# Functions and variables explicitly exported from ObjC. +# GrP 2002-2-4 +# Note that some commonly used functions are *not* listed in the +# ObjC headers (e.g. objc_flush_caches()) +# List.h +.objc_class_name_List +# objc-class.h +_object_setInstanceVariable +_object_getInstanceVariable +_class_createInstance +_class_createInstanceFromZone +_class_setVersion +_class_getVersion +_class_getInstanceVariable +_class_getInstanceMethod +_class_getClassMethod +_class_addMethods +_class_removeMethods +_class_poseAs +_method_getNumberOfArguments +_method_getSizeOfArguments +_method_getArgumentInfo +_class_nextMethodList +# objc-auto.h - actually, everything possible for now +_objc_collect +_objc_collect_generation +_objc_numberAllocated +_objc_isAuto +_objc_collecting_enabled +_objc_allocate_object +_objc_assign_strongCast +_objc_assign_global +_objc_assign_ivar +_objc_assign_strongCast_generic +_objc_assign_global_generic +_objc_assign_ivar_generic +_objc_assign_strongCast_CF +_objc_assign_ivar_address_CF +_objc_collect_init +_objc_is_finalized +_objc_memmove_collectable +_objc_collect_if_needed +# objc-exception.h +_objc_exception_throw +_objc_exception_try_enter +_objc_exception_try_exit +_objc_exception_extract +_objc_exception_match +_objc_exception_get_functions +_objc_exception_set_functions +# objc-sync.h +_objc_sync_enter +_objc_sync_exit +_objc_sync_wait +_objc_sync_notify +_objc_sync_notifyAll +# objc-load.h +_objc_loadModules +_objc_loadModule +_objc_unloadModules +# objc-runtime.h +_objc_getClass +_objc_getMetaClass +_objc_msgSend +# non-nil entry points disabled for now +# _objc_msgSendNonNil +_objc_msgSend_fpret +_objc_msgSend_stret +# _objc_msgSendNonNil_stret +_objc_msgSendSuper +_objc_msgSendSuper_stret +_objc_msgSendv +_objc_msgSendv_fpret +_objc_msgSendv_stret +_objc_getClassList +_objc_getClasses +_objc_lookUpClass +_objc_getRequiredClass +_objc_addClass +_objc_setClassHandler +_objc_setMultithreaded +__alloc +__copy +__realloc +__dealloc +__zoneAlloc +__zoneRealloc +__zoneCopy +__error +# objc.h +_sel_isMapped +_sel_getName +_sel_getUid +_sel_registerName +_object_getClassName +_object_getIndexedIvars +# Object.h +.objc_class_name_Object +_object_dispose +_object_copy +_object_copyFromZone +_object_realloc +_object_reallocFromZone +# Protocol.h +.objc_class_name_Protocol +# error.h +# everything inside is declared but no longer defined?! +# hashtable2.h +_NXCreateHashTableFromZone +_NXCreateHashTable +_NXFreeHashTable +_NXEmptyHashTable +_NXResetHashTable +_NXCompareHashTables +_NXCopyHashTable +_NXCountHashTable +_NXHashMember +_NXHashGet +_NXHashInsert +_NXHashInsertIfAbsent +_NXHashRemove +_NXInitHashState +_NXNextHashState +_NXPtrHash +_NXStrHash +_NXPtrIsEqual +_NXStrIsEqual +_NXNoEffectFree +_NXReallyFree +_NXPtrPrototype +_NXStrPrototype +_NXPtrStructKeyPrototype +_NXStrStructKeyPrototype +_NXUniqueString +_NXUniqueStringWithLength +_NXUniqueStringNoCopy +_NXCopyStringBuffer +_NXCopyStringBufferFromZone +# maptable.h +_NXCreateMapTableFromZone +_NXCreateMapTable +_NXFreeMapTable +_NXResetMapTable +_NXCompareMapTables +_NXCountMapTable +_NXMapMember +_NXMapGet +_NXMapInsert +_NXMapRemove +_NXInitMapState +_NXNextMapState +_NXPtrValueMapPrototype +_NXStrValueMapPrototype +_NXObjectMapPrototype +# +# Functions that aren't in the headers but are used or are useful. +# +# sudo find / -xdev -type f -perm -0111 \! -name "libobjc*dylib" -print -exec nm -u {} \; > /tmp/all-used-symbols +# (repeat with any other disks you want checked, appending to the same file) +# nm /usr/lib/libobjc.dylib | awk '$2 ~ /^[ADST]$/' | colrm 1 11 | sort -u > /tmp/objc-exports +# (note that you need an unstripped, un-nmedited libobjc.dylib) +# grep -f /tmp/objc-exports /tmp/all-used-symbols | sort -u > /tmp/used-objc-symbols +# grep -v -f /tmp/used-objc-symbols /tmp/objc-exports | sort -u > /tmp/unused-objc-symbols +# +__class_printDuplicateCacheEntries +__class_printMethodCaches +__class_printMethodCacheStatistics +__objc_create_zone +__objc_error +__objc_flush_caches +__objc_msgForward +__objc_resolve_categories_for_class +__objc_setClassLoader +__objc_setNilReceiver +__objc_getNilReceiver +__objcInit +_class_lookupMethod +_class_respondsToMethod +_instrumentObjcMessageSends +_objc_getOrigClass +# magic, or garbage? +__dummy +_do_not_remove_this_dummy_function +# used by debugging tools like heap +__objc_debug_class_hash +# used by Foundation's NSAutoreleaseFreedObjectCheckEnabled +__objc_getFreedObjectClass diff --git a/objc-exports b/objc-exports-ppc similarity index 100% rename from objc-exports rename to objc-exports-ppc diff --git a/runtime/Messengers.subproj/objc-msg-i386.s b/runtime/Messengers.subproj/objc-msg-i386.s index 100ace5..fc1dd57 100644 --- a/runtime/Messengers.subproj/objc-msg-i386.s +++ b/runtime/Messengers.subproj/objc-msg-i386.s @@ -65,6 +65,7 @@ _objc_entryPoints: .long __cache_getImp .long __cache_getMethod .long _objc_msgSend + .long _objc_msgSend_fpret .long _objc_msgSend_stret .long _objc_msgSendSuper .long _objc_msgSendSuper_stret @@ -75,6 +76,7 @@ _objc_exitPoints: .long LGetImpExit .long LGetMethodExit .long LMsgSendExit + .long LMsgSendFpretExit .long LMsgSendStretExit .long LMsgSendSuperExit .long LMsgSendSuperStretExit @@ -837,6 +839,100 @@ LMsgSendvArgsOK: END_ENTRY _objc_msgSendv +/******************************************************************** + * + * double objc_msgSend_fpret(id self, SEL _cmd,...); + * + ********************************************************************/ + + ENTRY _objc_msgSend_fpret + + movl self(%esp), %eax + +// check whether receiver is nil + testl %eax, %eax + je LMsgSendFpretNilSelf + +// receiver is non-nil: search the cache +LMsgSendFpretReceiverOk: + CacheLookup WORD_RETURN, MSG_SEND, LMsgSendFpretCacheMiss + movl $kFwdMsgSend, %edx // flag word-return for _objc_msgForward + jmp *%eax // goto *imp + +// cache miss: go search the method lists +LMsgSendFpretCacheMiss: + MethodTableLookup WORD_RETURN, MSG_SEND + movl $kFwdMsgSend, %edx // flag word-return for _objc_msgForward + jmp *%eax // goto *imp + +// message sent to nil: redirect to nil receiver, if any +LMsgSendFpretNilSelf: + call L_get_pc_thunk.edx // load new receiver +1: movl __objc_nilReceiver-1b(%edx),%eax + testl %eax, %eax // return zero if no new receiver + je LMsgSendFpretReturnZero + movl %eax, self(%esp) // send to new receiver + jmp LMsgSendFpretReceiverOk +LMsgSendFpretReturnZero: + fldz +LMsgSendFpretDone: + ret + +LMsgSendFpretExit: + END_ENTRY _objc_msgSend_fpret + +/******************************************************************** + * double objc_msgSendv_fpret(id self, SEL _cmd, unsigned size, marg_list frame); + * + * On entry: + * (sp+4) is the message receiver, + * (sp+8) is the selector, + * (sp+12) is the size of the marg_list, in bytes, + * (sp+16) is the address of the marg_list + * + ********************************************************************/ + + ENTRY _objc_msgSendv_fpret + +#if defined(KERNEL) + trap // _objc_msgSendv is not for the kernel +#else + pushl %ebp + movl %esp, %ebp + // stack is currently aligned assuming no extra arguments + movl (marg_list+4)(%ebp), %edx + addl $8, %edx // skip self & selector + movl (marg_size+4)(%ebp), %ecx + subl $8, %ecx // skip self & selector + shrl $2, %ecx + je LMsgSendvFpretArgsOK + + // %esp = %esp - (16 - ((numVariableArguments & 3) << 2)) + movl %ecx, %eax // 16-byte align stack + andl $3, %eax + shll $2, %eax + subl $16, %esp + addl %eax, %esp + +LMsgSendvFpretArgLoop: + decl %ecx + movl 0(%edx, %ecx, 4), %eax + pushl %eax + jg LMsgSendvFpretArgLoop + +LMsgSendvFpretArgsOK: + movl (selector+4)(%ebp), %ecx + pushl %ecx + movl (self+4)(%ebp),%ecx + pushl %ecx + call _objc_msgSend_fpret + movl %ebp,%esp + popl %ebp + + ret +#endif + END_ENTRY _objc_msgSendv_fpret + /******************************************************************** * * void objc_msgSend_stret(void *st_addr , id self, SEL _cmd, ...); diff --git a/runtime/objc-runtime.h b/runtime/objc-runtime.h index 9950a66..8e0d02d 100644 --- a/runtime/objc-runtime.h +++ b/runtime/objc-runtime.h @@ -78,6 +78,25 @@ OBJC_EXPORT id objc_msgSend(id self, SEL op, ...); OBJC_EXPORT id objc_msgSendSuper(struct objc_super *super, SEL op, ...); +/* Floating-point-returning Messaging Primitives (prototypes) + * + * On some platforms, the ABI for functions returning a floating-point + * value is incompatible with that for functions returning an integral type. + * objc_msgSend_fpret must be used for these. + * + * ppc: objc_msgSend_fpret not used + * ppc64: objc_msgSend_fpret not used + * i386: objc_msgSend_fpret REQUIRED + * + * For `float` or `long double` return types, cast the function + * to an appropriate function pointer type first. + */ + +#ifdef __i386__ +OBJC_EXPORT double objc_msgSend_fpret(id self, SEL op, ...); +#endif + + /* Struct-returning Messaging Primitives (prototypes) * * For historical reasons, the prototypes for the struct-returning -- 2.45.2