Index: ObjFW.xcodeproj/project.pbxproj ================================================================== --- ObjFW.xcodeproj/project.pbxproj +++ ObjFW.xcodeproj/project.pbxproj @@ -261,10 +261,11 @@ 4B55A113133AC24600B58A93 /* OFReadFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55A10D133AC24500B58A93 /* OFReadFailedException.m */; }; 4B55A114133AC24600B58A93 /* OFReadOrWriteFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B55A10E133AC24500B58A93 /* OFReadOrWriteFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B55A115133AC24600B58A93 /* OFReadOrWriteFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55A10F133AC24500B58A93 /* OFReadOrWriteFailedException.m */; }; 4B55A116133AC24600B58A93 /* OFWriteFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B55A110133AC24500B58A93 /* OFWriteFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B55A117133AC24600B58A93 /* OFWriteFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55A111133AC24600B58A93 /* OFWriteFailedException.m */; }; + 4B5C112F17E9AB3E003C917F /* forwarding.S in Sources */ = {isa = PBXBuildFile; fileRef = 4B5C112C17E9AAED003C917F /* forwarding.S */; }; 4B5CF8F914940BD2007AA324 /* OFString+JSONValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B5CF8F614940BD2007AA324 /* OFString+JSONValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4B5CF8FA14940BD2007AA324 /* OFString+JSONValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B5CF8F714940BD2007AA324 /* OFString+JSONValue.m */; }; 4B64D6EF1425381E007BDFB1 /* OFStreamObserver_poll.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B64D6EB1425381E007BDFB1 /* OFStreamObserver_poll.h */; }; 4B64D6F01425381E007BDFB1 /* OFStreamObserver_poll.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B64D6EC1425381E007BDFB1 /* OFStreamObserver_poll.m */; }; 4B64D6F11425381E007BDFB1 /* OFStreamObserver_select.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B64D6ED1425381E007BDFB1 /* OFStreamObserver_select.h */; }; @@ -376,11 +377,10 @@ 4BDF37B51338055600F9A81A /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDF37B41338055600F9A81A /* config.h */; }; 4BE52D2117B990B4005958D1 /* OFZIPArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE52D1F17B990B4005958D1 /* OFZIPArchive.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BE52D2217B990B4005958D1 /* OFZIPArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE52D2017B990B4005958D1 /* OFZIPArchive.m */; }; 4BE52D2517B990DA005958D1 /* OFChecksumFailedException.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BE52D2317B990DA005958D1 /* OFChecksumFailedException.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4BE52D2617B990DA005958D1 /* OFChecksumFailedException.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE52D2417B990DA005958D1 /* OFChecksumFailedException.m */; }; - 4BEF2D3117A5BF5200BB8BA3 /* forwarding.S in Sources */ = {isa = PBXBuildFile; fileRef = 4BEF2D3017A5BF5200BB8BA3 /* forwarding.S */; }; 4BF33AFB133807590059CEF7 /* ObjFW.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B3D23761337FBC800DD29B8 /* ObjFW.framework */; }; 4BF33AFC133807A20059CEF7 /* OFArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF66E1235358D0076B512 /* OFArrayTests.m */; }; 4BF33AFD133807A20059CEF7 /* OFBlockTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5F0E412DF4259005C7A0C /* OFBlockTests.m */; }; 4BF33AFE133807A20059CEF7 /* OFDataArrayTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B6EF66F1235358D0076B512 /* OFDataArrayTests.m */; }; 4BF33AFF133807A20059CEF7 /* OFDateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE5F0E512DF4259005C7A0C /* OFDateTests.m */; }; @@ -587,11 +587,10 @@ 4B3B0797166978780044E634 /* OFMapTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFMapTable.m; path = src/OFMapTable.m; sourceTree = ""; }; 4B3D236D1337FB5800DD29B8 /* base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = base64.h; path = src/base64.h; sourceTree = ""; }; 4B3D236E1337FB5800DD29B8 /* base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = base64.m; path = src/base64.m; sourceTree = ""; }; 4B3D23761337FBC800DD29B8 /* ObjFW.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ObjFW.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4B3D23BB1337FC5800DD29B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; - 4B3D23EF1338008000DD29B8 /* mach_alias_list */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = mach_alias_list; path = src/mach_alias_list; sourceTree = SOURCE_ROOT; }; 4B3D5693139A617D0010A78F /* OFSerializationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFSerializationTests.m; path = tests/OFSerializationTests.m; sourceTree = ""; }; 4B45355113DCFE1E0037AB4D /* OFCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFCountedSet.h; path = src/OFCountedSet.h; sourceTree = ""; }; 4B45355213DCFE1E0037AB4D /* OFCountedSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFCountedSet.m; path = src/OFCountedSet.m; sourceTree = ""; }; 4B48B95214DC23B100546D39 /* OFXMLProcessingInstructions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFXMLProcessingInstructions.h; path = src/OFXMLProcessingInstructions.h; sourceTree = ""; }; 4B48B95314DC23B100546D39 /* OFXMLProcessingInstructions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFXMLProcessingInstructions.m; path = src/OFXMLProcessingInstructions.m; sourceTree = ""; }; @@ -623,10 +622,16 @@ 4B55A10D133AC24500B58A93 /* OFReadFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFReadFailedException.m; path = src/exceptions/OFReadFailedException.m; sourceTree = ""; }; 4B55A10E133AC24500B58A93 /* OFReadOrWriteFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFReadOrWriteFailedException.h; path = src/exceptions/OFReadOrWriteFailedException.h; sourceTree = ""; }; 4B55A10F133AC24500B58A93 /* OFReadOrWriteFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFReadOrWriteFailedException.m; path = src/exceptions/OFReadOrWriteFailedException.m; sourceTree = ""; }; 4B55A110133AC24500B58A93 /* OFWriteFailedException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFWriteFailedException.h; path = src/exceptions/OFWriteFailedException.h; sourceTree = ""; }; 4B55A111133AC24600B58A93 /* OFWriteFailedException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFWriteFailedException.m; path = src/exceptions/OFWriteFailedException.m; sourceTree = ""; }; + 4B5C112817E9AAED003C917F /* apple-forwarding-arm.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-arm.S"; path = "src/forwarding/apple-forwarding-arm.S"; sourceTree = ""; }; + 4B5C112917E9AAED003C917F /* apple-forwarding-i386.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-i386.S"; path = "src/forwarding/apple-forwarding-i386.S"; sourceTree = ""; }; + 4B5C112A17E9AAED003C917F /* apple-forwarding-ppc.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-ppc.S"; path = "src/forwarding/apple-forwarding-ppc.S"; sourceTree = ""; }; + 4B5C112B17E9AAED003C917F /* apple-forwarding-x86_64.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-x86_64.S"; path = "src/forwarding/apple-forwarding-x86_64.S"; sourceTree = ""; }; + 4B5C112C17E9AAED003C917F /* forwarding.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = forwarding.S; path = src/forwarding/forwarding.S; sourceTree = ""; }; + 4B5C112E17E9AB0C003C917F /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = src/forwarding/Makefile; sourceTree = ""; }; 4B5CF8F614940BD2007AA324 /* OFString+JSONValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "OFString+JSONValue.h"; path = "src/OFString+JSONValue.h"; sourceTree = ""; }; 4B5CF8F714940BD2007AA324 /* OFString+JSONValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "OFString+JSONValue.m"; path = "src/OFString+JSONValue.m"; sourceTree = ""; }; 4B64D6EB1425381E007BDFB1 /* OFStreamObserver_poll.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFStreamObserver_poll.h; path = src/OFStreamObserver_poll.h; sourceTree = ""; }; 4B64D6EC1425381E007BDFB1 /* OFStreamObserver_poll.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFStreamObserver_poll.m; path = src/OFStreamObserver_poll.m; sourceTree = ""; }; 4B64D6ED1425381E007BDFB1 /* OFStreamObserver_select.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFStreamObserver_select.h; path = src/OFStreamObserver_select.h; sourceTree = ""; }; @@ -801,14 +806,10 @@ 4BB50DCF12F863C700C9393F /* of_asprintf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = of_asprintf.h; path = src/of_asprintf.h; sourceTree = SOURCE_ROOT; }; 4BB50DD012F863C700C9393F /* of_asprintf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = of_asprintf.m; path = src/of_asprintf.m; sourceTree = SOURCE_ROOT; }; 4BB524BF143D1E4E0085FBCC /* OFProcess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFProcess.h; path = src/OFProcess.h; sourceTree = ""; }; 4BB524C0143D1E4E0085FBCC /* OFProcess.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFProcess.m; path = src/OFProcess.m; sourceTree = ""; }; 4BB52CC617B8EA7F00B7EBF5 /* codepage_437.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = codepage_437.m; path = src/codepage_437.m; sourceTree = ""; }; - 4BB52CC817B8EA8E00B7EBF5 /* apple-forwarding-arm.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-arm.S"; path = "src/apple-forwarding-arm.S"; sourceTree = ""; }; - 4BB52CC917B8EA8E00B7EBF5 /* apple-forwarding-i386.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-i386.S"; path = "src/apple-forwarding-i386.S"; sourceTree = ""; }; - 4BB52CCA17B8EA8E00B7EBF5 /* apple-forwarding-ppc.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-ppc.S"; path = "src/apple-forwarding-ppc.S"; sourceTree = ""; }; - 4BB52CCB17B8EA8E00B7EBF5 /* apple-forwarding-x86_64.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; name = "apple-forwarding-x86_64.S"; path = "src/apple-forwarding-x86_64.S"; sourceTree = ""; }; 4BBA36C411406AB700CBA3AC /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = atomic.h; path = src/atomic.h; sourceTree = ""; }; 4BBA36C511406AB700CBA3AC /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macros.h; path = src/macros.h; sourceTree = ""; }; 4BC090421584F6760040640F /* OFInvalidJSONException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFInvalidJSONException.h; path = src/exceptions/OFInvalidJSONException.h; sourceTree = ""; }; 4BC090431584F6760040640F /* OFInvalidJSONException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFInvalidJSONException.m; path = src/exceptions/OFInvalidJSONException.m; sourceTree = ""; }; 4BCAA9AD1772432E003EF859 /* OFMessagePackExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFMessagePackExtension.h; path = src/OFMessagePackExtension.h; sourceTree = ""; }; @@ -832,11 +833,10 @@ 4BE5F0D812DF4225005C7A0C /* OFConstantString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFConstantString.m; path = src/OFConstantString.m; sourceTree = SOURCE_ROOT; }; 4BE5F0D912DF4225005C7A0C /* OFDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFDate.h; path = src/OFDate.h; sourceTree = SOURCE_ROOT; }; 4BE5F0DA12DF4225005C7A0C /* OFDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDate.m; path = src/OFDate.m; sourceTree = SOURCE_ROOT; }; 4BE5F0E412DF4259005C7A0C /* OFBlockTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFBlockTests.m; path = tests/OFBlockTests.m; sourceTree = SOURCE_ROOT; }; 4BE5F0E512DF4259005C7A0C /* OFDateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFDateTests.m; path = tests/OFDateTests.m; sourceTree = SOURCE_ROOT; }; - 4BEF2D3017A5BF5200BB8BA3 /* forwarding.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = forwarding.S; path = src/forwarding.S; sourceTree = ""; }; 4BF0749512DFAFCA00A4ADD1 /* OFURLTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFURLTests.m; path = tests/OFURLTests.m; sourceTree = SOURCE_ROOT; }; 4BF1BCBF11C9663F0025511F /* objfw-defs.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "objfw-defs.h.in"; path = "src/objfw-defs.h.in"; sourceTree = ""; }; 4BF1BCC011C9663F0025511F /* OFHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFHash.h; path = src/OFHash.h; sourceTree = ""; }; 4BF1BCC211C9663F0025511F /* OFMD5Hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OFMD5Hash.h; path = src/OFMD5Hash.h; sourceTree = ""; }; 4BF1BCC311C9663F0025511F /* OFMD5Hash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OFMD5Hash.m; path = src/OFMD5Hash.m; sourceTree = ""; }; @@ -1088,22 +1088,43 @@ isa = PBXGroup; children = ( 4B3D23BB1337FC5800DD29B8 /* Info.plist */, 4B19023A1338D6A2000374C9 /* Makefile */, 4BDF37B41338055600F9A81A /* config.h */, - 4B3D23EF1338008000DD29B8 /* mach_alias_list */, 4BD98C011338140B0048DD5B /* objfw-defs.h */, ); name = "Supporting Files"; path = ObjFW; sourceTree = ""; + }; + 4B5C112717E9AAC1003C917F /* Forwarding */ = { + isa = PBXGroup; + children = ( + 4B5C112D17E9AAF6003C917F /* Supporting Files */, + 4B5C112817E9AAED003C917F /* apple-forwarding-arm.S */, + 4B5C112917E9AAED003C917F /* apple-forwarding-i386.S */, + 4B5C112A17E9AAED003C917F /* apple-forwarding-ppc.S */, + 4B5C112B17E9AAED003C917F /* apple-forwarding-x86_64.S */, + 4B5C112C17E9AAED003C917F /* forwarding.S */, + ); + name = Forwarding; + sourceTree = ""; + }; + 4B5C112D17E9AAF6003C917F /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 4B5C112E17E9AB0C003C917F /* Makefile */, + ); + name = "Supporting Files"; + sourceTree = ""; }; 4B6EF66C123535340076B512 /* ObjFW */ = { isa = PBXGroup; children = ( 4B187E07163EA2730049A832 /* Bridge */, 4B17FF6E133A28E0003E6DCD /* Exceptions */, + 4B5C112717E9AAC1003C917F /* Forwarding */, 4B3D23801337FBC800DD29B8 /* Supporting Files */, 4B175C1D116D130B003C99CB /* OFApplication.h */, 4B175C1E116D130B003C99CB /* OFApplication.m */, 4B67995A1099E7C50041064A /* OFArray.h */, 4B67995B1099E7C50041064A /* OFArray.m */, @@ -1285,14 +1306,10 @@ 4BE52D2017B990B4005958D1 /* OFZIPArchive.m */, 4B8B025717BBA7C7009ED983 /* OFZIPArchiveEntry.h */, 4B8B025817BBA7C7009ED983 /* OFZIPArchiveEntry.m */, 4B6C8AD717BD5C2E00B194F2 /* OFZIPArchiveEntry+Private.h */, 4B6AF97310A8D4450003FB0A /* ObjFW.h */, - 4BB52CC817B8EA8E00B7EBF5 /* apple-forwarding-arm.S */, - 4BB52CC917B8EA8E00B7EBF5 /* apple-forwarding-i386.S */, - 4BB52CCA17B8EA8E00B7EBF5 /* apple-forwarding-ppc.S */, - 4BB52CCB17B8EA8E00B7EBF5 /* apple-forwarding-x86_64.S */, 4B6799561099E7C50041064A /* asprintf.h */, 4B6AF96C10A8D3E40003FB0A /* asprintf.m */, 4BBA36C411406AB700CBA3AC /* atomic.h */, 4BA9CFA315E129D30076DC74 /* autorelease.h */, 4B3D236D1337FB5800DD29B8 /* base64.h */, @@ -1299,11 +1316,10 @@ 4B3D236E1337FB5800DD29B8 /* base64.m */, 4B837D7716829C5F007A3E83 /* block.h */, 4BB52CC617B8EA7F00B7EBF5 /* codepage_437.m */, 4B837D7816829C5F007A3E83 /* instance.h */, 4B6AF96F10A8D40E0003FB0A /* iso_8859_15.m */, - 4BEF2D3017A5BF5200BB8BA3 /* forwarding.S */, 4BE17AD812FD744C002CEB0B /* foundation-compat.m */, 4BBA36C511406AB700CBA3AC /* macros.h */, 4BF1BCBF11C9663F0025511F /* objfw-defs.h.in */, 4BB50DCF12F863C700C9393F /* of_asprintf.h */, 4BB50DD012F863C700C9393F /* of_asprintf.m */, @@ -1870,11 +1886,10 @@ 4BE52D2217B990B4005958D1 /* OFZIPArchive.m in Sources */, 4B8B025A17BBA7C7009ED983 /* OFZIPArchiveEntry.m in Sources */, 4B3D23B31337FC0D00DD29B8 /* base64.m in Sources */, 4BB52CC717B8EA7F00B7EBF5 /* codepage_437.m in Sources */, 4B3D23B41337FC0D00DD29B8 /* iso_8859_15.m in Sources */, - 4BEF2D3117A5BF5200BB8BA3 /* forwarding.S in Sources */, 4B3D23B51337FC0D00DD29B8 /* foundation-compat.m in Sources */, 4B3D23EE1337FFD000DD29B8 /* of_asprintf.m in Sources */, 4BA355BA14879BDD00442EF4 /* of_strptime.m in Sources */, 4B3D23B91337FC0D00DD29B8 /* unicode.m in Sources */, 4B3D23BA1337FC0D00DD29B8 /* windows_1252.m in Sources */, @@ -1930,10 +1945,11 @@ 4BD77FDF176E4BC40031C497 /* OFUnboundPrefixException.m in Sources */, 4B6743F6163C384A00EB1E59 /* OFUnlockFailedException.m in Sources */, 4B17FFB2133A3664003E6DCD /* OFUnsupportedProtocolException.m in Sources */, 4BA4846315CC9F1E00D75360 /* OFUnsupportedVersionException.m in Sources */, 4B55A117133AC24600B58A93 /* OFWriteFailedException.m in Sources */, + 4B5C112F17E9AB3E003C917F /* forwarding.S in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 4BF33AEC133807310059CEF7 /* Sources */ = { isa = PBXSourcesBuildPhase; Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -126,18 +126,22 @@ AS_IF([test x"$enable_shared" != x"no"], [ BUILDSYS_SHARED_LIB AC_SUBST(OBJFW_SHARED_LIB, "${LIB_PREFIX}objfw${LIB_SUFFIX}") AC_SUBST(EXCEPTIONS_LIB_A, "exceptions.lib.a") AC_SUBST(EXCEPTIONS_EXCEPTIONS_LIB_A, "exceptions/exceptions.lib.a") + AC_SUBST(FORWARDING_LIB_A, "forwarding.lib.a") + AC_SUBST(FORWARDING_FORWARDING_LIB_A, "forwarding/forwarding.lib.a") ], [ AC_SUBST(LIBOBJFW_DEP, "../src/libobjfw.a") ]) AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static], [build static library])) AS_IF([test x"$enable_static" = x"yes" -o x"$enable_shared" = x"no"], [ AC_SUBST(OBJFW_STATIC_LIB, "libobjfw.a") AC_SUBST(EXCEPTIONS_A, "exceptions.a") AC_SUBST(EXCEPTIONS_EXCEPTIONS_A, "exceptions/exceptions.a") + AC_SUBST(FORWARDING_A, "forwarding.a") + AC_SUBST(FORWARDING_FORWARDING_A, "forwarding/forwarding.a") ]) AC_DEFINE_UNQUOTED(PLUGIN_SUFFIX, "$PLUGIN_SUFFIX", [Suffix for plugins]) AS_IF([test x"$PLUGIN_SUFFIX" != x""], [ AC_SUBST(USE_SRCS_PLUGINS, '${SRCS_PLUGINS}') Index: extra.mk.in ================================================================== --- extra.mk.in +++ extra.mk.in @@ -15,10 +15,14 @@ BRIDGE = @BRIDGE@ EXCEPTIONS_A = @EXCEPTIONS_A@ EXCEPTIONS_EXCEPTIONS_A = @EXCEPTIONS_EXCEPTIONS_A@ EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ +FORWARDING_A = @FORWARDING_A@ +FORWARDING_FORWARDING_A = @FORWARDING_FORWARDING_A@ +FORWARDING_FORWARDING_LIB_A = @FORWARDING_FORWARDING_LIB_A@ +FORWARDING_LIB_A = @FORWARDING_LIB_A@ FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@ INSTANCE_M = @INSTANCE_M@ LIBOBJFW_DEP = @LIBOBJFW_DEP@ MAP_LDFLAGS = @MAP_LDFLAGS@ OFBLOCKTESTS_M = @OFBLOCKTESTS_M@ Index: src/Makefile ================================================================== --- src/Makefile +++ src/Makefile @@ -1,8 +1,8 @@ include ../extra.mk -SUBDIRS = ${RUNTIME} exceptions ${BRIDGE} +SUBDIRS = ${RUNTIME} exceptions ${BRIDGE} forwarding SHARED_LIB = ${OBJFW_SHARED_LIB} STATIC_LIB = ${OBJFW_STATIC_LIB} LIB_MAJOR = ${OBJFW_LIB_MAJOR} LIB_MINOR = ${OBJFW_LIB_MINOR} @@ -116,24 +116,27 @@ OFMutableString_UTF8.m \ OFSet_hashtable.m \ OFString_UTF8.m \ ${ASPRINTF_M} \ codepage_437.m \ - forwarding.S \ ${FOUNDATION_COMPAT_M} \ iso_8859_15.m \ windows_1252.m SRCS_SOCKETS += ${OFSTREAMOBSERVER_KQUEUE_M} \ ${OFSTREAMOBSERVER_POLL_M} \ ${OFSTREAMOBSERVER_SELECT_M} \ OFTCPSocket+SOCKS5.m -OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_A} ${RUNTIME_RUNTIME_A} -LIB_OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_LIB_A} ${RUNTIME_RUNTIME_LIB_A} +OBJS_EXTRA = ${RUNTIME_RUNTIME_A} \ + ${EXCEPTIONS_EXCEPTIONS_A} \ + ${FORWARDING_FORWARDING_A} +LIB_OBJS_EXTRA = ${RUNTIME_RUNTIME_LIB_A} \ + ${EXCEPTIONS_EXCEPTIONS_LIB_A} \ + ${FORWARDING_FORWARDING_LIB_A} include ../buildsys.mk CPPFLAGS += -I. -I.. -Iexceptions -Iruntime LD = ${OBJC} LDFLAGS += ${REEXPORT_LIBOBJC} ${BRIDGE}: ${SHARED_LIB} DELETED src/apple-forwarding-arm.S Index: src/apple-forwarding-arm.S ================================================================== --- src/apple-forwarding-arm.S +++ src/apple-forwarding-arm.S @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl _of_forward -.globl _of_forward_stret - -.section __TEXT, __objc_methname, cstring_literals -L_str_forwardingTargetForSelector: - .asciz "forwardingTargetForSelector:" - -.section __DATA, __objc_selrefs, literal_pointers, no_dead_strip -L_sel_forwardingTargetForSelector: - .long L_str_forwardingTargetForSelector - -.section __DATA, __objc_imageinfo, regular, no_dead_strip - .long 0, 0 - -.section __TEXT, __text, regular, pure_instructions -.arm -.align 2 -_of_forward: - stmfd sp!, {r0-r3, lr} - fstmfdd sp!, {d0-d7} - - blx _object_getClass - - ldr r1, L_sel_forwardingTargetForSelector_indirect_L0 -L0: - ldr r1, [pc, r1] - stmfd sp!, {r1} - blx _class_respondsToSelector - ldmfd sp!, {r1} - cmp r0, #0 - beq fail - - ldr r0, [sp, #64] - ldr r2, [sp, #68] - blx _objc_msgSend - - cmp r0, #0 - beq fail - - ldr r1, [sp, #64] - cmp r0, r1 - beq fail - - fldmfdd sp!, {d0-d7} - add sp, sp, #4 @ throw away r0 - ldmfd sp!, {r1-r3, lr} - - b _objc_msgSend - -fail: - fldmfdd sp!, {d0-d7} - ldmfd sp!, {r0-r3, lr} - b _of_method_not_found - -.align 2 -_of_forward_stret: - stmfd sp!, {r0-r3, lr} - fstmfdd sp!, {d0-d7} - - mov r0, r1 - blx _object_getClass - - ldr r1, L_sel_forwardingTargetForSelector_indirect_L1 -L1: - ldr r1, [pc, r1] - stmfd sp!, {r1} - blx _class_respondsToSelector - ldmfd sp!, {r1} - cmp r0, #0 - beq fail_stret - - ldr r0, [sp, #68] - ldr r2, [sp, #72] - blx _objc_msgSend - - cmp r0, #0 - beq fail_stret - - ldr r1, [sp, #68] - cmp r0, r1 - beq fail_stret - - mov r1, r0 - - fldmfdd sp!, {d0-d7} - ldmfd sp!, {r0} - add sp, sp, #4 @ throw away r1 - ldmfd sp!, {r2-r3, lr} - - b _objc_msgSend_stret - -fail_stret: - fldmfdd sp!, {d0-d7} - ldmfd sp!, {r0-r3, lr} - mov r0, r1 - mov r1, r2 - b _of_method_not_found - -.data_region -L_sel_forwardingTargetForSelector_indirect_L0: - .long L_sel_forwardingTargetForSelector-(L0+8) -L_sel_forwardingTargetForSelector_indirect_L1: - .long L_sel_forwardingTargetForSelector-(L1+8) -.end_data_region DELETED src/apple-forwarding-i386.S Index: src/apple-forwarding-i386.S ================================================================== --- src/apple-forwarding-i386.S +++ src/apple-forwarding-i386.S @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl _of_forward -.globl _of_forward_stret - -.section __TEXT, __cstring, cstring_literals -L_str_forwardingTargetForSelector: - .asciz "forwardingTargetForSelector:" - -.section __OBJC, __message_refs, literal_pointers, no_dead_strip -L_sel_forwardingTargetForSelector: - .long L_str_forwardingTargetForSelector - -.section __OBJC, __image_info - .long 0, 0 - -.section __TEXT, __text, regular, pure_instructions -_of_forward: - pushl %ebp - movl %esp, %ebp - - pushl %ebx - subl $20, %esp - - call get_eip -.L0: - movl 8(%ebp), %eax - movl %eax, (%esp) - call _object_getClass - - movl %eax, (%esp) - movl L_sel_forwardingTargetForSelector-.L0(%ebx), %eax - movl %eax, 4(%esp) - call _class_respondsToSelector - testl %eax, %eax - jz fail - - movl 8(%ebp), %eax - movl %eax, (%esp) - movl L_sel_forwardingTargetForSelector-.L0(%ebx), %eax - movl %eax, 4(%esp) - movl 12(%ebp), %eax - movl %eax, 8(%esp) - call _objc_msgSend - - testl %eax, %eax - jz fail - - cmpl 8(%ebp), %eax - je fail - - movl %eax, 8(%ebp) - - addl $20, %esp - popl %ebx - popl %ebp - - jmp _objc_msgSend - -fail: - addl $20, %esp - popl %ebx - popl %ebp - - jmp _of_method_not_found - -_of_forward_stret: - pushl %ebp - movl %esp, %ebp - - pushl %ebx - subl $20, %esp - - call get_eip -.L1: - movl 12(%ebp), %eax - movl %eax, (%esp) - call _object_getClass - - movl %eax, (%esp) - movl L_sel_forwardingTargetForSelector-.L1(%ebx), %eax - movl %eax, 4(%esp) - call _class_respondsToSelector - testl %eax, %eax - jz fail_stret - - movl 12(%ebp), %eax - movl %eax, (%esp) - movl L_sel_forwardingTargetForSelector-.L1(%ebx), %eax - movl %eax, 4(%esp) - movl 16(%ebp), %eax - movl %eax, 8(%esp) - call _objc_msgSend - - testl %eax, %eax - jz fail_stret - - cmpl 12(%ebp), %eax - je fail_stret - - movl %eax, 12(%ebp) - - addl $20, %esp - popl %ebx - popl %ebp - - jmp _objc_msgSend_stret - -fail_stret: - movl 12(%ebp), %eax - movl %eax, 8(%ebp) - movl 16(%ebp), %eax - movl %eax, 12(%ebp) - - addl $20, %esp - popl %ebx - popl %ebp - - jmp _of_method_not_found - -get_eip: - movl (%esp), %ebx - ret DELETED src/apple-forwarding-ppc.S Index: src/apple-forwarding-ppc.S ================================================================== --- src/apple-forwarding-ppc.S +++ src/apple-forwarding-ppc.S @@ -1,235 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl _of_forward -.globl _of_forward_stret - -.section __TEXT, __cstring, cstring_literals -L_str_forwardingTargetForSelector: - .asciz "forwardingTargetForSelector:" - -.section __OBJC, __message_refs, literal_pointers, no_dead_strip -L_sel_forwardingTargetForSelector: - .long L_str_forwardingTargetForSelector - -.section __OBJC, __image_info - .long 0, 0 - -.section __TEXT, __text, regular, pure_instructions -_of_forward: - mflr r0 - stw r0, 8(r1) - stwu r1, -192(r1) - - /* - * Save all arguments and r13. - * - * We can dump two parameters in the parameter area as we know that - * space has been reserved for at least two parameters. - */ - stw r3, 216(r1) - stw r4, 220(r1) - stw r5, 56(r1) - stw r6, 60(r1) - stw r7, 64(r1) - stw r8, 68(r1) - stw r9, 72(r1) - stw r10, 76(r1) - stw r13, 80(r1) - - /* Save all floating point arguments */ - stfd f1, 88(r1) - stfd f2, 96(r1) - stfd f3, 104(r1) - stfd f4, 112(r1) - stfd f5, 120(r1) - stfd f6, 128(r1) - stfd f7, 136(r1) - stfd f8, 144(r1) - stfd f9, 152(r1) - stfd f10, 160(r1) - stfd f11, 168(r1) - stfd f12, 176(r1) - stfd f13, 184(r1) - - bl _object_getClass - - bl L0 -L0: - mflr r13 - addis r13, r13, ha16(L_sel_forwardingTargetForSelector-L0) - lwz r13, lo16(L_sel_forwardingTargetForSelector-L0)(r13) - mr r4, r13 - bl _class_respondsToSelector - cmpwi r3, 0 - beq- fail - - lwz r3, 216(r1) - mr r4, r13 - lwz r5, 220(r1) - bl _objc_msgSend - - cmpwi r3, 0 - beq- fail - - lwz r4, 216(r1) - cmpw r3, r4 - beq- fail - - /* Restore all arguments and r13, except r3 */ - lwz r4, 220(r1) - lwz r5, 56(r1) - lwz r6, 60(r1) - lwz r7, 64(r1) - lwz r8, 68(r1) - lwz r9, 72(r1) - lwz r10, 76(r1) - lwz r13, 80(r1) - - /* Restore all floating point arguments */ - lfd f1, 88(r1) - lfd f2, 96(r1) - lfd f3, 104(r1) - lfd f4, 112(r1) - lfd f5, 120(r1) - lfd f6, 128(r1) - lfd f7, 136(r1) - lfd f8, 144(r1) - lfd f9, 152(r1) - lfd f10, 160(r1) - lfd f11, 168(r1) - lfd f12, 176(r1) - lfd f13, 184(r1) - - addi r1, r1, 192 - lwz r0, 8(r1) - mtlr r0 - - b _objc_msgSend - -fail: - lwz r3, 216(r1) - lwz r4, 220(r1) - - addi r1, r1, 192 - lwz r0, 8(r1) - mtlr r0 - - b _of_method_not_found - -_of_forward_stret: - mflr r0 - stw r0, 8(r1) - stwu r1, -184(r1) - - /* - * Save all arguments and r13. - * - * We can dump three parameters in the parameter area as we know that - * space has been reserved for at least three parameters. - */ - stw r3, 208(r1) - stw r4, 212(r1) - stw r5, 216(r1) - stw r6, 56(r1) - stw r7, 60(r1) - stw r8, 64(r1) - stw r9, 68(r1) - stw r10, 72(r1) - stw r13, 76(r1) - - /* Save all floating point arguments */ - stfd f1, 80(r1) - stfd f2, 88(r1) - stfd f3, 96(r1) - stfd f4, 104(r1) - stfd f5, 112(r1) - stfd f6, 120(r1) - stfd f7, 128(r1) - stfd f8, 136(r1) - stfd f9, 144(r1) - stfd f10, 152(r1) - stfd f11, 160(r1) - stfd f12, 168(r1) - stfd f13, 176(r1) - - mr r3, r4 - bl _object_getClass - - bl L1 -L1: - mflr r13 - addis r13, r13, ha16(L_sel_forwardingTargetForSelector-L1) - lwz r13, lo16(L_sel_forwardingTargetForSelector-L1)(r13) - mr r4, r13 - bl _class_respondsToSelector - cmpwi r3, 0 - beq- fail_stret - - lwz r3, 212(r1) - mr r4, r13 - lwz r5, 216(r1) - bl _objc_msgSend - - cmpwi r3, 0 - beq- fail_stret - - lwz r4, 212(r1) - cmpw r3, r4 - beq- fail_stret - - mr r4, r3 - - /* Restore all arguments and r13, except r4 */ - lwz r3, 208(r1) - lwz r5, 216(r1) - lwz r6, 56(r1) - lwz r7, 60(r1) - lwz r8, 64(r1) - lwz r9, 68(r1) - lwz r10, 72(r1) - lwz r13, 76(r1) - - /* Restore all floating point arguments */ - lfd f1, 80(r1) - lfd f2, 88(r1) - lfd f3, 96(r1) - lfd f4, 104(r1) - lfd f5, 112(r1) - lfd f6, 120(r1) - lfd f7, 128(r1) - lfd f8, 136(r1) - lfd f9, 144(r1) - lfd f10, 152(r1) - lfd f11, 160(r1) - lfd f12, 168(r1) - lfd f13, 176(r1) - - addi r1, r1, 184 - lwz r0, 8(r1) - mtlr r0 - - b _objc_msgSend_stret - -fail_stret: - lwz r3, 212(r1) - lwz r4, 216(r1) - - addi r1, r1, 184 - lwz r0, 8(r1) - mtlr r0 - - b _of_method_not_found DELETED src/apple-forwarding-x86_64.S Index: src/apple-forwarding-x86_64.S ================================================================== --- src/apple-forwarding-x86_64.S +++ src/apple-forwarding-x86_64.S @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl _of_forward -.globl _of_forward_stret - -.section __TEXT, __objc_methname, cstring_literals -L_str_forwardingTargetForSelector: - .asciz "forwardingTargetForSelector:" - -.section __DATA, __objc_selrefs, literal_pointers, no_dead_strip -L_sel_forwardingTargetForSelector: - .quad L_str_forwardingTargetForSelector - -.section __DATA, __objc_imageinfo, regular, no_dead_strip - .long 0, 0 - -.section __TEXT, __text, regular, pure_instructions -_of_forward: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movdqa %xmm0, -0x50(%rbp) - movdqa %xmm1, -0x60(%rbp) - movdqa %xmm2, -0x70(%rbp) - movdqa %xmm3, -0x80(%rbp) - movdqa %xmm4, -0x90(%rbp) - movdqa %xmm5, -0xA0(%rbp) - movdqa %xmm6, -0xB0(%rbp) - movdqa %xmm7, -0xC0(%rbp) - - call _object_getClass - - movq %rax, %rdi - movq L_sel_forwardingTargetForSelector(%rip), %rsi - call _class_respondsToSelector - testq %rax, %rax - jz fail - - movq -0x10(%rbp), %rdi - movq L_sel_forwardingTargetForSelector(%rip), %rsi - movq -0x18(%rbp), %rdx - call _objc_msgSend - movq %rax, %rdi - - testq %rdi, %rdi - jz fail - - cmpq -0x10(%rbp), %rdi - je fail - - /* Restore all arguments, except %rdi */ - movdqa -0xC0(%rbp), %xmm7 - movdqa -0xB0(%rbp), %xmm6 - movdqa -0xA0(%rbp), %xmm5 - movdqa -0x90(%rbp), %xmm4 - movdqa -0x80(%rbp), %xmm3 - movdqa -0x70(%rbp), %xmm2 - movdqa -0x60(%rbp), %xmm1 - movdqa -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmp _objc_msgSend - -fail: - movq -0x10(%rbp), %rdi - movq -0x18(%rbp), %rsi - - movq %rbp, %rsp - popq %rbp - - jmp _of_method_not_found - -_of_forward_stret: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movdqa %xmm0, -0x50(%rbp) - movdqa %xmm1, -0x60(%rbp) - movdqa %xmm2, -0x70(%rbp) - movdqa %xmm3, -0x80(%rbp) - movdqa %xmm4, -0x90(%rbp) - movdqa %xmm5, -0xA0(%rbp) - movdqa %xmm6, -0xB0(%rbp) - movdqa %xmm7, -0xC0(%rbp) - - movq %rsi, %rdi - call _object_getClass - - movq %rax, %rdi - movq L_sel_forwardingTargetForSelector(%rip), %rsi - call _class_respondsToSelector - testq %rax, %rax - jz fail_stret - - movq -0x18(%rbp), %rdi - movq L_sel_forwardingTargetForSelector(%rip), %rsi - movq -0x20(%rbp), %rdx - call _objc_msgSend - movq %rax, %rsi - - testq %rsi, %rsi - jz fail_stret - - cmpq -0x18(%rbp), %rsi - je fail_stret - - /* Restore all arguments, except %rsi */ - movdqa -0xC0(%rbp), %xmm7 - movdqa -0xB0(%rbp), %xmm6 - movdqa -0xA0(%rbp), %xmm5 - movdqa -0x90(%rbp), %xmm4 - movdqa -0x80(%rbp), %xmm3 - movdqa -0x70(%rbp), %xmm2 - movdqa -0x60(%rbp), %xmm1 - movdqa -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmp _objc_msgSend_stret - -fail_stret: - movq -0x18(%rbp), %rdi - movq -0x20(%rbp), %rsi - - movq %rbp, %rsp - popq %rbp - - jmp _of_method_not_found DELETED src/forwarding-amd64-elf.S Index: src/forwarding-amd64-elf.S ================================================================== --- src/forwarding-amd64-elf.S +++ src/forwarding-amd64-elf.S @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl of_forward -.globl of_forward_stret - -.section .text -of_forward: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movdqa %xmm0, -0x50(%rbp) - movdqa %xmm1, -0x60(%rbp) - movdqa %xmm2, -0x70(%rbp) - movdqa %xmm3, -0x80(%rbp) - movdqa %xmm4, -0x90(%rbp) - movdqa %xmm5, -0xA0(%rbp) - movdqa %xmm6, -0xB0(%rbp) - movdqa %xmm7, -0xC0(%rbp) - - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call objc_msg_lookup@PLT - movq -0x10(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x18(%rbp), %rdx - call *%rax - movq %rax, -0x10(%rbp) - - movq %rax, %rdi - movq -0x18(%rbp), %rsi - call objc_msg_lookup@PLT - movq %rax, %r11 - - /* Restore all arguments */ - movdqa -0xC0(%rbp), %xmm7 - movdqa -0xB0(%rbp), %xmm6 - movdqa -0xA0(%rbp), %xmm5 - movdqa -0x90(%rbp), %xmm4 - movdqa -0x80(%rbp), %xmm3 - movdqa -0x70(%rbp), %xmm2 - movdqa -0x60(%rbp), %xmm1 - movdqa -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 -.type of_forward, %function -.size of_forward, .-of_forward - -of_forward_stret: - pushq %rbp - movq %rsp, %rbp - - /* Save all arguments */ - subq $0xC0, %rsp /* 16-byte alignment */ - movq %rax, -0x8(%rbp) - movq %rdi, -0x10(%rbp) - movq %rsi, -0x18(%rbp) - movq %rdx, -0x20(%rbp) - movq %rcx, -0x28(%rbp) - movq %r8, -0x30(%rbp) - movq %r9, -0x38(%rbp) - movdqa %xmm0, -0x50(%rbp) - movdqa %xmm1, -0x60(%rbp) - movdqa %xmm2, -0x70(%rbp) - movdqa %xmm3, -0x80(%rbp) - movdqa %xmm4, -0x90(%rbp) - movdqa %xmm5, -0xA0(%rbp) - movdqa %xmm6, -0xB0(%rbp) - movdqa %xmm7, -0xC0(%rbp) - - movq %rsi, %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - call objc_msg_lookup@PLT - movq -0x18(%rbp), %rdi - leaq sel_forwardingTargetForSelector_(%rip), %rsi - movq -0x20(%rbp), %rdx - call *%rax - movq %rax, -0x18(%rbp) - - movq %rax, %rdi - movq -0x20(%rbp), %rsi - call objc_msg_lookup_stret@PLT - movq %rax, %r11 - - /* Restore all arguments */ - movdqa -0xC0(%rbp), %xmm7 - movdqa -0xB0(%rbp), %xmm6 - movdqa -0xA0(%rbp), %xmm5 - movdqa -0x90(%rbp), %xmm4 - movdqa -0x80(%rbp), %xmm3 - movdqa -0x70(%rbp), %xmm2 - movdqa -0x60(%rbp), %xmm1 - movdqa -0x50(%rbp), %xmm0 - movq -0x38(%rbp), %r9 - movq -0x30(%rbp), %r8 - movq -0x28(%rbp), %rcx - movq -0x20(%rbp), %rdx - movq -0x18(%rbp), %rsi - movq -0x10(%rbp), %rdi - movq -0x8(%rbp), %rax - - movq %rbp, %rsp - popq %rbp - - jmpq *%r11 -.type of_forward_stret, %function -.size of_forward_stret, .-of_forward_stret - -init: - leaq module(%rip), %rdi - jmp __objc_exec_class@PLT - -.section .ctors, "a", %progbits - .quad init - -.section .rodata -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section .data -sel_forwardingTargetForSelector_: - .quad str_forwardingTargetForSelector_, 0 - .quad 0, 0 -symtab: - .quad 0, sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .quad 0 -module: - .quad 8, 32, 0, symtab - -#ifdef __linux__ -.section .note.GNU-stack, "", %progbits -#endif DELETED src/forwarding-arm-elf.S Index: src/forwarding-arm-elf.S ================================================================== --- src/forwarding-arm-elf.S +++ src/forwarding-arm-elf.S @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl of_forward -.globl of_forward_stret - -.section .text -of_forward: - stmfd sp!, {r0-r3, lr} - fstmfdd sp!, {d0-d7} - - ldr r1, sel_forwardingTargetForSelector__indirect_L0 -.L0: - add r1, pc - stmfd sp!, {r1} - bl objc_msg_lookup(PLT) - ldmfd sp!, {r1} - - mov r12, r0 - ldr r0, [sp, #64] - ldr r2, [sp, #68] - blx r12 - - str r0, [sp, #64] - ldr r1, [sp, #68] - bl objc_msg_lookup(PLT) - - mov r12, r0 - fldmfdd sp!, {d0-d7} - ldmfd sp!, {r0-r3, lr} - - bx r12 -.type of_forward, %function -.size of_forward, .-of_forward - -of_forward_stret: - stmfd sp!, {r0-r3, lr} - fstmfdd sp!, {d0-d7} - - mov r0, r1 - ldr r1, sel_forwardingTargetForSelector__indirect_L1 -.L1: - add r1, pc - stmfd sp!, {r1} - bl objc_msg_lookup(PLT) - ldmfd sp!, {r1} - - mov r12, r0 - ldr r0, [sp, #68] - ldr r2, [sp, #72] - blx r12 - - str r0, [sp, #68] - ldr r1, [sp, #72] - bl objc_msg_lookup_stret(PLT) - - mov r12, r0 - fldmfdd sp!, {d0-d7} - ldmfd sp!, {r0-r3, lr} - - bx r12 -.type of_forward_stret, %function -.size of_forward_stret, .-of_forward_stret - -init: - ldr r0, module_indirect_L2 -.L2: - add r0, pc - b __objc_exec_class(PLT) - -sel_forwardingTargetForSelector__indirect_L0: - .long sel_forwardingTargetForSelector_-(.L0+8) -sel_forwardingTargetForSelector__indirect_L1: - .long sel_forwardingTargetForSelector_-(.L1+8) -module_indirect_L2: - .long module-(.L2+8) - -.section .ctors, "a", %progbits - .long init - -.section .rodata -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section .data -sel_forwardingTargetForSelector_: - .long str_forwardingTargetForSelector_, 0 - .long 0, 0 -symtab: - .long 0, sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .long 0 -module: - .long 8, 16, 0, symtab - -#ifdef __linux__ -.section .note.GNU-stack, "", %progbits -#endif DELETED src/forwarding-mips-elf.S Index: src/forwarding-mips-elf.S ================================================================== --- src/forwarding-mips-elf.S +++ src/forwarding-mips-elf.S @@ -1,281 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl of_forward -.globl of_forward_stret - -.section .text -of_forward: -#ifdef __PIC__ - lui $gp, %hi(_gp_disp) - addiu $gp, $gp, %lo(_gp_disp) - addu $gp, $gp, $t9 -#endif - - addiu $sp, $sp, -72 - - /* - * O32: The registers for floating point arguments don't need to be - * saved, as the ABI specifies that all remaining arguments are passed - * in integer registers if the first argument is passed in an integer - * register. This is always the case, as the first argument is always - * self. - */ - sw $gp, 0($sp) - sw $ra, 4($sp) - sw $a0, 8($sp) - sw $a1, 12($sp) - sw $a2, 16($sp) - sw $a3, 20($sp) -#ifdef __mips_eabi - /* For some reason, $a4-$a8 are not always defined */ - sw $8, 24($sp) - sw $9, 28($sp) - sw $10, 32($sp) - sw $11, 36($sp) - - swc1 $f12, 40($sp) - swc1 $f13, 44($sp) - swc1 $f14, 48($sp) - swc1 $f15, 52($sp) - swc1 $f16, 56($sp) - swc1 $f17, 60($sp) - swc1 $f18, 64($sp) - swc1 $f19, 68($sp) -#endif - -#ifdef __PIC__ - lw $a1, %got(sel_forwardingTargetForSelector_)($gp) -#else - lui $a1, %hi(sel_forwardingTargetForSelector_) -#endif - addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) -#ifdef __PIC__ - lw $t9, %call16(objc_msg_lookup)($gp) - jalr $t9 -#else - jal objc_msg_lookup -#endif - - lw $gp, 0($sp) - lw $a0, 8($sp) -#ifdef __PIC__ - lw $a1, %got(sel_forwardingTargetForSelector_)($gp) -#else - lui $a1, %hi(sel_forwardingTargetForSelector_) -#endif - addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) - lw $a2, 12($sp) -#ifdef __PIC__ - move $t9, $v0 - jalr $t9 -#else - jalr $v0 -#endif - sw $v0, 8($sp) - - lw $gp, 0($sp) - move $a0, $v0 - lw $a1, 12($sp) -#ifdef __PIC__ - lw $t9, %call16(objc_msg_lookup)($gp) - jalr $t9 -#else - jal objc_msg_lookup -#endif - -#ifdef __mips_eabi - lwc1 $f19, 68($sp) - lwc1 $f18, 64($sp) - lwc1 $f17, 60($sp) - lwc1 $f16, 56($sp) - lwc1 $f15, 52($sp) - lwc1 $f14, 48($sp) - lwc1 $f13, 44($sp) - lwc1 $f12, 40($sp) - - lw $11, 36($sp) - lw $10, 32($sp) - lw $9, 28($sp) - lw $8, 24($sp) -#endif - lw $a3, 20($sp) - lw $a2, 16($sp) - lw $a1, 12($sp) - lw $a0, 8($sp) - lw $ra, 4($sp) - - addiu $sp, $sp, 72 - -#ifdef __PIC__ - move $t9, $v0 - jr $t9 -#else - jr $v0 -#endif -.type of_forward, %function -.size of_forward, .-of_forward - -of_forward_stret: -#ifdef __PIC__ - lui $gp, %hi(_gp_disp) - addiu $gp, $gp, %lo(_gp_disp) - addu $gp, $gp, $t9 -#endif - - addiu $sp, $sp, -72 - - /* - * O32: The registers for floating point arguments don't need to be - * saved, as the ABI specifies that all remaining arguments are passed - * in integer registers if the first argument is passed in an integer - * register. This is always the case, as the first argument is always - * self. - */ - sw $gp, 0($sp) - sw $ra, 4($sp) - sw $a0, 8($sp) - sw $a1, 12($sp) - sw $a2, 16($sp) - sw $a3, 20($sp) -#ifdef __mips_eabi - /* For some reason, $a4-$a8 are not always defined */ - sw $8, 24($sp) - sw $9, 28($sp) - sw $10, 32($sp) - sw $11, 36($sp) - - swc1 $f12, 40($sp) - swc1 $f13, 44($sp) - swc1 $f14, 48($sp) - swc1 $f15, 52($sp) - swc1 $f16, 56($sp) - swc1 $f17, 60($sp) - swc1 $f18, 64($sp) - swc1 $f19, 68($sp) -#endif - - move $a0, $a1 -#ifdef __PIC__ - lw $a1, %got(sel_forwardingTargetForSelector_)($gp) -#else - lui $a1, %hi(sel_forwardingTargetForSelector_) -#endif - addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) -#ifdef __PIC__ - lw $t9, %call16(objc_msg_lookup)($gp) - jalr $t9 -#else - jal objc_msg_lookup -#endif - - lw $gp, 0($sp) - lw $a0, 12($sp) -#ifdef __PIC__ - lw $a1, %got(sel_forwardingTargetForSelector_)($gp) -#else - lui $a1, %hi(sel_forwardingTargetForSelector_) -#endif - addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) - lw $a2, 16($sp) -#ifdef __PIC__ - move $t9, $v0 - jalr $t9 -#else - jalr $v0 -#endif - sw $v0, 12($sp) - - lw $gp, 0($sp) - move $a0, $v0 - lw $a1, 16($sp) -#ifdef __PIC__ - lw $t9, %call16(objc_msg_lookup_stret)($gp) - jalr $t9 -#else - jal objc_msg_lookup_stret -#endif - -#ifdef __mips_eabi - lwc1 $f19, 68($sp) - lwc1 $f18, 64($sp) - lwc1 $f17, 60($sp) - lwc1 $f16, 56($sp) - lwc1 $f15, 52($sp) - lwc1 $f14, 48($sp) - lwc1 $f13, 44($sp) - lwc1 $f12, 40($sp) - - lw $11, 36($sp) - lw $10, 32($sp) - lw $9, 28($sp) - lw $8, 24($sp) -#endif - lw $a3, 20($sp) - lw $a2, 16($sp) - lw $a1, 12($sp) - lw $a0, 8($sp) - lw $ra, 4($sp) - - addiu $sp, $sp, 72 - -#ifdef __PIC__ - move $t9, $v0 - jr $t9 -#else - jr $v0 -#endif -.type of_forward_stret, %function -.size of_forward_stret, .-of_forward_stret - -init: -#ifdef __PIC__ - lui $gp, %hi(_gp_disp) - addiu $gp, $gp, %lo(_gp_disp) - addu $gp, $gp, $t9 - - lw $a0, %got(module)($gp) - addiu $a0, $a0, %lo(module) - lw $t9, %call16(__objc_exec_class)($gp) - jr $t9 -#else - lui $a0, %hi(module) - addiu $a0, $a0, %lo(module) - j __objc_exec_class -#endif - -.section .ctors, "a", %progbits - .long init - -.section .rodata -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section .data -sel_forwardingTargetForSelector_: - .long str_forwardingTargetForSelector_, 0 - .long 0, 0 -symtab: - .long 0, sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .long 0 -module: - .long 8, 16, 0, symtab - -#ifdef __linux__ -.section .note.GNU-stack, "", %progbits -#endif DELETED src/forwarding-ppc-elf.S Index: src/forwarding-ppc-elf.S ================================================================== --- src/forwarding-ppc-elf.S +++ src/forwarding-ppc-elf.S @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl of_forward -.globl of_forward_stret - -.section .text -of_forward: - stwu %r1, -112(%r1) - mflr %r0 - stw %r0, 116(%r1) - - /* Save all arguments */ - stw %r3, 8(%r1) - stw %r4, 12(%r1) - stw %r5, 16(%r1) - stw %r6, 20(%r1) - stw %r7, 24(%r1) - stw %r8, 28(%r1) - stw %r9, 32(%r1) - stw %r10, 36(%r1) - - /* Save all floating point arguments */ - stfd %f1, 40(%r1) - stfd %f2, 48(%r1) - stfd %f3, 56(%r1) - stfd %f4, 64(%r1) - stfd %f5, 72(%r1) - stfd %f6, 80(%r1) - stfd %f7, 88(%r1) - stfd %f8, 96(%r1) - - lis %r4, sel_forwardingTargetForSelector_@ha - la %r4, sel_forwardingTargetForSelector_@l(%r4) - bl objc_msg_lookup@plt - mtctr %r3 - - lwz %r3, 8(%r1) - lis %r4, sel_forwardingTargetForSelector_@ha - la %r4, sel_forwardingTargetForSelector_@l(%r4) - lwz %r5, 12(%r1) - bctrl - stw %r3, 8(%r1) - - lwz %r4, 12(%r1) - bl objc_msg_lookup@plt - mtctr %r3 - - /* Restore all arguments */ - lwz %r3, 8(%r1) - lwz %r4, 12(%r1) - lwz %r5, 16(%r1) - lwz %r6, 20(%r1) - lwz %r7, 24(%r1) - lwz %r8, 28(%r1) - lwz %r9, 32(%r1) - lwz %r10, 36(%r1) - - /* Restore all floating point arguments */ - lfd %f1, 40(%r1) - lfd %f2, 48(%r1) - lfd %f3, 56(%r1) - lfd %f4, 64(%r1) - lfd %f5, 72(%r1) - lfd %f6, 80(%r1) - lfd %f7, 88(%r1) - lfd %f8, 96(%r1) - - lwz %r0, 116(%r1) - mtlr %r0 - addi %r1, %r1, 112 - bctr -.type of_forward, %function -.size of_forward, .-of_forward - -of_forward_stret: - stwu %r1, -112(%r1) - mflr %r0 - stw %r0, 116(%r1) - - /* Save all arguments */ - stw %r3, 8(%r1) - stw %r4, 12(%r1) - stw %r5, 16(%r1) - stw %r6, 20(%r1) - stw %r7, 24(%r1) - stw %r8, 28(%r1) - stw %r9, 32(%r1) - stw %r10, 36(%r1) - - /* Save all floating point arguments */ - stfd %f1, 40(%r1) - stfd %f2, 48(%r1) - stfd %f3, 56(%r1) - stfd %f4, 64(%r1) - stfd %f5, 72(%r1) - stfd %f6, 80(%r1) - stfd %f7, 88(%r1) - stfd %f8, 96(%r1) - - mr %r3, %r4 - lis %r4, sel_forwardingTargetForSelector_@ha - la %r4, sel_forwardingTargetForSelector_@l(%r4) - bl objc_msg_lookup@plt - mtctr %r3 - - lwz %r3, 12(%r1) - lis %r4, sel_forwardingTargetForSelector_@ha - la %r4, sel_forwardingTargetForSelector_@l(%r4) - lwz %r5, 16(%r1) - bctrl - stw %r3, 12(%r1) - - lwz %r4, 16(%r1) - bl objc_msg_lookup_stret@plt - mtctr %r3 - - /* Restore all arguments */ - lwz %r3, 8(%r1) - lwz %r4, 12(%r1) - lwz %r5, 16(%r1) - lwz %r6, 20(%r1) - lwz %r7, 24(%r1) - lwz %r8, 28(%r1) - lwz %r9, 32(%r1) - lwz %r10, 36(%r1) - - /* Restore all floating point arguments */ - lfd %f1, 40(%r1) - lfd %f2, 48(%r1) - lfd %f3, 56(%r1) - lfd %f4, 64(%r1) - lfd %f5, 72(%r1) - lfd %f6, 80(%r1) - lfd %f7, 88(%r1) - lfd %f8, 96(%r1) - - lwz %r0, 116(%r1) - mtlr %r0 - addi %r1, %r1, 112 - bctr -.type of_forward_stret, %function -.size of_forward_stret, .-of_forward_stret - -init: - lis %r3, module@ha - la %r3, module@l(%r3) - b __objc_exec_class@plt - -.section .ctors, "a", %progbits - .long init - -.section .rodata -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section .data -sel_forwardingTargetForSelector_: - .long str_forwardingTargetForSelector_, 0 - .long 0, 0 -symtab: - .long 0, sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .long 0 -module: - .long 8, 16, 0, symtab - -#ifdef __linux__ -.section .note.GNU-stack, "", %progbits -#endif DELETED src/forwarding-x86-elf.S Index: src/forwarding-x86-elf.S ================================================================== --- src/forwarding-x86-elf.S +++ src/forwarding-x86-elf.S @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -.globl of_forward -.globl of_forward_stret - -.section .text -of_forward: - pushl %ebp - movl %esp, %ebp - - pushl %ebx - subl $20, %esp - - call get_eip -.L0: - movl 8(%ebp), %eax - movl %eax, (%esp) - leal sel_forwardingTargetForSelector_-.L0(%ebx), %eax - movl %eax, 4(%esp) - leal objc_msg_lookup-.L0(%ebx), %eax - call *%eax - - movl 8(%ebp), %edx - movl %edx, (%esp) - leal sel_forwardingTargetForSelector_-.L0(%ebx), %edx - movl %edx, 4(%esp) - movl 12(%ebp), %edx - movl %edx, 8(%esp) - call *%eax - - movl %eax, 8(%ebp) - movl %eax, (%esp) - movl 12(%ebp), %eax - movl %eax, 4(%esp) - leal objc_msg_lookup-.L0(%ebx), %eax - call *%eax - - addl $20, %esp - popl %ebx - popl %ebp - - jmp *%eax -.type of_forward, %function -.size of_forward, .-of_forward - -of_forward_stret: - pushl %ebp - movl %esp, %ebp - - pushl %ebx - subl $20, %esp - - call get_eip -.L1: - movl 12(%ebp), %eax - movl %eax, (%esp) - leal sel_forwardingTargetForSelector_-.L1(%ebx), %eax - movl %eax, 4(%esp) - leal objc_msg_lookup-.L1(%ebx), %eax - call *%eax - - movl 12(%ebp), %edx - movl %edx, (%esp) - leal sel_forwardingTargetForSelector_-.L1(%ebx), %edx - movl %edx, 4(%esp) - movl 16(%ebp), %edx - movl %edx, 8(%esp) - call *%eax - - movl %eax, 12(%ebp) - movl %eax, (%esp) - movl 16(%ebp), %eax - movl %eax, 4(%esp) - leal objc_msg_lookup_stret-.L1(%ebx), %eax - call *%eax - - addl $20, %esp - popl %ebx - popl %ebp - - jmp *%eax -.type of_forward_stret, %function -.size of_forward_stret, .-of_forward_stret - -init: - pushl %ebp - movl %esp, %ebp - - pushl %ebx - subl $4, %esp - - call get_eip -.L2: - leal module-.L2(%ebx), %eax - movl %eax, (%esp) - leal __objc_exec_class-.L2(%ebx), %eax - call *%eax - - addl $4, %esp - popl %ebx - popl %ebp - ret - -get_eip: - movl (%esp), %ebx - ret - -.section .ctors, "a", %progbits - .long init - -.section .rodata -str_forwardingTargetForSelector_: - .asciz "forwardingTargetForSelector:" - -.section .data -sel_forwardingTargetForSelector_: - .long str_forwardingTargetForSelector_, 0 - .long 0, 0 -symtab: - .long 0, sel_forwardingTargetForSelector_ - .short 0, 0 - .long 0 - .long 0 -module: - .long 8, 16, 0, symtab - -#ifdef __linux__ -.section .note.GNU-stack, "", %progbits -#endif DELETED src/forwarding.S Index: src/forwarding.S ================================================================== --- src/forwarding.S +++ src/forwarding.S @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 - * Jonathan Schleifer - * - * All rights reserved. - * - * This file is part of ObjFW. It may be distributed under the terms of the - * Q Public License 1.0, which can be found in the file LICENSE.QPL included in - * the packaging of this file. - * - * Alternatively, it may be distributed under the terms of the GNU General - * Public License, either version 2 or 3, which can be found in the file - * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this - * file. - */ - -#include "config.h" - -#ifdef OF_APPLE_RUNTIME -# if defined(__x86_64__) -# include "apple-forwarding-x86_64.S" -# elif defined(__i386__) -# include "apple-forwarding-i386.S" -# elif defined(__arm__) -# include "apple-forwarding-arm.S" -# elif defined(__ppc__) -# include "apple-forwarding-ppc.S" -# endif -#else -# ifdef __ELF__ -# if defined(__amd64__) || defined(__x86_64__) -# include "forwarding-amd64-elf.S" -# elif defined(__i386__) -# include "forwarding-x86-elf.S" -# elif defined(__arm__) || defined(__ARM__) -# include "forwarding-arm-elf.S" -# elif defined(__ppc__) || defined(__PPC__) -# include "forwarding-ppc-elf.S" -# elif (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) || \ - (defined(__mips_eabi) && _MIPS_SZPTR == 32) -# include "forwarding-mips-elf.S" -# endif -# endif -#endif ADDED src/forwarding/Makefile Index: src/forwarding/Makefile ================================================================== --- src/forwarding/Makefile +++ src/forwarding/Makefile @@ -0,0 +1,10 @@ +include ../../extra.mk + +STATIC_PIC_LIB_NOINST = ${FORWARDING_LIB_A} +STATIC_LIB_NOINST = ${FORWARDING_A} + +SRCS = forwarding.S + +include ../../buildsys.mk + +ASFLAGS += -I../.. ADDED src/forwarding/apple-forwarding-arm.S Index: src/forwarding/apple-forwarding-arm.S ================================================================== --- src/forwarding/apple-forwarding-arm.S +++ src/forwarding/apple-forwarding-arm.S @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl _of_forward +.globl _of_forward_stret + +.section __TEXT, __objc_methname, cstring_literals +L_str_forwardingTargetForSelector: + .asciz "forwardingTargetForSelector:" + +.section __DATA, __objc_selrefs, literal_pointers, no_dead_strip +L_sel_forwardingTargetForSelector: + .long L_str_forwardingTargetForSelector + +.section __DATA, __objc_imageinfo, regular, no_dead_strip + .long 0, 0 + +.section __TEXT, __text, regular, pure_instructions +.arm +.align 2 +_of_forward: + stmfd sp!, {r0-r3, lr} + fstmfdd sp!, {d0-d7} + + blx _object_getClass + + ldr r1, L_sel_forwardingTargetForSelector_indirect_L0 +L0: + ldr r1, [pc, r1] + stmfd sp!, {r1} + blx _class_respondsToSelector + ldmfd sp!, {r1} + cmp r0, #0 + beq fail + + ldr r0, [sp, #64] + ldr r2, [sp, #68] + blx _objc_msgSend + + cmp r0, #0 + beq fail + + ldr r1, [sp, #64] + cmp r0, r1 + beq fail + + fldmfdd sp!, {d0-d7} + add sp, sp, #4 @ throw away r0 + ldmfd sp!, {r1-r3, lr} + + b _objc_msgSend + +fail: + fldmfdd sp!, {d0-d7} + ldmfd sp!, {r0-r3, lr} + b _of_method_not_found + +.align 2 +_of_forward_stret: + stmfd sp!, {r0-r3, lr} + fstmfdd sp!, {d0-d7} + + mov r0, r1 + blx _object_getClass + + ldr r1, L_sel_forwardingTargetForSelector_indirect_L1 +L1: + ldr r1, [pc, r1] + stmfd sp!, {r1} + blx _class_respondsToSelector + ldmfd sp!, {r1} + cmp r0, #0 + beq fail_stret + + ldr r0, [sp, #68] + ldr r2, [sp, #72] + blx _objc_msgSend + + cmp r0, #0 + beq fail_stret + + ldr r1, [sp, #68] + cmp r0, r1 + beq fail_stret + + mov r1, r0 + + fldmfdd sp!, {d0-d7} + ldmfd sp!, {r0} + add sp, sp, #4 @ throw away r1 + ldmfd sp!, {r2-r3, lr} + + b _objc_msgSend_stret + +fail_stret: + fldmfdd sp!, {d0-d7} + ldmfd sp!, {r0-r3, lr} + mov r0, r1 + mov r1, r2 + b _of_method_not_found + +.data_region +L_sel_forwardingTargetForSelector_indirect_L0: + .long L_sel_forwardingTargetForSelector-(L0+8) +L_sel_forwardingTargetForSelector_indirect_L1: + .long L_sel_forwardingTargetForSelector-(L1+8) +.end_data_region ADDED src/forwarding/apple-forwarding-i386.S Index: src/forwarding/apple-forwarding-i386.S ================================================================== --- src/forwarding/apple-forwarding-i386.S +++ src/forwarding/apple-forwarding-i386.S @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl _of_forward +.globl _of_forward_stret + +.section __TEXT, __cstring, cstring_literals +L_str_forwardingTargetForSelector: + .asciz "forwardingTargetForSelector:" + +.section __OBJC, __message_refs, literal_pointers, no_dead_strip +L_sel_forwardingTargetForSelector: + .long L_str_forwardingTargetForSelector + +.section __OBJC, __image_info + .long 0, 0 + +.section __TEXT, __text, regular, pure_instructions +_of_forward: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $20, %esp + + call get_eip +.L0: + movl 8(%ebp), %eax + movl %eax, (%esp) + call _object_getClass + + movl %eax, (%esp) + movl L_sel_forwardingTargetForSelector-.L0(%ebx), %eax + movl %eax, 4(%esp) + call _class_respondsToSelector + testl %eax, %eax + jz fail + + movl 8(%ebp), %eax + movl %eax, (%esp) + movl L_sel_forwardingTargetForSelector-.L0(%ebx), %eax + movl %eax, 4(%esp) + movl 12(%ebp), %eax + movl %eax, 8(%esp) + call _objc_msgSend + + testl %eax, %eax + jz fail + + cmpl 8(%ebp), %eax + je fail + + movl %eax, 8(%ebp) + + addl $20, %esp + popl %ebx + popl %ebp + + jmp _objc_msgSend + +fail: + addl $20, %esp + popl %ebx + popl %ebp + + jmp _of_method_not_found + +_of_forward_stret: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $20, %esp + + call get_eip +.L1: + movl 12(%ebp), %eax + movl %eax, (%esp) + call _object_getClass + + movl %eax, (%esp) + movl L_sel_forwardingTargetForSelector-.L1(%ebx), %eax + movl %eax, 4(%esp) + call _class_respondsToSelector + testl %eax, %eax + jz fail_stret + + movl 12(%ebp), %eax + movl %eax, (%esp) + movl L_sel_forwardingTargetForSelector-.L1(%ebx), %eax + movl %eax, 4(%esp) + movl 16(%ebp), %eax + movl %eax, 8(%esp) + call _objc_msgSend + + testl %eax, %eax + jz fail_stret + + cmpl 12(%ebp), %eax + je fail_stret + + movl %eax, 12(%ebp) + + addl $20, %esp + popl %ebx + popl %ebp + + jmp _objc_msgSend_stret + +fail_stret: + movl 12(%ebp), %eax + movl %eax, 8(%ebp) + movl 16(%ebp), %eax + movl %eax, 12(%ebp) + + addl $20, %esp + popl %ebx + popl %ebp + + jmp _of_method_not_found + +get_eip: + movl (%esp), %ebx + ret ADDED src/forwarding/apple-forwarding-ppc.S Index: src/forwarding/apple-forwarding-ppc.S ================================================================== --- src/forwarding/apple-forwarding-ppc.S +++ src/forwarding/apple-forwarding-ppc.S @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl _of_forward +.globl _of_forward_stret + +.section __TEXT, __cstring, cstring_literals +L_str_forwardingTargetForSelector: + .asciz "forwardingTargetForSelector:" + +.section __OBJC, __message_refs, literal_pointers, no_dead_strip +L_sel_forwardingTargetForSelector: + .long L_str_forwardingTargetForSelector + +.section __OBJC, __image_info + .long 0, 0 + +.section __TEXT, __text, regular, pure_instructions +_of_forward: + mflr r0 + stw r0, 8(r1) + stwu r1, -192(r1) + + /* + * Save all arguments and r13. + * + * We can dump two parameters in the parameter area as we know that + * space has been reserved for at least two parameters. + */ + stw r3, 216(r1) + stw r4, 220(r1) + stw r5, 56(r1) + stw r6, 60(r1) + stw r7, 64(r1) + stw r8, 68(r1) + stw r9, 72(r1) + stw r10, 76(r1) + stw r13, 80(r1) + + /* Save all floating point arguments */ + stfd f1, 88(r1) + stfd f2, 96(r1) + stfd f3, 104(r1) + stfd f4, 112(r1) + stfd f5, 120(r1) + stfd f6, 128(r1) + stfd f7, 136(r1) + stfd f8, 144(r1) + stfd f9, 152(r1) + stfd f10, 160(r1) + stfd f11, 168(r1) + stfd f12, 176(r1) + stfd f13, 184(r1) + + bl _object_getClass + + bl L0 +L0: + mflr r13 + addis r13, r13, ha16(L_sel_forwardingTargetForSelector-L0) + lwz r13, lo16(L_sel_forwardingTargetForSelector-L0)(r13) + mr r4, r13 + bl _class_respondsToSelector + cmpwi r3, 0 + beq- fail + + lwz r3, 216(r1) + mr r4, r13 + lwz r5, 220(r1) + bl _objc_msgSend + + cmpwi r3, 0 + beq- fail + + lwz r4, 216(r1) + cmpw r3, r4 + beq- fail + + /* Restore all arguments and r13, except r3 */ + lwz r4, 220(r1) + lwz r5, 56(r1) + lwz r6, 60(r1) + lwz r7, 64(r1) + lwz r8, 68(r1) + lwz r9, 72(r1) + lwz r10, 76(r1) + lwz r13, 80(r1) + + /* Restore all floating point arguments */ + lfd f1, 88(r1) + lfd f2, 96(r1) + lfd f3, 104(r1) + lfd f4, 112(r1) + lfd f5, 120(r1) + lfd f6, 128(r1) + lfd f7, 136(r1) + lfd f8, 144(r1) + lfd f9, 152(r1) + lfd f10, 160(r1) + lfd f11, 168(r1) + lfd f12, 176(r1) + lfd f13, 184(r1) + + addi r1, r1, 192 + lwz r0, 8(r1) + mtlr r0 + + b _objc_msgSend + +fail: + lwz r3, 216(r1) + lwz r4, 220(r1) + + addi r1, r1, 192 + lwz r0, 8(r1) + mtlr r0 + + b _of_method_not_found + +_of_forward_stret: + mflr r0 + stw r0, 8(r1) + stwu r1, -184(r1) + + /* + * Save all arguments and r13. + * + * We can dump three parameters in the parameter area as we know that + * space has been reserved for at least three parameters. + */ + stw r3, 208(r1) + stw r4, 212(r1) + stw r5, 216(r1) + stw r6, 56(r1) + stw r7, 60(r1) + stw r8, 64(r1) + stw r9, 68(r1) + stw r10, 72(r1) + stw r13, 76(r1) + + /* Save all floating point arguments */ + stfd f1, 80(r1) + stfd f2, 88(r1) + stfd f3, 96(r1) + stfd f4, 104(r1) + stfd f5, 112(r1) + stfd f6, 120(r1) + stfd f7, 128(r1) + stfd f8, 136(r1) + stfd f9, 144(r1) + stfd f10, 152(r1) + stfd f11, 160(r1) + stfd f12, 168(r1) + stfd f13, 176(r1) + + mr r3, r4 + bl _object_getClass + + bl L1 +L1: + mflr r13 + addis r13, r13, ha16(L_sel_forwardingTargetForSelector-L1) + lwz r13, lo16(L_sel_forwardingTargetForSelector-L1)(r13) + mr r4, r13 + bl _class_respondsToSelector + cmpwi r3, 0 + beq- fail_stret + + lwz r3, 212(r1) + mr r4, r13 + lwz r5, 216(r1) + bl _objc_msgSend + + cmpwi r3, 0 + beq- fail_stret + + lwz r4, 212(r1) + cmpw r3, r4 + beq- fail_stret + + mr r4, r3 + + /* Restore all arguments and r13, except r4 */ + lwz r3, 208(r1) + lwz r5, 216(r1) + lwz r6, 56(r1) + lwz r7, 60(r1) + lwz r8, 64(r1) + lwz r9, 68(r1) + lwz r10, 72(r1) + lwz r13, 76(r1) + + /* Restore all floating point arguments */ + lfd f1, 80(r1) + lfd f2, 88(r1) + lfd f3, 96(r1) + lfd f4, 104(r1) + lfd f5, 112(r1) + lfd f6, 120(r1) + lfd f7, 128(r1) + lfd f8, 136(r1) + lfd f9, 144(r1) + lfd f10, 152(r1) + lfd f11, 160(r1) + lfd f12, 168(r1) + lfd f13, 176(r1) + + addi r1, r1, 184 + lwz r0, 8(r1) + mtlr r0 + + b _objc_msgSend_stret + +fail_stret: + lwz r3, 212(r1) + lwz r4, 216(r1) + + addi r1, r1, 184 + lwz r0, 8(r1) + mtlr r0 + + b _of_method_not_found ADDED src/forwarding/apple-forwarding-x86_64.S Index: src/forwarding/apple-forwarding-x86_64.S ================================================================== --- src/forwarding/apple-forwarding-x86_64.S +++ src/forwarding/apple-forwarding-x86_64.S @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl _of_forward +.globl _of_forward_stret + +.section __TEXT, __objc_methname, cstring_literals +L_str_forwardingTargetForSelector: + .asciz "forwardingTargetForSelector:" + +.section __DATA, __objc_selrefs, literal_pointers, no_dead_strip +L_sel_forwardingTargetForSelector: + .quad L_str_forwardingTargetForSelector + +.section __DATA, __objc_imageinfo, regular, no_dead_strip + .long 0, 0 + +.section __TEXT, __text, regular, pure_instructions +_of_forward: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movdqa %xmm0, -0x50(%rbp) + movdqa %xmm1, -0x60(%rbp) + movdqa %xmm2, -0x70(%rbp) + movdqa %xmm3, -0x80(%rbp) + movdqa %xmm4, -0x90(%rbp) + movdqa %xmm5, -0xA0(%rbp) + movdqa %xmm6, -0xB0(%rbp) + movdqa %xmm7, -0xC0(%rbp) + + call _object_getClass + + movq %rax, %rdi + movq L_sel_forwardingTargetForSelector(%rip), %rsi + call _class_respondsToSelector + testq %rax, %rax + jz fail + + movq -0x10(%rbp), %rdi + movq L_sel_forwardingTargetForSelector(%rip), %rsi + movq -0x18(%rbp), %rdx + call _objc_msgSend + movq %rax, %rdi + + testq %rdi, %rdi + jz fail + + cmpq -0x10(%rbp), %rdi + je fail + + /* Restore all arguments, except %rdi */ + movdqa -0xC0(%rbp), %xmm7 + movdqa -0xB0(%rbp), %xmm6 + movdqa -0xA0(%rbp), %xmm5 + movdqa -0x90(%rbp), %xmm4 + movdqa -0x80(%rbp), %xmm3 + movdqa -0x70(%rbp), %xmm2 + movdqa -0x60(%rbp), %xmm1 + movdqa -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmp _objc_msgSend + +fail: + movq -0x10(%rbp), %rdi + movq -0x18(%rbp), %rsi + + movq %rbp, %rsp + popq %rbp + + jmp _of_method_not_found + +_of_forward_stret: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movdqa %xmm0, -0x50(%rbp) + movdqa %xmm1, -0x60(%rbp) + movdqa %xmm2, -0x70(%rbp) + movdqa %xmm3, -0x80(%rbp) + movdqa %xmm4, -0x90(%rbp) + movdqa %xmm5, -0xA0(%rbp) + movdqa %xmm6, -0xB0(%rbp) + movdqa %xmm7, -0xC0(%rbp) + + movq %rsi, %rdi + call _object_getClass + + movq %rax, %rdi + movq L_sel_forwardingTargetForSelector(%rip), %rsi + call _class_respondsToSelector + testq %rax, %rax + jz fail_stret + + movq -0x18(%rbp), %rdi + movq L_sel_forwardingTargetForSelector(%rip), %rsi + movq -0x20(%rbp), %rdx + call _objc_msgSend + movq %rax, %rsi + + testq %rsi, %rsi + jz fail_stret + + cmpq -0x18(%rbp), %rsi + je fail_stret + + /* Restore all arguments, except %rsi */ + movdqa -0xC0(%rbp), %xmm7 + movdqa -0xB0(%rbp), %xmm6 + movdqa -0xA0(%rbp), %xmm5 + movdqa -0x90(%rbp), %xmm4 + movdqa -0x80(%rbp), %xmm3 + movdqa -0x70(%rbp), %xmm2 + movdqa -0x60(%rbp), %xmm1 + movdqa -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmp _objc_msgSend_stret + +fail_stret: + movq -0x18(%rbp), %rdi + movq -0x20(%rbp), %rsi + + movq %rbp, %rsp + popq %rbp + + jmp _of_method_not_found ADDED src/forwarding/forwarding-amd64-elf.S Index: src/forwarding/forwarding-amd64-elf.S ================================================================== --- src/forwarding/forwarding-amd64-elf.S +++ src/forwarding/forwarding-amd64-elf.S @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl of_forward +.globl of_forward_stret + +.section .text +of_forward: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movdqa %xmm0, -0x50(%rbp) + movdqa %xmm1, -0x60(%rbp) + movdqa %xmm2, -0x70(%rbp) + movdqa %xmm3, -0x80(%rbp) + movdqa %xmm4, -0x90(%rbp) + movdqa %xmm5, -0xA0(%rbp) + movdqa %xmm6, -0xB0(%rbp) + movdqa %xmm7, -0xC0(%rbp) + + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call objc_msg_lookup@PLT + movq -0x10(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x18(%rbp), %rdx + call *%rax + movq %rax, -0x10(%rbp) + + movq %rax, %rdi + movq -0x18(%rbp), %rsi + call objc_msg_lookup@PLT + movq %rax, %r11 + + /* Restore all arguments */ + movdqa -0xC0(%rbp), %xmm7 + movdqa -0xB0(%rbp), %xmm6 + movdqa -0xA0(%rbp), %xmm5 + movdqa -0x90(%rbp), %xmm4 + movdqa -0x80(%rbp), %xmm3 + movdqa -0x70(%rbp), %xmm2 + movdqa -0x60(%rbp), %xmm1 + movdqa -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 +.type of_forward, %function +.size of_forward, .-of_forward + +of_forward_stret: + pushq %rbp + movq %rsp, %rbp + + /* Save all arguments */ + subq $0xC0, %rsp /* 16-byte alignment */ + movq %rax, -0x8(%rbp) + movq %rdi, -0x10(%rbp) + movq %rsi, -0x18(%rbp) + movq %rdx, -0x20(%rbp) + movq %rcx, -0x28(%rbp) + movq %r8, -0x30(%rbp) + movq %r9, -0x38(%rbp) + movdqa %xmm0, -0x50(%rbp) + movdqa %xmm1, -0x60(%rbp) + movdqa %xmm2, -0x70(%rbp) + movdqa %xmm3, -0x80(%rbp) + movdqa %xmm4, -0x90(%rbp) + movdqa %xmm5, -0xA0(%rbp) + movdqa %xmm6, -0xB0(%rbp) + movdqa %xmm7, -0xC0(%rbp) + + movq %rsi, %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + call objc_msg_lookup@PLT + movq -0x18(%rbp), %rdi + leaq sel_forwardingTargetForSelector_(%rip), %rsi + movq -0x20(%rbp), %rdx + call *%rax + movq %rax, -0x18(%rbp) + + movq %rax, %rdi + movq -0x20(%rbp), %rsi + call objc_msg_lookup_stret@PLT + movq %rax, %r11 + + /* Restore all arguments */ + movdqa -0xC0(%rbp), %xmm7 + movdqa -0xB0(%rbp), %xmm6 + movdqa -0xA0(%rbp), %xmm5 + movdqa -0x90(%rbp), %xmm4 + movdqa -0x80(%rbp), %xmm3 + movdqa -0x70(%rbp), %xmm2 + movdqa -0x60(%rbp), %xmm1 + movdqa -0x50(%rbp), %xmm0 + movq -0x38(%rbp), %r9 + movq -0x30(%rbp), %r8 + movq -0x28(%rbp), %rcx + movq -0x20(%rbp), %rdx + movq -0x18(%rbp), %rsi + movq -0x10(%rbp), %rdi + movq -0x8(%rbp), %rax + + movq %rbp, %rsp + popq %rbp + + jmpq *%r11 +.type of_forward_stret, %function +.size of_forward_stret, .-of_forward_stret + +init: + leaq module(%rip), %rdi + jmp __objc_exec_class@PLT + +.section .ctors, "a", %progbits + .quad init + +.section .rodata +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section .data +sel_forwardingTargetForSelector_: + .quad str_forwardingTargetForSelector_, 0 + .quad 0, 0 +symtab: + .quad 0, sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .quad 0 +module: + .quad 8, 32, 0, symtab + +#ifdef __linux__ +.section .note.GNU-stack, "", %progbits +#endif ADDED src/forwarding/forwarding-arm-elf.S Index: src/forwarding/forwarding-arm-elf.S ================================================================== --- src/forwarding/forwarding-arm-elf.S +++ src/forwarding/forwarding-arm-elf.S @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl of_forward +.globl of_forward_stret + +.section .text +of_forward: + stmfd sp!, {r0-r3, lr} + fstmfdd sp!, {d0-d7} + + ldr r1, sel_forwardingTargetForSelector__indirect_L0 +.L0: + add r1, pc + stmfd sp!, {r1} + bl objc_msg_lookup(PLT) + ldmfd sp!, {r1} + + mov r12, r0 + ldr r0, [sp, #64] + ldr r2, [sp, #68] + blx r12 + + str r0, [sp, #64] + ldr r1, [sp, #68] + bl objc_msg_lookup(PLT) + + mov r12, r0 + fldmfdd sp!, {d0-d7} + ldmfd sp!, {r0-r3, lr} + + bx r12 +.type of_forward, %function +.size of_forward, .-of_forward + +of_forward_stret: + stmfd sp!, {r0-r3, lr} + fstmfdd sp!, {d0-d7} + + mov r0, r1 + ldr r1, sel_forwardingTargetForSelector__indirect_L1 +.L1: + add r1, pc + stmfd sp!, {r1} + bl objc_msg_lookup(PLT) + ldmfd sp!, {r1} + + mov r12, r0 + ldr r0, [sp, #68] + ldr r2, [sp, #72] + blx r12 + + str r0, [sp, #68] + ldr r1, [sp, #72] + bl objc_msg_lookup_stret(PLT) + + mov r12, r0 + fldmfdd sp!, {d0-d7} + ldmfd sp!, {r0-r3, lr} + + bx r12 +.type of_forward_stret, %function +.size of_forward_stret, .-of_forward_stret + +init: + ldr r0, module_indirect_L2 +.L2: + add r0, pc + b __objc_exec_class(PLT) + +sel_forwardingTargetForSelector__indirect_L0: + .long sel_forwardingTargetForSelector_-(.L0+8) +sel_forwardingTargetForSelector__indirect_L1: + .long sel_forwardingTargetForSelector_-(.L1+8) +module_indirect_L2: + .long module-(.L2+8) + +.section .ctors, "a", %progbits + .long init + +.section .rodata +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section .data +sel_forwardingTargetForSelector_: + .long str_forwardingTargetForSelector_, 0 + .long 0, 0 +symtab: + .long 0, sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .long 0 +module: + .long 8, 16, 0, symtab + +#ifdef __linux__ +.section .note.GNU-stack, "", %progbits +#endif ADDED src/forwarding/forwarding-mips-elf.S Index: src/forwarding/forwarding-mips-elf.S ================================================================== --- src/forwarding/forwarding-mips-elf.S +++ src/forwarding/forwarding-mips-elf.S @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl of_forward +.globl of_forward_stret + +.section .text +of_forward: +#ifdef __PIC__ + lui $gp, %hi(_gp_disp) + addiu $gp, $gp, %lo(_gp_disp) + addu $gp, $gp, $t9 +#endif + + addiu $sp, $sp, -72 + + /* + * O32: The registers for floating point arguments don't need to be + * saved, as the ABI specifies that all remaining arguments are passed + * in integer registers if the first argument is passed in an integer + * register. This is always the case, as the first argument is always + * self. + */ + sw $gp, 0($sp) + sw $ra, 4($sp) + sw $a0, 8($sp) + sw $a1, 12($sp) + sw $a2, 16($sp) + sw $a3, 20($sp) +#ifdef __mips_eabi + /* For some reason, $a4-$a8 are not always defined */ + sw $8, 24($sp) + sw $9, 28($sp) + sw $10, 32($sp) + sw $11, 36($sp) + + swc1 $f12, 40($sp) + swc1 $f13, 44($sp) + swc1 $f14, 48($sp) + swc1 $f15, 52($sp) + swc1 $f16, 56($sp) + swc1 $f17, 60($sp) + swc1 $f18, 64($sp) + swc1 $f19, 68($sp) +#endif + +#ifdef __PIC__ + lw $a1, %got(sel_forwardingTargetForSelector_)($gp) +#else + lui $a1, %hi(sel_forwardingTargetForSelector_) +#endif + addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) +#ifdef __PIC__ + lw $t9, %call16(objc_msg_lookup)($gp) + jalr $t9 +#else + jal objc_msg_lookup +#endif + + lw $gp, 0($sp) + lw $a0, 8($sp) +#ifdef __PIC__ + lw $a1, %got(sel_forwardingTargetForSelector_)($gp) +#else + lui $a1, %hi(sel_forwardingTargetForSelector_) +#endif + addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) + lw $a2, 12($sp) +#ifdef __PIC__ + move $t9, $v0 + jalr $t9 +#else + jalr $v0 +#endif + sw $v0, 8($sp) + + lw $gp, 0($sp) + move $a0, $v0 + lw $a1, 12($sp) +#ifdef __PIC__ + lw $t9, %call16(objc_msg_lookup)($gp) + jalr $t9 +#else + jal objc_msg_lookup +#endif + +#ifdef __mips_eabi + lwc1 $f19, 68($sp) + lwc1 $f18, 64($sp) + lwc1 $f17, 60($sp) + lwc1 $f16, 56($sp) + lwc1 $f15, 52($sp) + lwc1 $f14, 48($sp) + lwc1 $f13, 44($sp) + lwc1 $f12, 40($sp) + + lw $11, 36($sp) + lw $10, 32($sp) + lw $9, 28($sp) + lw $8, 24($sp) +#endif + lw $a3, 20($sp) + lw $a2, 16($sp) + lw $a1, 12($sp) + lw $a0, 8($sp) + lw $ra, 4($sp) + + addiu $sp, $sp, 72 + +#ifdef __PIC__ + move $t9, $v0 + jr $t9 +#else + jr $v0 +#endif +.type of_forward, %function +.size of_forward, .-of_forward + +of_forward_stret: +#ifdef __PIC__ + lui $gp, %hi(_gp_disp) + addiu $gp, $gp, %lo(_gp_disp) + addu $gp, $gp, $t9 +#endif + + addiu $sp, $sp, -72 + + /* + * O32: The registers for floating point arguments don't need to be + * saved, as the ABI specifies that all remaining arguments are passed + * in integer registers if the first argument is passed in an integer + * register. This is always the case, as the first argument is always + * self. + */ + sw $gp, 0($sp) + sw $ra, 4($sp) + sw $a0, 8($sp) + sw $a1, 12($sp) + sw $a2, 16($sp) + sw $a3, 20($sp) +#ifdef __mips_eabi + /* For some reason, $a4-$a8 are not always defined */ + sw $8, 24($sp) + sw $9, 28($sp) + sw $10, 32($sp) + sw $11, 36($sp) + + swc1 $f12, 40($sp) + swc1 $f13, 44($sp) + swc1 $f14, 48($sp) + swc1 $f15, 52($sp) + swc1 $f16, 56($sp) + swc1 $f17, 60($sp) + swc1 $f18, 64($sp) + swc1 $f19, 68($sp) +#endif + + move $a0, $a1 +#ifdef __PIC__ + lw $a1, %got(sel_forwardingTargetForSelector_)($gp) +#else + lui $a1, %hi(sel_forwardingTargetForSelector_) +#endif + addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) +#ifdef __PIC__ + lw $t9, %call16(objc_msg_lookup)($gp) + jalr $t9 +#else + jal objc_msg_lookup +#endif + + lw $gp, 0($sp) + lw $a0, 12($sp) +#ifdef __PIC__ + lw $a1, %got(sel_forwardingTargetForSelector_)($gp) +#else + lui $a1, %hi(sel_forwardingTargetForSelector_) +#endif + addiu $a1, $a1, %lo(sel_forwardingTargetForSelector_) + lw $a2, 16($sp) +#ifdef __PIC__ + move $t9, $v0 + jalr $t9 +#else + jalr $v0 +#endif + sw $v0, 12($sp) + + lw $gp, 0($sp) + move $a0, $v0 + lw $a1, 16($sp) +#ifdef __PIC__ + lw $t9, %call16(objc_msg_lookup_stret)($gp) + jalr $t9 +#else + jal objc_msg_lookup_stret +#endif + +#ifdef __mips_eabi + lwc1 $f19, 68($sp) + lwc1 $f18, 64($sp) + lwc1 $f17, 60($sp) + lwc1 $f16, 56($sp) + lwc1 $f15, 52($sp) + lwc1 $f14, 48($sp) + lwc1 $f13, 44($sp) + lwc1 $f12, 40($sp) + + lw $11, 36($sp) + lw $10, 32($sp) + lw $9, 28($sp) + lw $8, 24($sp) +#endif + lw $a3, 20($sp) + lw $a2, 16($sp) + lw $a1, 12($sp) + lw $a0, 8($sp) + lw $ra, 4($sp) + + addiu $sp, $sp, 72 + +#ifdef __PIC__ + move $t9, $v0 + jr $t9 +#else + jr $v0 +#endif +.type of_forward_stret, %function +.size of_forward_stret, .-of_forward_stret + +init: +#ifdef __PIC__ + lui $gp, %hi(_gp_disp) + addiu $gp, $gp, %lo(_gp_disp) + addu $gp, $gp, $t9 + + lw $a0, %got(module)($gp) + addiu $a0, $a0, %lo(module) + lw $t9, %call16(__objc_exec_class)($gp) + jr $t9 +#else + lui $a0, %hi(module) + addiu $a0, $a0, %lo(module) + j __objc_exec_class +#endif + +.section .ctors, "a", %progbits + .long init + +.section .rodata +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section .data +sel_forwardingTargetForSelector_: + .long str_forwardingTargetForSelector_, 0 + .long 0, 0 +symtab: + .long 0, sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .long 0 +module: + .long 8, 16, 0, symtab + +#ifdef __linux__ +.section .note.GNU-stack, "", %progbits +#endif ADDED src/forwarding/forwarding-ppc-elf.S Index: src/forwarding/forwarding-ppc-elf.S ================================================================== --- src/forwarding/forwarding-ppc-elf.S +++ src/forwarding/forwarding-ppc-elf.S @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl of_forward +.globl of_forward_stret + +.section .text +of_forward: + stwu %r1, -112(%r1) + mflr %r0 + stw %r0, 116(%r1) + + /* Save all arguments */ + stw %r3, 8(%r1) + stw %r4, 12(%r1) + stw %r5, 16(%r1) + stw %r6, 20(%r1) + stw %r7, 24(%r1) + stw %r8, 28(%r1) + stw %r9, 32(%r1) + stw %r10, 36(%r1) + + /* Save all floating point arguments */ + stfd %f1, 40(%r1) + stfd %f2, 48(%r1) + stfd %f3, 56(%r1) + stfd %f4, 64(%r1) + stfd %f5, 72(%r1) + stfd %f6, 80(%r1) + stfd %f7, 88(%r1) + stfd %f8, 96(%r1) + + lis %r4, sel_forwardingTargetForSelector_@ha + la %r4, sel_forwardingTargetForSelector_@l(%r4) + bl objc_msg_lookup@plt + mtctr %r3 + + lwz %r3, 8(%r1) + lis %r4, sel_forwardingTargetForSelector_@ha + la %r4, sel_forwardingTargetForSelector_@l(%r4) + lwz %r5, 12(%r1) + bctrl + stw %r3, 8(%r1) + + lwz %r4, 12(%r1) + bl objc_msg_lookup@plt + mtctr %r3 + + /* Restore all arguments */ + lwz %r3, 8(%r1) + lwz %r4, 12(%r1) + lwz %r5, 16(%r1) + lwz %r6, 20(%r1) + lwz %r7, 24(%r1) + lwz %r8, 28(%r1) + lwz %r9, 32(%r1) + lwz %r10, 36(%r1) + + /* Restore all floating point arguments */ + lfd %f1, 40(%r1) + lfd %f2, 48(%r1) + lfd %f3, 56(%r1) + lfd %f4, 64(%r1) + lfd %f5, 72(%r1) + lfd %f6, 80(%r1) + lfd %f7, 88(%r1) + lfd %f8, 96(%r1) + + lwz %r0, 116(%r1) + mtlr %r0 + addi %r1, %r1, 112 + bctr +.type of_forward, %function +.size of_forward, .-of_forward + +of_forward_stret: + stwu %r1, -112(%r1) + mflr %r0 + stw %r0, 116(%r1) + + /* Save all arguments */ + stw %r3, 8(%r1) + stw %r4, 12(%r1) + stw %r5, 16(%r1) + stw %r6, 20(%r1) + stw %r7, 24(%r1) + stw %r8, 28(%r1) + stw %r9, 32(%r1) + stw %r10, 36(%r1) + + /* Save all floating point arguments */ + stfd %f1, 40(%r1) + stfd %f2, 48(%r1) + stfd %f3, 56(%r1) + stfd %f4, 64(%r1) + stfd %f5, 72(%r1) + stfd %f6, 80(%r1) + stfd %f7, 88(%r1) + stfd %f8, 96(%r1) + + mr %r3, %r4 + lis %r4, sel_forwardingTargetForSelector_@ha + la %r4, sel_forwardingTargetForSelector_@l(%r4) + bl objc_msg_lookup@plt + mtctr %r3 + + lwz %r3, 12(%r1) + lis %r4, sel_forwardingTargetForSelector_@ha + la %r4, sel_forwardingTargetForSelector_@l(%r4) + lwz %r5, 16(%r1) + bctrl + stw %r3, 12(%r1) + + lwz %r4, 16(%r1) + bl objc_msg_lookup_stret@plt + mtctr %r3 + + /* Restore all arguments */ + lwz %r3, 8(%r1) + lwz %r4, 12(%r1) + lwz %r5, 16(%r1) + lwz %r6, 20(%r1) + lwz %r7, 24(%r1) + lwz %r8, 28(%r1) + lwz %r9, 32(%r1) + lwz %r10, 36(%r1) + + /* Restore all floating point arguments */ + lfd %f1, 40(%r1) + lfd %f2, 48(%r1) + lfd %f3, 56(%r1) + lfd %f4, 64(%r1) + lfd %f5, 72(%r1) + lfd %f6, 80(%r1) + lfd %f7, 88(%r1) + lfd %f8, 96(%r1) + + lwz %r0, 116(%r1) + mtlr %r0 + addi %r1, %r1, 112 + bctr +.type of_forward_stret, %function +.size of_forward_stret, .-of_forward_stret + +init: + lis %r3, module@ha + la %r3, module@l(%r3) + b __objc_exec_class@plt + +.section .ctors, "a", %progbits + .long init + +.section .rodata +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section .data +sel_forwardingTargetForSelector_: + .long str_forwardingTargetForSelector_, 0 + .long 0, 0 +symtab: + .long 0, sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .long 0 +module: + .long 8, 16, 0, symtab + +#ifdef __linux__ +.section .note.GNU-stack, "", %progbits +#endif ADDED src/forwarding/forwarding-x86-elf.S Index: src/forwarding/forwarding-x86-elf.S ================================================================== --- src/forwarding/forwarding-x86-elf.S +++ src/forwarding/forwarding-x86-elf.S @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +.globl of_forward +.globl of_forward_stret + +.section .text +of_forward: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $20, %esp + + call get_eip +.L0: + movl 8(%ebp), %eax + movl %eax, (%esp) + leal sel_forwardingTargetForSelector_-.L0(%ebx), %eax + movl %eax, 4(%esp) + leal objc_msg_lookup-.L0(%ebx), %eax + call *%eax + + movl 8(%ebp), %edx + movl %edx, (%esp) + leal sel_forwardingTargetForSelector_-.L0(%ebx), %edx + movl %edx, 4(%esp) + movl 12(%ebp), %edx + movl %edx, 8(%esp) + call *%eax + + movl %eax, 8(%ebp) + movl %eax, (%esp) + movl 12(%ebp), %eax + movl %eax, 4(%esp) + leal objc_msg_lookup-.L0(%ebx), %eax + call *%eax + + addl $20, %esp + popl %ebx + popl %ebp + + jmp *%eax +.type of_forward, %function +.size of_forward, .-of_forward + +of_forward_stret: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $20, %esp + + call get_eip +.L1: + movl 12(%ebp), %eax + movl %eax, (%esp) + leal sel_forwardingTargetForSelector_-.L1(%ebx), %eax + movl %eax, 4(%esp) + leal objc_msg_lookup-.L1(%ebx), %eax + call *%eax + + movl 12(%ebp), %edx + movl %edx, (%esp) + leal sel_forwardingTargetForSelector_-.L1(%ebx), %edx + movl %edx, 4(%esp) + movl 16(%ebp), %edx + movl %edx, 8(%esp) + call *%eax + + movl %eax, 12(%ebp) + movl %eax, (%esp) + movl 16(%ebp), %eax + movl %eax, 4(%esp) + leal objc_msg_lookup_stret-.L1(%ebx), %eax + call *%eax + + addl $20, %esp + popl %ebx + popl %ebp + + jmp *%eax +.type of_forward_stret, %function +.size of_forward_stret, .-of_forward_stret + +init: + pushl %ebp + movl %esp, %ebp + + pushl %ebx + subl $4, %esp + + call get_eip +.L2: + leal module-.L2(%ebx), %eax + movl %eax, (%esp) + leal __objc_exec_class-.L2(%ebx), %eax + call *%eax + + addl $4, %esp + popl %ebx + popl %ebp + ret + +get_eip: + movl (%esp), %ebx + ret + +.section .ctors, "a", %progbits + .long init + +.section .rodata +str_forwardingTargetForSelector_: + .asciz "forwardingTargetForSelector:" + +.section .data +sel_forwardingTargetForSelector_: + .long str_forwardingTargetForSelector_, 0 + .long 0, 0 +symtab: + .long 0, sel_forwardingTargetForSelector_ + .short 0, 0 + .long 0 + .long 0 +module: + .long 8, 16, 0, symtab + +#ifdef __linux__ +.section .note.GNU-stack, "", %progbits +#endif ADDED src/forwarding/forwarding.S Index: src/forwarding/forwarding.S ================================================================== --- src/forwarding/forwarding.S +++ src/forwarding/forwarding.S @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 + * Jonathan Schleifer + * + * All rights reserved. + * + * This file is part of ObjFW. It may be distributed under the terms of the + * Q Public License 1.0, which can be found in the file LICENSE.QPL included in + * the packaging of this file. + * + * Alternatively, it may be distributed under the terms of the GNU General + * Public License, either version 2 or 3, which can be found in the file + * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this + * file. + */ + +#include "config.h" + +#ifdef OF_APPLE_RUNTIME +# if defined(__x86_64__) +# include "apple-forwarding-x86_64.S" +# elif defined(__i386__) +# include "apple-forwarding-i386.S" +# elif defined(__arm__) +# include "apple-forwarding-arm.S" +# elif defined(__ppc__) +# include "apple-forwarding-ppc.S" +# endif +#else +# ifdef __ELF__ +# if defined(__amd64__) || defined(__x86_64__) +# include "forwarding-amd64-elf.S" +# elif defined(__i386__) +# include "forwarding-x86-elf.S" +# elif defined(__arm__) || defined(__ARM__) +# include "forwarding-arm-elf.S" +# elif defined(__ppc__) || defined(__PPC__) +# include "forwarding-ppc-elf.S" +# elif (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32) || \ + (defined(__mips_eabi) && _MIPS_SZPTR == 32) +# include "forwarding-mips-elf.S" +# endif +# endif +#endif