├── .gitignore ├── AOP ├── NSObject+ZDAOP.h ├── NSObject+ZDAOP.m ├── ZDAOP.h ├── ZDAOP.m └── ZDBlockDefine.h ├── LICENSE ├── Podfile ├── Podfile.lock ├── Pods ├── Aspects │ ├── Aspects.h │ ├── Aspects.m │ ├── LICENSE │ └── README.md ├── Headers │ ├── Private │ │ ├── Aspects │ │ │ └── Aspects.h │ │ └── ZDLibffi │ │ │ ├── asmnames.h │ │ │ ├── ffi.h │ │ │ ├── ffi_arm64.h │ │ │ ├── ffi_armv7.h │ │ │ ├── ffi_armv7k.h │ │ │ ├── ffi_cfi.h │ │ │ ├── ffi_common.h │ │ │ ├── ffi_i386.h │ │ │ ├── ffi_x86_64.h │ │ │ ├── fficonfig.h │ │ │ ├── fficonfig_arm64.h │ │ │ ├── fficonfig_armv7.h │ │ │ ├── fficonfig_armv7k.h │ │ │ ├── fficonfig_i386.h │ │ │ ├── fficonfig_x86_64.h │ │ │ ├── ffitarget.h │ │ │ ├── ffitarget_arm64.h │ │ │ ├── ffitarget_armv7.h │ │ │ ├── ffitarget_armv7k.h │ │ │ ├── ffitarget_i386.h │ │ │ ├── ffitarget_x86_64.h │ │ │ ├── internal64.h │ │ │ ├── internal_arm.h │ │ │ ├── internal_arm64.h │ │ │ ├── internal_i386.h │ │ │ └── tramp.h │ └── Public │ │ ├── Aspects │ │ └── Aspects.h │ │ └── ZDLibffi │ │ ├── ZDLibffi-umbrella.h │ │ ├── ZDLibffi.modulemap │ │ ├── ffi.h │ │ ├── ffi_arm64.h │ │ ├── ffi_armv7.h │ │ ├── ffi_armv7k.h │ │ ├── ffi_cfi.h │ │ ├── ffi_common.h │ │ ├── ffi_i386.h │ │ ├── ffi_x86_64.h │ │ ├── fficonfig.h │ │ ├── fficonfig_arm64.h │ │ ├── fficonfig_armv7.h │ │ ├── fficonfig_armv7k.h │ │ ├── fficonfig_i386.h │ │ ├── fficonfig_x86_64.h │ │ ├── ffitarget.h │ │ ├── ffitarget_arm64.h │ │ ├── ffitarget_armv7.h │ │ ├── ffitarget_armv7k.h │ │ ├── ffitarget_i386.h │ │ ├── ffitarget_x86_64.h │ │ └── tramp.h ├── Manifest.lock ├── Pods.xcodeproj │ └── project.pbxproj ├── Target Support Files │ ├── Aspects │ │ ├── Aspects-dummy.m │ │ ├── Aspects-prefix.pch │ │ ├── Aspects.debug.xcconfig │ │ ├── Aspects.release.xcconfig │ │ └── Aspects.xcconfig │ ├── Pods-ZDLibffiDemo-ZDLibffiDemoUITests │ │ ├── Pods-ZDLibffiDemo-ZDLibffiDemoUITests-acknowledgements.markdown │ │ ├── Pods-ZDLibffiDemo-ZDLibffiDemoUITests-acknowledgements.plist │ │ ├── Pods-ZDLibffiDemo-ZDLibffiDemoUITests-dummy.m │ │ ├── Pods-ZDLibffiDemo-ZDLibffiDemoUITests.debug.xcconfig │ │ └── Pods-ZDLibffiDemo-ZDLibffiDemoUITests.release.xcconfig │ ├── Pods-ZDLibffiDemo │ │ ├── Pods-ZDLibffiDemo-acknowledgements.markdown │ │ ├── Pods-ZDLibffiDemo-acknowledgements.plist │ │ ├── Pods-ZDLibffiDemo-dummy.m │ │ ├── Pods-ZDLibffiDemo.debug.xcconfig │ │ └── Pods-ZDLibffiDemo.release.xcconfig │ ├── Pods-ZDLibffiDemoTests │ │ ├── Pods-ZDLibffiDemoTests-acknowledgements.markdown │ │ ├── Pods-ZDLibffiDemoTests-acknowledgements.plist │ │ ├── Pods-ZDLibffiDemoTests-dummy.m │ │ ├── Pods-ZDLibffiDemoTests.debug.xcconfig │ │ └── Pods-ZDLibffiDemoTests.release.xcconfig │ └── ZDLibffi │ │ ├── ZDLibffi-dummy.m │ │ ├── ZDLibffi-umbrella.h │ │ ├── ZDLibffi.debug.xcconfig │ │ ├── ZDLibffi.modulemap │ │ └── ZDLibffi.release.xcconfig └── ZDLibffi │ ├── LICENSE │ ├── README.md │ └── Source │ ├── include │ ├── ffi.h │ ├── ffi_arm64.h │ ├── ffi_armv7.h │ ├── ffi_armv7k.h │ ├── ffi_cfi.h │ ├── ffi_common.h │ ├── ffi_i386.h │ ├── ffi_x86_64.h │ ├── fficonfig.h │ ├── fficonfig_arm64.h │ ├── fficonfig_armv7.h │ ├── fficonfig_armv7k.h │ ├── fficonfig_i386.h │ ├── fficonfig_x86_64.h │ ├── ffitarget.h │ ├── ffitarget_arm64.h │ ├── ffitarget_armv7.h │ ├── ffitarget_armv7k.h │ ├── ffitarget_i386.h │ ├── ffitarget_x86_64.h │ └── tramp.h │ └── src │ ├── aarch64 │ ├── ffi_arm64.c │ ├── internal_arm64.h │ └── sysv_arm64.S │ ├── arm │ ├── ffi_armv7.c │ ├── internal_arm.h │ └── sysv_armv7.S │ ├── common │ ├── closures.c │ ├── debug.c │ ├── dlmalloc.c │ ├── ffi_common.h │ ├── java_raw_api.c │ ├── prep_cif.c │ ├── raw_api.c │ ├── tramp.c │ └── types.c │ └── x86 │ ├── asmnames.h │ ├── ffi64_x86_64.c │ ├── ffi_i386.c │ ├── ffiw64_x86_64.c │ ├── internal64.h │ ├── internal_i386.h │ ├── sysv_i386.S │ ├── unix64_x86_64.S │ └── win64_x86_64.S ├── README.md ├── ZDLibffiDemo.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── ZDLibffiDemo.xcworkspace └── contents.xcworkspacedata ├── ZDLibffiDemo ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SceneDelegate.h ├── SceneDelegate.m ├── ViewController.h ├── ViewController.m ├── ZDLibffiController.h ├── ZDLibffiController.m └── main.m ├── ZDLibffiDemoTests ├── Info.plist ├── ZDLibffiDemoTests.m ├── ZDLibffiVSAspectTests.m └── ZDPerformanceTests.m ├── ZDLibffiDemoUITests ├── Info.plist └── ZDLibffiDemoUITests.m └── libffi浅析.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | # CocoaPods 34 | # 35 | # We recommend against adding the Pods directory to your .gitignore. However 36 | # you should judge for yourself, the pros and cons are mentioned at: 37 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 38 | # 39 | # Pods/ 40 | # 41 | # Add this line if you want to avoid checking in source code from the Xcode workspace 42 | # *.xcworkspace 43 | 44 | # Carthage 45 | # 46 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 47 | # Carthage/Checkouts 48 | 49 | Carthage/Build/ 50 | 51 | # fastlane 52 | # 53 | # It is recommended to not store the screenshots in the git repo. 54 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 55 | # For more information about the recommended setup visit: 56 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 57 | 58 | fastlane/report.xml 59 | fastlane/Preview.html 60 | fastlane/screenshots/**/*.png 61 | fastlane/test_output 62 | 63 | # Code Injection 64 | # 65 | # After new code Injection tools there's a generated folder /iOSInjectionProject 66 | # https://github.com/johnno1962/injectionforxcode 67 | 68 | iOSInjectionProject/ 69 | -------------------------------------------------------------------------------- /AOP/NSObject+ZDAOP.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+ZDAOP.h 3 | // ZDHookDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/9. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | // 这只是一个demo,完整的hook repo请移驾: 9 | // https://github.com/faimin/ZDFfiHook 10 | 11 | #import 12 | #import "ZDAOP.h" 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | @interface NSObject (ZDAOP) 17 | 18 | + (void)zd_hookInstanceMethod:(SEL)selector option:(ZDHookOption)option callback:(id)callback; 19 | 20 | + (void)zd_hookClassMethod:(SEL)selector option:(ZDHookOption)option callback:(id)callback; 21 | 22 | @end 23 | 24 | NS_ASSUME_NONNULL_END 25 | -------------------------------------------------------------------------------- /AOP/NSObject+ZDAOP.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+ZDAOP.m 3 | // ZDHookDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/9. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import "NSObject+ZDAOP.h" 10 | #import 11 | #import "ZDAOP.h" 12 | 13 | //***************************************************************** 14 | 15 | @implementation NSObject (ZDAOP) 16 | 17 | + (void)zd_hookInstanceMethod:(SEL)selector option:(ZDHookOption)option callback:(id)callback { 18 | Method method = class_getInstanceMethod(self, selector); 19 | ZD_CoreHookFunc(self, method, option, callback); 20 | } 21 | 22 | + (void)zd_hookClassMethod:(SEL)selector option:(ZDHookOption)option callback:(id)callback { 23 | Class realClass = object_getClass(self); 24 | Method method = class_getClassMethod(realClass, selector); 25 | ZD_CoreHookFunc(realClass, method, option, callback); 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /AOP/ZDAOP.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZDAOP.h 3 | // ZDHookDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/9. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "ZDBlockDefine.h" 12 | @import ZDLibffi; 13 | 14 | NS_ASSUME_NONNULL_BEGIN 15 | 16 | // Libffi文档: http://www.chiark.greenend.org.uk/doc/libffi-dev/html/Index.html#Index 17 | 18 | //******************************************************* 19 | 20 | typedef NS_ENUM(NSInteger, ZDHookMethodType) { 21 | ZDHookMethodType_None = 0, 22 | ZDHookMethodType_Instance = 1, // 类的实例方法 23 | ZDHookMethodType_Class = 2, // 类方法 24 | ZDHookMethodType_SingleInstance = 3, // 单个实例 25 | }; 26 | 27 | typedef NS_ENUM(NSInteger, ZDHookOption) { 28 | ZDHookOption_None = 0, 29 | ZDHookOption_Befor = 1, 30 | ZDHookOption_Instead = 2, 31 | ZDHookOption_After = 3, 32 | }; 33 | 34 | //******************************************************* 35 | 36 | @interface ZDFfiHookInfo : NSObject { 37 | @public 38 | ffi_cif *_cif; 39 | ffi_type **_argTypes; 40 | ffi_closure *_closure; 41 | 42 | void *_originalIMP; 43 | void *_newIMP; 44 | } 45 | @property (nonatomic) Method method; 46 | @property (nonatomic, strong) NSMethodSignature *signature; 47 | @property (nonatomic, copy) NSString *typeEncoding; 48 | @property (nonatomic, weak) id obj; 49 | @property (nonatomic, assign) BOOL isBlock; 50 | @property (nonatomic, assign) ZDHookOption hookOption; 51 | @property (nonatomic, strong) id callback; 52 | 53 | @property (nonatomic, strong, nullable) ZDFfiHookInfo *callbackInfo; 54 | 55 | + (instancetype)infoWithObject:(id)obj method:(Method _Nullable)method option:(ZDHookOption)option callback:(id _Nullable)callback; 56 | 57 | @end 58 | 59 | //************************************************* 60 | 61 | #pragma mark - Function 62 | #pragma mark - 63 | 64 | FOUNDATION_EXPORT void ZD_CoreHookFunc(id obj, Method method, ZDHookOption option, id callback); 65 | 66 | /// 获取block方法签名 67 | FOUNDATION_EXPORT const char *_Nullable ZD_BlockSignatureTypes(id block); 68 | /// 获取block的函数指针 69 | FOUNDATION_EXPORT ZDBlockIMP _Nullable ZD_BlockInvokeIMP(id block); 70 | /// 消息转发专用的IMP 71 | FOUNDATION_EXPORT IMP ZD_MsgForwardIMP(void); 72 | /// 简化block的方法签名 73 | FOUNDATION_EXPORT NSString *ZD_ReduceBlockSignatureCodingType(const char *signatureCodingType); 74 | FOUNDATION_EXPORT ffi_type *_Nullable ZD_ffiTypeWithTypeEncoding(const char *type); 75 | FOUNDATION_EXPORT id _Nullable ZD_ArgumentAtIndex(NSMethodSignature *methodSignature, void *_Nullable* _Nullable args, NSUInteger index); 76 | 77 | NS_ASSUME_NONNULL_END 78 | -------------------------------------------------------------------------------- /AOP/ZDBlockDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZDBlockDefine.h 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #ifndef ZDBlockDefine_h 10 | #define ZDBlockDefine_h 11 | 12 | #pragma mark - Block Define 13 | #pragma mark - 14 | 15 | // http://clang.llvm.org/docs/Block-ABI-Apple.html#high-level 16 | // https://opensource.apple.com/source/libclosure/libclosure-67/Block_private.h.auto.html 17 | // Values for Block_layout->flags to describe block objects 18 | typedef NS_OPTIONS(NSUInteger, ZDBlockDescriptionFlags) { 19 | BLOCK_DEALLOCATING = (0x0001), // runtime 20 | BLOCK_REFCOUNT_MASK = (0xfffe), // runtime 21 | BLOCK_NEEDS_FREE = (1 << 24), // runtime 22 | BLOCK_HAS_COPY_DISPOSE = (1 << 25), // compiler 23 | BLOCK_HAS_CTOR = (1 << 26), // compiler: helpers have C++ code 24 | BLOCK_IS_GC = (1 << 27), // runtime 25 | BLOCK_IS_GLOBAL = (1 << 28), // compiler 26 | BLOCK_USE_STRET = (1 << 29), // compiler: undefined if !BLOCK_HAS_SIGNATURE 27 | BLOCK_HAS_SIGNATURE = (1 << 30), // compiler 28 | BLOCK_HAS_EXTENDED_LAYOUT=(1 << 31) // compiler 29 | }; 30 | 31 | // revised new layout 32 | 33 | #define BLOCK_DESCRIPTOR_1 1 34 | struct ZDBlock_descriptor_1 { 35 | uintptr_t reserved; 36 | uintptr_t size; 37 | }; 38 | 39 | #define BLOCK_DESCRIPTOR_2 1 40 | struct ZDBlock_descriptor_2 { 41 | // requires BLOCK_HAS_COPY_DISPOSE 42 | void (*copy)(void *dst, const void *src); 43 | void (*dispose)(const void *); 44 | }; 45 | 46 | #define BLOCK_DESCRIPTOR_3 1 47 | struct ZDBlock_descriptor_3 { 48 | // requires BLOCK_HAS_SIGNATURE 49 | const char *signature; 50 | const char *layout; // contents depend on BLOCK_HAS_EXTENDED_LAYOUT 51 | }; 52 | 53 | struct ZDBlock_layout { 54 | void *isa; // initialized to &_NSConcreteStackBlock or &_NSConcreteGlobalBlock 55 | volatile int flags; // contains ref count 56 | int reserved; 57 | void (*invoke)(void *, ...); 58 | struct Block_descriptor_1 *descriptor; 59 | // imported variables 60 | }; 61 | 62 | //******************************************************* 63 | 64 | typedef struct ZDBlock_layout ZDBlock; 65 | typedef void * ZDBlockIMP; 66 | 67 | #endif /* ZDBlockDefine_h */ 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Zero.D.Saber 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '9.0' 3 | 4 | target 'ZDLibffiDemo' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | # use_frameworks! 7 | 8 | # Pods for ZDLibffiDemo 9 | pod 'ZDLibffi' 10 | pod 'Aspects' 11 | #pod 'ReactiveObjC' 12 | 13 | target 'ZDLibffiDemoTests' do 14 | inherit! :search_paths 15 | # Pods for testing 16 | end 17 | 18 | target 'ZDLibffiDemoUITests' do 19 | # Pods for testing 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Aspects (1.4.1) 3 | - ZDLibffi (0.0.3) 4 | 5 | DEPENDENCIES: 6 | - Aspects 7 | - ZDLibffi 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - Aspects 12 | - ZDLibffi 13 | 14 | SPEC CHECKSUMS: 15 | Aspects: 7595ba96a6727a58ebcbfc954497fc5d2fdde546 16 | ZDLibffi: 6d5bebe675e0856c3703a501c3c83897c67c1ffc 17 | 18 | PODFILE CHECKSUM: d9257fd1cbf24d784245f57c1cf17c75a51f7504 19 | 20 | COCOAPODS: 1.11.2 21 | -------------------------------------------------------------------------------- /Pods/Aspects/Aspects.h: -------------------------------------------------------------------------------- 1 | // 2 | // Aspects.h 3 | // Aspects - A delightful, simple library for aspect oriented programming. 4 | // 5 | // Copyright (c) 2014 Peter Steinberger. Licensed under the MIT license. 6 | // 7 | 8 | #import 9 | 10 | typedef NS_OPTIONS(NSUInteger, AspectOptions) { 11 | AspectPositionAfter = 0, /// Called after the original implementation (default) 12 | AspectPositionInstead = 1, /// Will replace the original implementation. 13 | AspectPositionBefore = 2, /// Called before the original implementation. 14 | 15 | AspectOptionAutomaticRemoval = 1 << 3 /// Will remove the hook after the first execution. 16 | }; 17 | 18 | /// Opaque Aspect Token that allows to deregister the hook. 19 | @protocol AspectToken 20 | 21 | /// Deregisters an aspect. 22 | /// @return YES if deregistration is successful, otherwise NO. 23 | - (BOOL)remove; 24 | 25 | @end 26 | 27 | /// The AspectInfo protocol is the first parameter of our block syntax. 28 | @protocol AspectInfo 29 | 30 | /// The instance that is currently hooked. 31 | - (id)instance; 32 | 33 | /// The original invocation of the hooked method. 34 | - (NSInvocation *)originalInvocation; 35 | 36 | /// All method arguments, boxed. This is lazily evaluated. 37 | - (NSArray *)arguments; 38 | 39 | @end 40 | 41 | /** 42 | Aspects uses Objective-C message forwarding to hook into messages. This will create some overhead. Don't add aspects to methods that are called a lot. Aspects is meant for view/controller code that is not called a 1000 times per second. 43 | 44 | Adding aspects returns an opaque token which can be used to deregister again. All calls are thread safe. 45 | */ 46 | @interface NSObject (Aspects) 47 | 48 | /// Adds a block of code before/instead/after the current `selector` for a specific class. 49 | /// 50 | /// @param block Aspects replicates the type signature of the method being hooked. 51 | /// The first parameter will be `id`, followed by all parameters of the method. 52 | /// These parameters are optional and will be filled to match the block signature. 53 | /// You can even use an empty block, or one that simple gets `id`. 54 | /// 55 | /// @note Hooking static methods is not supported. 56 | /// @return A token which allows to later deregister the aspect. 57 | + (id)aspect_hookSelector:(SEL)selector 58 | withOptions:(AspectOptions)options 59 | usingBlock:(id)block 60 | error:(NSError **)error; 61 | 62 | /// Adds a block of code before/instead/after the current `selector` for a specific instance. 63 | - (id)aspect_hookSelector:(SEL)selector 64 | withOptions:(AspectOptions)options 65 | usingBlock:(id)block 66 | error:(NSError **)error; 67 | 68 | @end 69 | 70 | 71 | typedef NS_ENUM(NSUInteger, AspectErrorCode) { 72 | AspectErrorSelectorBlacklisted, /// Selectors like release, retain, autorelease are blacklisted. 73 | AspectErrorDoesNotRespondToSelector, /// Selector could not be found. 74 | AspectErrorSelectorDeallocPosition, /// When hooking dealloc, only AspectPositionBefore is allowed. 75 | AspectErrorSelectorAlreadyHookedInClassHierarchy, /// Statically hooking the same method in subclasses is not allowed. 76 | AspectErrorFailedToAllocateClassPair, /// The runtime failed creating a class pair. 77 | AspectErrorMissingBlockSignature, /// The block misses compile time signature info and can't be called. 78 | AspectErrorIncompatibleBlockSignature, /// The block signature does not match the method or is too large. 79 | 80 | AspectErrorRemoveObjectAlreadyDeallocated = 100 /// (for removing) The object hooked is already deallocated. 81 | }; 82 | 83 | extern NSString *const AspectErrorDomain; 84 | -------------------------------------------------------------------------------- /Pods/Aspects/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Peter Steinberger, steipete@gmail.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Pods/Headers/Private/Aspects/Aspects.h: -------------------------------------------------------------------------------- 1 | ../../../Aspects/Aspects.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/asmnames.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/src/x86/asmnames.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi_armv7.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_armv7.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi_armv7k.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_armv7k.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi_cfi.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_cfi.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi_common.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/src/common/ffi_common.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi_i386.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffi_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/fficonfig.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/fficonfig_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/fficonfig_armv7.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_armv7.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/fficonfig_armv7k.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_armv7k.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/fficonfig_i386.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/fficonfig_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffitarget.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffitarget_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffitarget_armv7.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_armv7.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffitarget_armv7k.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_armv7k.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffitarget_i386.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/ffitarget_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/internal64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/src/x86/internal64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/internal_arm.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/src/arm/internal_arm.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/internal_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/src/aarch64/internal_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/internal_i386.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/src/x86/internal_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Private/ZDLibffi/tramp.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/tramp.h -------------------------------------------------------------------------------- /Pods/Headers/Public/Aspects/Aspects.h: -------------------------------------------------------------------------------- 1 | ../../../Aspects/Aspects.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ZDLibffi-umbrella.h: -------------------------------------------------------------------------------- 1 | ../../../Target Support Files/ZDLibffi/ZDLibffi-umbrella.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ZDLibffi.modulemap: -------------------------------------------------------------------------------- 1 | ../../../Target Support Files/ZDLibffi/ZDLibffi.modulemap -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi_armv7.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_armv7.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi_armv7k.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_armv7k.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi_cfi.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_cfi.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi_common.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_common.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi_i386.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffi_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffi_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/fficonfig.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/fficonfig_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/fficonfig_armv7.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_armv7.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/fficonfig_armv7k.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_armv7k.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/fficonfig_i386.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/fficonfig_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/fficonfig_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffitarget.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffitarget_arm64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_arm64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffitarget_armv7.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_armv7.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffitarget_armv7k.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_armv7k.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffitarget_i386.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_i386.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/ffitarget_x86_64.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/ffitarget_x86_64.h -------------------------------------------------------------------------------- /Pods/Headers/Public/ZDLibffi/tramp.h: -------------------------------------------------------------------------------- 1 | ../../../ZDLibffi/Source/include/tramp.h -------------------------------------------------------------------------------- /Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Aspects (1.4.1) 3 | - ZDLibffi (0.0.3) 4 | 5 | DEPENDENCIES: 6 | - Aspects 7 | - ZDLibffi 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - Aspects 12 | - ZDLibffi 13 | 14 | SPEC CHECKSUMS: 15 | Aspects: 7595ba96a6727a58ebcbfc954497fc5d2fdde546 16 | ZDLibffi: 6d5bebe675e0856c3703a501c3c83897c67c1ffc 17 | 18 | PODFILE CHECKSUM: d9257fd1cbf24d784245f57c1cf17c75a51f7504 19 | 20 | COCOAPODS: 1.11.2 21 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Aspects/Aspects-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Aspects : NSObject 3 | @end 4 | @implementation PodsDummy_Aspects 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Aspects/Aspects-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Aspects/Aspects.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Aspects 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Aspects" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Aspects 9 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Aspects/Aspects.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Aspects 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Aspects" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Aspects 9 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 13 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Aspects/Aspects.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Aspects 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/Aspects" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Aspects 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo-ZDLibffiDemoUITests/Pods-ZDLibffiDemo-ZDLibffiDemoUITests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Aspects 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2014 Peter Steinberger, steipete@gmail.com 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | ## ZDLibffi 29 | 30 | Copyright (c) 2020 faimin 31 | 32 | Permission is hereby granted, free of charge, to any person obtaining a copy 33 | of this software and associated documentation files (the "Software"), to deal 34 | in the Software without restriction, including without limitation the rights 35 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 36 | copies of the Software, and to permit persons to whom the Software is 37 | furnished to do so, subject to the following conditions: 38 | 39 | The above copyright notice and this permission notice shall be included in 40 | all copies or substantial portions of the Software. 41 | 42 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 43 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 44 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 45 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 46 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 47 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 48 | THE SOFTWARE. 49 | 50 | Generated by CocoaPods - https://cocoapods.org 51 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo-ZDLibffiDemoUITests/Pods-ZDLibffiDemo-ZDLibffiDemoUITests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License (MIT) 18 | 19 | Copyright (c) 2014 Peter Steinberger, steipete@gmail.com 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | License 39 | MIT 40 | Title 41 | Aspects 42 | Type 43 | PSGroupSpecifier 44 | 45 | 46 | FooterText 47 | Copyright (c) 2020 faimin <fuxianchao@gmail.com> 48 | 49 | Permission is hereby granted, free of charge, to any person obtaining a copy 50 | of this software and associated documentation files (the "Software"), to deal 51 | in the Software without restriction, including without limitation the rights 52 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 53 | copies of the Software, and to permit persons to whom the Software is 54 | furnished to do so, subject to the following conditions: 55 | 56 | The above copyright notice and this permission notice shall be included in 57 | all copies or substantial portions of the Software. 58 | 59 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 60 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 61 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 62 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 63 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 64 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 65 | THE SOFTWARE. 66 | 67 | License 68 | MIT 69 | Title 70 | ZDLibffi 71 | Type 72 | PSGroupSpecifier 73 | 74 | 75 | FooterText 76 | Generated by CocoaPods - https://cocoapods.org 77 | Title 78 | 79 | Type 80 | PSGroupSpecifier 81 | 82 | 83 | StringsTable 84 | Acknowledgements 85 | Title 86 | Acknowledgements 87 | 88 | 89 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo-ZDLibffiDemoUITests/Pods-ZDLibffiDemo-ZDLibffiDemoUITests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ZDLibffiDemo_ZDLibffiDemoUITests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ZDLibffiDemo_ZDLibffiDemoUITests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo-ZDLibffiDemoUITests/Pods-ZDLibffiDemo-ZDLibffiDemoUITests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" "${PODS_ROOT}/Headers/Public/ZDLibffi" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Aspects" "${PODS_CONFIGURATION_BUILD_DIR}/ZDLibffi" 5 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Aspects" -l"ZDLibffi" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo-ZDLibffiDemoUITests/Pods-ZDLibffiDemo-ZDLibffiDemoUITests.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" "${PODS_ROOT}/Headers/Public/ZDLibffi" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Aspects" "${PODS_CONFIGURATION_BUILD_DIR}/ZDLibffi" 5 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Aspects" -l"ZDLibffi" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo/Pods-ZDLibffiDemo-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## Aspects 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2014 Peter Steinberger, steipete@gmail.com 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | ## ZDLibffi 29 | 30 | Copyright (c) 2020 faimin 31 | 32 | Permission is hereby granted, free of charge, to any person obtaining a copy 33 | of this software and associated documentation files (the "Software"), to deal 34 | in the Software without restriction, including without limitation the rights 35 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 36 | copies of the Software, and to permit persons to whom the Software is 37 | furnished to do so, subject to the following conditions: 38 | 39 | The above copyright notice and this permission notice shall be included in 40 | all copies or substantial portions of the Software. 41 | 42 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 43 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 44 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 45 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 46 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 47 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 48 | THE SOFTWARE. 49 | 50 | Generated by CocoaPods - https://cocoapods.org 51 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo/Pods-ZDLibffiDemo-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License (MIT) 18 | 19 | Copyright (c) 2014 Peter Steinberger, steipete@gmail.com 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | License 39 | MIT 40 | Title 41 | Aspects 42 | Type 43 | PSGroupSpecifier 44 | 45 | 46 | FooterText 47 | Copyright (c) 2020 faimin <fuxianchao@gmail.com> 48 | 49 | Permission is hereby granted, free of charge, to any person obtaining a copy 50 | of this software and associated documentation files (the "Software"), to deal 51 | in the Software without restriction, including without limitation the rights 52 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 53 | copies of the Software, and to permit persons to whom the Software is 54 | furnished to do so, subject to the following conditions: 55 | 56 | The above copyright notice and this permission notice shall be included in 57 | all copies or substantial portions of the Software. 58 | 59 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 60 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 61 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 62 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 63 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 64 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 65 | THE SOFTWARE. 66 | 67 | License 68 | MIT 69 | Title 70 | ZDLibffi 71 | Type 72 | PSGroupSpecifier 73 | 74 | 75 | FooterText 76 | Generated by CocoaPods - https://cocoapods.org 77 | Title 78 | 79 | Type 80 | PSGroupSpecifier 81 | 82 | 83 | StringsTable 84 | Acknowledgements 85 | Title 86 | Acknowledgements 87 | 88 | 89 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo/Pods-ZDLibffiDemo-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ZDLibffiDemo : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ZDLibffiDemo 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo/Pods-ZDLibffiDemo.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" "${PODS_ROOT}/Headers/Public/ZDLibffi" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Aspects" "${PODS_CONFIGURATION_BUILD_DIR}/ZDLibffi" 5 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Aspects" -l"ZDLibffi" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemo/Pods-ZDLibffiDemo.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" "${PODS_ROOT}/Headers/Public/ZDLibffi" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Aspects" "${PODS_CONFIGURATION_BUILD_DIR}/ZDLibffi" 5 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 6 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Aspects" -l"ZDLibffi" 7 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemoTests/Pods-ZDLibffiDemoTests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemoTests/Pods-ZDLibffiDemoTests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemoTests/Pods-ZDLibffiDemoTests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_ZDLibffiDemoTests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_ZDLibffiDemoTests 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemoTests/Pods-ZDLibffiDemoTests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" "${PODS_ROOT}/Headers/Public/ZDLibffi" 4 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/Pods-ZDLibffiDemoTests/Pods-ZDLibffiDemoTests.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Aspects" "${PODS_ROOT}/Headers/Public/ZDLibffi" 4 | OTHER_CFLAGS = $(inherited) -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 5 | OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -Xcc -fmodule-map-file="${PODS_ROOT}/Headers/Public/ZDLibffi/ZDLibffi.modulemap" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 11 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 12 | -------------------------------------------------------------------------------- /Pods/Target Support Files/ZDLibffi/ZDLibffi-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_ZDLibffi : NSObject 3 | @end 4 | @implementation PodsDummy_ZDLibffi 5 | @end 6 | -------------------------------------------------------------------------------- /Pods/Target Support Files/ZDLibffi/ZDLibffi-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | #import "ffi.h" 14 | #import "fficonfig.h" 15 | #import "fficonfig_arm64.h" 16 | #import "fficonfig_armv7.h" 17 | #import "fficonfig_armv7k.h" 18 | #import "fficonfig_i386.h" 19 | #import "fficonfig_x86_64.h" 20 | #import "ffitarget.h" 21 | #import "ffitarget_arm64.h" 22 | #import "ffitarget_armv7.h" 23 | #import "ffitarget_armv7k.h" 24 | #import "ffitarget_i386.h" 25 | #import "ffitarget_x86_64.h" 26 | #import "ffi_arm64.h" 27 | #import "ffi_armv7.h" 28 | #import "ffi_armv7k.h" 29 | #import "ffi_cfi.h" 30 | #import "ffi_common.h" 31 | #import "ffi_i386.h" 32 | #import "ffi_x86_64.h" 33 | #import "tramp.h" 34 | 35 | FOUNDATION_EXPORT double ZDLibffiVersionNumber; 36 | FOUNDATION_EXPORT const unsigned char ZDLibffiVersionString[]; 37 | 38 | -------------------------------------------------------------------------------- /Pods/Target Support Files/ZDLibffi/ZDLibffi.debug.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ZDLibffi 3 | DEFINES_MODULE = YES 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) USE_DL_PREFIX=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/ZDLibffi" "${PODS_ROOT}/Headers/Public" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/ZDLibffi 10 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Pods/Target Support Files/ZDLibffi/ZDLibffi.modulemap: -------------------------------------------------------------------------------- 1 | module ZDLibffi { 2 | umbrella header "ZDLibffi-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Pods/Target Support Files/ZDLibffi/ZDLibffi.release.xcconfig: -------------------------------------------------------------------------------- 1 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO 2 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ZDLibffi 3 | DEFINES_MODULE = YES 4 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 $(inherited) USE_DL_PREFIX=1 5 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/ZDLibffi" "${PODS_ROOT}/Headers/Public" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/ZDLibffi 10 | PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates 11 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 12 | SKIP_INSTALL = YES 13 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 14 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 faimin 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/README.md: -------------------------------------------------------------------------------- 1 | # Libffi_iOS 2 | 3 | [![CI Status](https://img.shields.io/travis/faimin/Libffi_iOS.svg?style=flat)](https://travis-ci.org/faimin/Libffi_iOS) 4 | [![Version](https://img.shields.io/cocoapods/v/Libffi_iOS.svg?style=flat)](https://cocoapods.org/pods/Libffi_iOS) 5 | [![License](https://img.shields.io/cocoapods/l/Libffi_iOS.svg?style=flat)](https://cocoapods.org/pods/Libffi_iOS) 6 | [![Platform](https://img.shields.io/cocoapods/p/Libffi_iOS.svg?style=flat)](https://cocoapods.org/pods/Libffi_iOS) 7 | 8 | ## Introduction: 9 | 10 | [libffi v3.4.2](https://github.com/libffi/libffi/releases/tag/v3.4.2) source code that support `module` 11 | 12 | ## Env: 13 | 14 | > [libffi v3.4.2](https://github.com/libffi/libffi/releases/tag/v3.4.2) 15 | > 16 | > Xcode 12.5 17 | > 18 | > MacOS 11.4 19 | 20 | ## Compile source code: 21 | 22 | 1. `sh autogen.sh` 23 | 2. `python generate-darwin-source-and-headers.py --only-ios` 24 | 3. open `libffi.xcodeproj` 25 | 4. select scheme `libffi-iOS` and device `Generic iOS Device` 26 | 4. click `Product - Build` 27 | If success, you would see a `Product/libffi.a` in the side bar, you can right click it to get the lib in the finder. 28 | 29 | ## Installation 30 | 31 | Libffi_iOS is available through [CocoaPods](https://cocoapods.org). To install 32 | it, simply add the following line to your Podfile: 33 | 34 | ```ruby 35 | pod 'ZDLibffi' 36 | ``` 37 | 38 | ## Author 39 | 40 | faimin, fuxianchao@gmail.com 41 | 42 | ## Thanks: 43 | 44 | - [how to compile for iOS](https://github.com/libffi/libffi/issues/510#issuecomment-654689416) 45 | 46 | ## License 47 | 48 | Libffi_iOS is available under the MIT license. See the LICENSE file for more info. 49 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffi.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm64__ 2 | 3 | #if __has_include() 4 | #include 5 | #else 6 | #include "ffi_arm64.h" 7 | #endif 8 | 9 | #endif 10 | 11 | 12 | #ifdef __i386__ 13 | 14 | #if __has_include() 15 | #include 16 | #else 17 | #include "ffi_i386.h" 18 | #endif 19 | 20 | #endif 21 | 22 | 23 | #ifdef __arm__ 24 | 25 | #if __has_include() 26 | #include 27 | #else 28 | #include "ffi_armv7.h" 29 | #endif 30 | 31 | #endif 32 | 33 | 34 | #ifdef __x86_64__ 35 | 36 | #if __has_include() 37 | #include 38 | #else 39 | #include "ffi_x86_64.h" 40 | #endif 41 | 42 | #endif 43 | 44 | 45 | #ifdef __arm__ 46 | 47 | #if __has_include() 48 | #include 49 | #else 50 | #include "ffi_armv7k.h" 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffi_cfi.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | ffi_cfi.h - Copyright (c) 2014 Red Hat, Inc. 3 | 4 | Conditionally assemble cfi directives. Only necessary for building libffi. 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the ``Software''), to deal in the Software without 9 | restriction, including without limitation the rights to use, copy, 10 | modify, merge, publish, distribute, sublicense, and/or sell copies 11 | of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | 26 | ----------------------------------------------------------------------- */ 27 | 28 | #ifndef FFI_CFI_H 29 | #define FFI_CFI_H 30 | 31 | #ifdef HAVE_AS_CFI_PSEUDO_OP 32 | 33 | # define cfi_startproc .cfi_startproc 34 | # define cfi_endproc .cfi_endproc 35 | # define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off 36 | # define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg 37 | # define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off 38 | # define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off 39 | # define cfi_offset(reg, off) .cfi_offset reg, off 40 | # define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off 41 | # define cfi_register(r1, r2) .cfi_register r1, r2 42 | # define cfi_return_column(reg) .cfi_return_column reg 43 | # define cfi_restore(reg) .cfi_restore reg 44 | # define cfi_same_value(reg) .cfi_same_value reg 45 | # define cfi_undefined(reg) .cfi_undefined reg 46 | # define cfi_remember_state .cfi_remember_state 47 | # define cfi_restore_state .cfi_restore_state 48 | # define cfi_window_save .cfi_window_save 49 | # define cfi_personality(enc, exp) .cfi_personality enc, exp 50 | # define cfi_lsda(enc, exp) .cfi_lsda enc, exp 51 | # define cfi_escape(...) .cfi_escape __VA_ARGS__ 52 | 53 | #else 54 | 55 | # define cfi_startproc 56 | # define cfi_endproc 57 | # define cfi_def_cfa(reg, off) 58 | # define cfi_def_cfa_register(reg) 59 | # define cfi_def_cfa_offset(off) 60 | # define cfi_adjust_cfa_offset(off) 61 | # define cfi_offset(reg, off) 62 | # define cfi_rel_offset(reg, off) 63 | # define cfi_register(r1, r2) 64 | # define cfi_return_column(reg) 65 | # define cfi_restore(reg) 66 | # define cfi_same_value(reg) 67 | # define cfi_undefined(reg) 68 | # define cfi_remember_state 69 | # define cfi_restore_state 70 | # define cfi_window_save 71 | # define cfi_personality(enc, exp) 72 | # define cfi_lsda(enc, exp) 73 | # define cfi_escape(...) 74 | 75 | #endif /* HAVE_AS_CFI_PSEUDO_OP */ 76 | #endif /* FFI_CFI_H */ 77 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffi_common.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | ffi_common.h - Copyright (C) 2011, 2012, 2013 Anthony Green 3 | Copyright (C) 2007 Free Software Foundation, Inc 4 | Copyright (c) 1996 Red Hat, Inc. 5 | 6 | Common internal definitions and macros. Only necessary for building 7 | libffi. 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the ``Software''), to deal in the Software without 12 | restriction, including without limitation the rights to use, copy, 13 | modify, merge, publish, distribute, sublicense, and/or sell copies 14 | of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | DEALINGS IN THE SOFTWARE. 28 | 29 | ----------------------------------------------------------------------- */ 30 | 31 | #ifndef FFI_COMMON_H 32 | #define FFI_COMMON_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | #if __has_include() 39 | #include 40 | #else 41 | #include "fficonfig.h" 42 | #endif 43 | 44 | /* Do not move this. Some versions of AIX are very picky about where 45 | this is positioned. */ 46 | #ifdef __GNUC__ 47 | # if HAVE_ALLOCA_H 48 | # include 49 | # else 50 | /* mingw64 defines this already in malloc.h. */ 51 | # ifndef alloca 52 | # define alloca __builtin_alloca 53 | # endif 54 | # endif 55 | # define MAYBE_UNUSED __attribute__((__unused__)) 56 | #else 57 | # define MAYBE_UNUSED 58 | # if HAVE_ALLOCA_H 59 | # include 60 | # else 61 | # ifdef _AIX 62 | # pragma alloca 63 | # else 64 | # ifndef alloca /* predefined by HP cc +Olibcalls */ 65 | # ifdef _MSC_VER 66 | # define alloca _alloca 67 | # else 68 | char *alloca (); 69 | # endif 70 | # endif 71 | # endif 72 | # endif 73 | #endif 74 | 75 | /* Check for the existence of memcpy. */ 76 | #if STDC_HEADERS 77 | # include 78 | #else 79 | # ifndef HAVE_MEMCPY 80 | # define memcpy(d, s, n) bcopy ((s), (d), (n)) 81 | # endif 82 | #endif 83 | 84 | #if defined(FFI_DEBUG) 85 | #include 86 | #endif 87 | 88 | #ifdef FFI_DEBUG 89 | void ffi_assert(char *expr, char *file, int line); 90 | void ffi_stop_here(void); 91 | void ffi_type_test(ffi_type *a, char *file, int line); 92 | 93 | #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) 94 | #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) 95 | #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) 96 | #else 97 | #define FFI_ASSERT(x) 98 | #define FFI_ASSERT_AT(x, f, l) 99 | #define FFI_ASSERT_VALID_TYPE(x) 100 | #endif 101 | 102 | /* v cast to size_t and aligned up to a multiple of a */ 103 | #define FFI_ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) 104 | /* v cast to size_t and aligned down to a multiple of a */ 105 | #define FFI_ALIGN_DOWN(v, a) (((size_t) (v)) & -a) 106 | 107 | /* Perform machine dependent cif processing */ 108 | ffi_status ffi_prep_cif_machdep(ffi_cif *cif); 109 | ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, 110 | unsigned int nfixedargs, unsigned int ntotalargs); 111 | 112 | 113 | #if HAVE_LONG_DOUBLE_VARIANT 114 | /* Used to adjust size/alignment of ffi types. */ 115 | void ffi_prep_types (ffi_abi abi); 116 | #endif 117 | 118 | /* Used internally, but overridden by some architectures */ 119 | ffi_status ffi_prep_cif_core(ffi_cif *cif, 120 | ffi_abi abi, 121 | unsigned int isvariadic, 122 | unsigned int nfixedargs, 123 | unsigned int ntotalargs, 124 | ffi_type *rtype, 125 | ffi_type **atypes); 126 | 127 | /* Translate a data pointer to a code pointer. Needed for closures on 128 | some targets. */ 129 | void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN; 130 | 131 | /* The arch code calls this to determine if a given closure has a 132 | static trampoline. */ 133 | int ffi_tramp_is_present (void *closure) FFI_HIDDEN; 134 | 135 | /* Extended cif, used in callback from assembly routine */ 136 | typedef struct 137 | { 138 | ffi_cif *cif; 139 | void *rvalue; 140 | void **avalue; 141 | } extended_cif; 142 | 143 | /* Terse sized type definitions. */ 144 | #if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) 145 | typedef unsigned char UINT8; 146 | typedef signed char SINT8; 147 | typedef unsigned short UINT16; 148 | typedef signed short SINT16; 149 | typedef unsigned int UINT32; 150 | typedef signed int SINT32; 151 | # ifdef _MSC_VER 152 | typedef unsigned __int64 UINT64; 153 | typedef signed __int64 SINT64; 154 | # else 155 | # include 156 | typedef uint64_t UINT64; 157 | typedef int64_t SINT64; 158 | # endif 159 | #else 160 | typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); 161 | typedef signed int SINT8 __attribute__((__mode__(__QI__))); 162 | typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); 163 | typedef signed int SINT16 __attribute__((__mode__(__HI__))); 164 | typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); 165 | typedef signed int SINT32 __attribute__((__mode__(__SI__))); 166 | typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); 167 | typedef signed int SINT64 __attribute__((__mode__(__DI__))); 168 | #endif 169 | 170 | typedef float FLOAT32; 171 | 172 | #ifndef __GNUC__ 173 | #define __builtin_expect(x, expected_value) (x) 174 | #endif 175 | #define LIKELY(x) __builtin_expect(!!(x),1) 176 | #define UNLIKELY(x) __builtin_expect((x)!=0,0) 177 | 178 | #ifdef __cplusplus 179 | } 180 | #endif 181 | 182 | #endif 183 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/fficonfig.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm64__ 2 | 3 | #if __has_include() 4 | #include 5 | #else 6 | #include "fficonfig_arm64.h" 7 | #endif 8 | 9 | 10 | #endif 11 | #ifdef __i386__ 12 | 13 | #if __has_include() 14 | #include 15 | #else 16 | #include "fficonfig_i386.h" 17 | #endif 18 | 19 | 20 | #endif 21 | #ifdef __arm__ 22 | 23 | #if __has_include() 24 | #include 25 | #else 26 | #include "fficonfig_armv7.h" 27 | #endif 28 | 29 | 30 | #endif 31 | #ifdef __x86_64__ 32 | 33 | #if __has_include() 34 | #include 35 | #else 36 | #include "fficonfig_x86_64.h" 37 | #endif 38 | 39 | 40 | #endif 41 | #ifdef __arm__ 42 | 43 | #if __has_include() 44 | #include 45 | #else 46 | #include "fficonfig_armv7k.h" 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/fficonfig_arm64.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm64__ 2 | 3 | /* fficonfig.h. Generated from fficonfig.h.in by configure. */ 4 | /* fficonfig.h.in. Generated from configure.ac by autoheader. */ 5 | 6 | /* Define if building universal (internal helper macro) */ 7 | /* #undef AC_APPLE_UNIVERSAL_BUILD */ 8 | 9 | /* Define to 1 if using 'alloca.c'. */ 10 | /* #undef C_ALLOCA */ 11 | 12 | /* Define to the flags needed for the .section .eh_frame directive. */ 13 | #define EH_FRAME_FLAGS "a" 14 | 15 | /* Define this if you want extra debugging. */ 16 | /* #undef FFI_DEBUG */ 17 | 18 | /* Define this if you want statically defined trampolines */ 19 | /* #undef FFI_EXEC_STATIC_TRAMP */ 20 | 21 | /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ 22 | #define FFI_EXEC_TRAMPOLINE_TABLE 1 23 | 24 | /* Define this if you want to enable pax emulated trampolines */ 25 | /* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */ 26 | 27 | /* Cannot use malloc on this target, so, we revert to alternative means */ 28 | /* #undef FFI_MMAP_EXEC_WRIT */ 29 | 30 | /* Define this if you do not want support for the raw API. */ 31 | /* #undef FFI_NO_RAW_API */ 32 | 33 | /* Define this if you do not want support for aggregate types. */ 34 | /* #undef FFI_NO_STRUCTS */ 35 | 36 | /* Define to 1 if you have 'alloca', as a function or macro. */ 37 | #define HAVE_ALLOCA 1 38 | 39 | /* Define to 1 if works. */ 40 | #define HAVE_ALLOCA_H 1 41 | 42 | /* Define if your assembler supports .cfi_* directives. */ 43 | /* #undef HAVE_AS_CFI_PSEUDO_OP */ 44 | 45 | /* Define if your assembler supports .register. */ 46 | /* #undef HAVE_AS_REGISTER_PSEUDO_OP */ 47 | 48 | /* Define if the compiler uses zarch features. */ 49 | /* #undef HAVE_AS_S390_ZARCH */ 50 | 51 | /* Define if your assembler and linker support unaligned PC relative relocs. 52 | */ 53 | /* #undef HAVE_AS_SPARC_UA_PCREL */ 54 | 55 | /* Define if your assembler supports unwind section type. */ 56 | /* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ 57 | 58 | /* Define if your assembler supports PC relative relocs. */ 59 | /* #undef HAVE_AS_X86_PCREL */ 60 | 61 | /* Define to 1 if you have the header file. */ 62 | #define HAVE_DLFCN_H 1 63 | 64 | /* Define if __attribute__((visibility("hidden"))) is supported. */ 65 | #define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_INTTYPES_H 1 69 | 70 | /* Define if you have the long double type and it is bigger than a double */ 71 | /* #undef HAVE_LONG_DOUBLE */ 72 | 73 | /* Define if you support more than one size of the long double type */ 74 | /* #undef HAVE_LONG_DOUBLE_VARIANT */ 75 | 76 | /* Define to 1 if you have the `memcpy' function. */ 77 | #define HAVE_MEMCPY 1 78 | 79 | /* Define to 1 if you have the `memfd_create' function. */ 80 | /* #undef HAVE_MEMFD_CREATE */ 81 | 82 | /* Define to 1 if you have the `mkostemp' function. */ 83 | #define HAVE_MKOSTEMP 1 84 | 85 | /* Define to 1 if you have the `mkstemp' function. */ 86 | #define HAVE_MKSTEMP 1 87 | 88 | /* Define to 1 if you have the `mmap' function. */ 89 | #define HAVE_MMAP 1 90 | 91 | /* Define if mmap with MAP_ANON(YMOUS) works. */ 92 | #define HAVE_MMAP_ANON 1 93 | 94 | /* Define if mmap of /dev/zero works. */ 95 | /* #undef HAVE_MMAP_DEV_ZERO */ 96 | 97 | /* Define if read-only mmap of a plain file works. */ 98 | #define HAVE_MMAP_FILE 1 99 | 100 | /* Define if your compiler supports pointer authentication. */ 101 | /* #undef HAVE_PTRAUTH */ 102 | 103 | /* Define if .eh_frame sections should be read-only. */ 104 | #define HAVE_RO_EH_FRAME 1 105 | 106 | /* Define to 1 if you have the header file. */ 107 | #define HAVE_STDINT_H 1 108 | 109 | /* Define to 1 if you have the header file. */ 110 | #define HAVE_STDIO_H 1 111 | 112 | /* Define to 1 if you have the header file. */ 113 | #define HAVE_STDLIB_H 1 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #define HAVE_STRINGS_H 1 117 | 118 | /* Define to 1 if you have the header file. */ 119 | #define HAVE_STRING_H 1 120 | 121 | /* Define to 1 if you have the header file. */ 122 | /* #undef HAVE_SYS_MEMFD_H */ 123 | 124 | /* Define to 1 if you have the header file. */ 125 | #define HAVE_SYS_MMAN_H 1 126 | 127 | /* Define to 1 if you have the header file. */ 128 | #define HAVE_SYS_STAT_H 1 129 | 130 | /* Define to 1 if you have the header file. */ 131 | #define HAVE_SYS_TYPES_H 1 132 | 133 | /* Define to 1 if you have the header file. */ 134 | #define HAVE_UNISTD_H 1 135 | 136 | /* Define to 1 if GNU symbol versioning is used for libatomic. */ 137 | /* #undef LIBFFI_GNU_SYMBOL_VERSIONING */ 138 | 139 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 140 | #define LT_OBJDIR ".libs/" 141 | 142 | /* Name of package */ 143 | #define PACKAGE "libffi" 144 | 145 | /* Define to the address where bug reports for this package should be sent. */ 146 | #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues" 147 | 148 | /* Define to the full name of this package. */ 149 | #define PACKAGE_NAME "libffi" 150 | 151 | /* Define to the full name and version of this package. */ 152 | #define PACKAGE_STRING "libffi 3.4.2" 153 | 154 | /* Define to the one symbol short name of this package. */ 155 | #define PACKAGE_TARNAME "libffi" 156 | 157 | /* Define to the home page for this package. */ 158 | #define PACKAGE_URL "" 159 | 160 | /* Define to the version of this package. */ 161 | #define PACKAGE_VERSION "3.4.2" 162 | 163 | /* The size of `double', as computed by sizeof. */ 164 | #define SIZEOF_DOUBLE 8 165 | 166 | /* The size of `long double', as computed by sizeof. */ 167 | #define SIZEOF_LONG_DOUBLE 8 168 | 169 | /* The size of `size_t', as computed by sizeof. */ 170 | #define SIZEOF_SIZE_T 8 171 | 172 | /* If using the C implementation of alloca, define if you know the 173 | direction of stack growth for your system; otherwise it will be 174 | automatically deduced at runtime. 175 | STACK_DIRECTION > 0 => grows toward higher addresses 176 | STACK_DIRECTION < 0 => grows toward lower addresses 177 | STACK_DIRECTION = 0 => direction of growth unknown */ 178 | /* #undef STACK_DIRECTION */ 179 | 180 | /* Define to 1 if all of the C90 standard headers exist (not just the ones 181 | required in a freestanding environment). This macro is provided for 182 | backward compatibility; new code need not use it. */ 183 | #define STDC_HEADERS 1 184 | 185 | /* Define if symbols are underscored. */ 186 | #define SYMBOL_UNDERSCORE 1 187 | 188 | /* Define this if you are using Purify and want to suppress spurious messages. 189 | */ 190 | /* #undef USING_PURIFY */ 191 | 192 | /* Version number of package */ 193 | #define VERSION "3.4.2" 194 | 195 | /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 196 | significant byte first (like Motorola and SPARC, unlike Intel). */ 197 | #if defined AC_APPLE_UNIVERSAL_BUILD 198 | # if defined __BIG_ENDIAN__ 199 | # define WORDS_BIGENDIAN 1 200 | # endif 201 | #else 202 | # ifndef WORDS_BIGENDIAN 203 | /* # undef WORDS_BIGENDIAN */ 204 | # endif 205 | #endif 206 | 207 | /* Define to `unsigned int' if does not define. */ 208 | /* #undef size_t */ 209 | 210 | 211 | #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 212 | #ifdef LIBFFI_ASM 213 | #ifdef __APPLE__ 214 | #define FFI_HIDDEN(name) .private_extern name 215 | #else 216 | #define FFI_HIDDEN(name) .hidden name 217 | #endif 218 | #else 219 | #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) 220 | #endif 221 | #else 222 | #ifdef LIBFFI_ASM 223 | #define FFI_HIDDEN(name) 224 | #else 225 | #define FFI_HIDDEN 226 | #endif 227 | #endif 228 | 229 | 230 | 231 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/fficonfig_armv7.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm__ 2 | 3 | /* fficonfig.h. Generated from fficonfig.h.in by configure. */ 4 | /* fficonfig.h.in. Generated from configure.ac by autoheader. */ 5 | 6 | /* Define if building universal (internal helper macro) */ 7 | /* #undef AC_APPLE_UNIVERSAL_BUILD */ 8 | 9 | /* Define to 1 if using 'alloca.c'. */ 10 | /* #undef C_ALLOCA */ 11 | 12 | /* Define to the flags needed for the .section .eh_frame directive. */ 13 | #define EH_FRAME_FLAGS "a" 14 | 15 | /* Define this if you want extra debugging. */ 16 | /* #undef FFI_DEBUG */ 17 | 18 | /* Define this if you want statically defined trampolines */ 19 | /* #undef FFI_EXEC_STATIC_TRAMP */ 20 | 21 | /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ 22 | #define FFI_EXEC_TRAMPOLINE_TABLE 1 23 | 24 | /* Define this if you want to enable pax emulated trampolines */ 25 | /* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */ 26 | 27 | /* Cannot use malloc on this target, so, we revert to alternative means */ 28 | /* #undef FFI_MMAP_EXEC_WRIT */ 29 | 30 | /* Define this if you do not want support for the raw API. */ 31 | /* #undef FFI_NO_RAW_API */ 32 | 33 | /* Define this if you do not want support for aggregate types. */ 34 | /* #undef FFI_NO_STRUCTS */ 35 | 36 | /* Define to 1 if you have 'alloca', as a function or macro. */ 37 | #define HAVE_ALLOCA 1 38 | 39 | /* Define to 1 if works. */ 40 | #define HAVE_ALLOCA_H 1 41 | 42 | /* Define if your assembler supports .cfi_* directives. */ 43 | /* #undef HAVE_AS_CFI_PSEUDO_OP */ 44 | 45 | /* Define if your assembler supports .register. */ 46 | /* #undef HAVE_AS_REGISTER_PSEUDO_OP */ 47 | 48 | /* Define if the compiler uses zarch features. */ 49 | /* #undef HAVE_AS_S390_ZARCH */ 50 | 51 | /* Define if your assembler and linker support unaligned PC relative relocs. 52 | */ 53 | /* #undef HAVE_AS_SPARC_UA_PCREL */ 54 | 55 | /* Define if your assembler supports unwind section type. */ 56 | /* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ 57 | 58 | /* Define if your assembler supports PC relative relocs. */ 59 | /* #undef HAVE_AS_X86_PCREL */ 60 | 61 | /* Define to 1 if you have the header file. */ 62 | #define HAVE_DLFCN_H 1 63 | 64 | /* Define if __attribute__((visibility("hidden"))) is supported. */ 65 | #define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_INTTYPES_H 1 69 | 70 | /* Define if you have the long double type and it is bigger than a double */ 71 | /* #undef HAVE_LONG_DOUBLE */ 72 | 73 | /* Define if you support more than one size of the long double type */ 74 | /* #undef HAVE_LONG_DOUBLE_VARIANT */ 75 | 76 | /* Define to 1 if you have the `memcpy' function. */ 77 | #define HAVE_MEMCPY 1 78 | 79 | /* Define to 1 if you have the `memfd_create' function. */ 80 | /* #undef HAVE_MEMFD_CREATE */ 81 | 82 | /* Define to 1 if you have the `mkostemp' function. */ 83 | #define HAVE_MKOSTEMP 1 84 | 85 | /* Define to 1 if you have the `mkstemp' function. */ 86 | #define HAVE_MKSTEMP 1 87 | 88 | /* Define to 1 if you have the `mmap' function. */ 89 | #define HAVE_MMAP 1 90 | 91 | /* Define if mmap with MAP_ANON(YMOUS) works. */ 92 | #define HAVE_MMAP_ANON 1 93 | 94 | /* Define if mmap of /dev/zero works. */ 95 | /* #undef HAVE_MMAP_DEV_ZERO */ 96 | 97 | /* Define if read-only mmap of a plain file works. */ 98 | #define HAVE_MMAP_FILE 1 99 | 100 | /* Define if your compiler supports pointer authentication. */ 101 | /* #undef HAVE_PTRAUTH */ 102 | 103 | /* Define if .eh_frame sections should be read-only. */ 104 | #define HAVE_RO_EH_FRAME 1 105 | 106 | /* Define to 1 if you have the header file. */ 107 | #define HAVE_STDINT_H 1 108 | 109 | /* Define to 1 if you have the header file. */ 110 | #define HAVE_STDIO_H 1 111 | 112 | /* Define to 1 if you have the header file. */ 113 | #define HAVE_STDLIB_H 1 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #define HAVE_STRINGS_H 1 117 | 118 | /* Define to 1 if you have the header file. */ 119 | #define HAVE_STRING_H 1 120 | 121 | /* Define to 1 if you have the header file. */ 122 | /* #undef HAVE_SYS_MEMFD_H */ 123 | 124 | /* Define to 1 if you have the header file. */ 125 | #define HAVE_SYS_MMAN_H 1 126 | 127 | /* Define to 1 if you have the header file. */ 128 | #define HAVE_SYS_STAT_H 1 129 | 130 | /* Define to 1 if you have the header file. */ 131 | #define HAVE_SYS_TYPES_H 1 132 | 133 | /* Define to 1 if you have the header file. */ 134 | #define HAVE_UNISTD_H 1 135 | 136 | /* Define to 1 if GNU symbol versioning is used for libatomic. */ 137 | /* #undef LIBFFI_GNU_SYMBOL_VERSIONING */ 138 | 139 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 140 | #define LT_OBJDIR ".libs/" 141 | 142 | /* Name of package */ 143 | #define PACKAGE "libffi" 144 | 145 | /* Define to the address where bug reports for this package should be sent. */ 146 | #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues" 147 | 148 | /* Define to the full name of this package. */ 149 | #define PACKAGE_NAME "libffi" 150 | 151 | /* Define to the full name and version of this package. */ 152 | #define PACKAGE_STRING "libffi 3.4.2" 153 | 154 | /* Define to the one symbol short name of this package. */ 155 | #define PACKAGE_TARNAME "libffi" 156 | 157 | /* Define to the home page for this package. */ 158 | #define PACKAGE_URL "" 159 | 160 | /* Define to the version of this package. */ 161 | #define PACKAGE_VERSION "3.4.2" 162 | 163 | /* The size of `double', as computed by sizeof. */ 164 | #define SIZEOF_DOUBLE 8 165 | 166 | /* The size of `long double', as computed by sizeof. */ 167 | #define SIZEOF_LONG_DOUBLE 8 168 | 169 | /* The size of `size_t', as computed by sizeof. */ 170 | #define SIZEOF_SIZE_T 4 171 | 172 | /* If using the C implementation of alloca, define if you know the 173 | direction of stack growth for your system; otherwise it will be 174 | automatically deduced at runtime. 175 | STACK_DIRECTION > 0 => grows toward higher addresses 176 | STACK_DIRECTION < 0 => grows toward lower addresses 177 | STACK_DIRECTION = 0 => direction of growth unknown */ 178 | /* #undef STACK_DIRECTION */ 179 | 180 | /* Define to 1 if all of the C90 standard headers exist (not just the ones 181 | required in a freestanding environment). This macro is provided for 182 | backward compatibility; new code need not use it. */ 183 | #define STDC_HEADERS 1 184 | 185 | /* Define if symbols are underscored. */ 186 | #define SYMBOL_UNDERSCORE 1 187 | 188 | /* Define this if you are using Purify and want to suppress spurious messages. 189 | */ 190 | /* #undef USING_PURIFY */ 191 | 192 | /* Version number of package */ 193 | #define VERSION "3.4.2" 194 | 195 | /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 196 | significant byte first (like Motorola and SPARC, unlike Intel). */ 197 | #if defined AC_APPLE_UNIVERSAL_BUILD 198 | # if defined __BIG_ENDIAN__ 199 | # define WORDS_BIGENDIAN 1 200 | # endif 201 | #else 202 | # ifndef WORDS_BIGENDIAN 203 | /* # undef WORDS_BIGENDIAN */ 204 | # endif 205 | #endif 206 | 207 | /* Define to `unsigned int' if does not define. */ 208 | /* #undef size_t */ 209 | 210 | 211 | #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 212 | #ifdef LIBFFI_ASM 213 | #ifdef __APPLE__ 214 | #define FFI_HIDDEN(name) .private_extern name 215 | #else 216 | #define FFI_HIDDEN(name) .hidden name 217 | #endif 218 | #else 219 | #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) 220 | #endif 221 | #else 222 | #ifdef LIBFFI_ASM 223 | #define FFI_HIDDEN(name) 224 | #else 225 | #define FFI_HIDDEN 226 | #endif 227 | #endif 228 | 229 | 230 | 231 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/fficonfig_armv7k.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm__ 2 | 3 | /* fficonfig.h. Generated from fficonfig.h.in by configure. */ 4 | /* fficonfig.h.in. Generated from configure.ac by autoheader. */ 5 | 6 | /* Define if building universal (internal helper macro) */ 7 | /* #undef AC_APPLE_UNIVERSAL_BUILD */ 8 | 9 | /* Define to 1 if using 'alloca.c'. */ 10 | /* #undef C_ALLOCA */ 11 | 12 | /* Define to the flags needed for the .section .eh_frame directive. */ 13 | #define EH_FRAME_FLAGS "a" 14 | 15 | /* Define this if you want extra debugging. */ 16 | /* #undef FFI_DEBUG */ 17 | 18 | /* Define this if you want statically defined trampolines */ 19 | /* #undef FFI_EXEC_STATIC_TRAMP */ 20 | 21 | /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ 22 | #define FFI_EXEC_TRAMPOLINE_TABLE 1 23 | 24 | /* Define this if you want to enable pax emulated trampolines */ 25 | /* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */ 26 | 27 | /* Cannot use malloc on this target, so, we revert to alternative means */ 28 | /* #undef FFI_MMAP_EXEC_WRIT */ 29 | 30 | /* Define this if you do not want support for the raw API. */ 31 | /* #undef FFI_NO_RAW_API */ 32 | 33 | /* Define this if you do not want support for aggregate types. */ 34 | /* #undef FFI_NO_STRUCTS */ 35 | 36 | /* Define to 1 if you have 'alloca', as a function or macro. */ 37 | #define HAVE_ALLOCA 1 38 | 39 | /* Define to 1 if works. */ 40 | #define HAVE_ALLOCA_H 1 41 | 42 | /* Define if your assembler supports .cfi_* directives. */ 43 | /* #undef HAVE_AS_CFI_PSEUDO_OP */ 44 | 45 | /* Define if your assembler supports .register. */ 46 | /* #undef HAVE_AS_REGISTER_PSEUDO_OP */ 47 | 48 | /* Define if the compiler uses zarch features. */ 49 | /* #undef HAVE_AS_S390_ZARCH */ 50 | 51 | /* Define if your assembler and linker support unaligned PC relative relocs. 52 | */ 53 | /* #undef HAVE_AS_SPARC_UA_PCREL */ 54 | 55 | /* Define if your assembler supports unwind section type. */ 56 | /* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ 57 | 58 | /* Define if your assembler supports PC relative relocs. */ 59 | /* #undef HAVE_AS_X86_PCREL */ 60 | 61 | /* Define to 1 if you have the header file. */ 62 | #define HAVE_DLFCN_H 1 63 | 64 | /* Define if __attribute__((visibility("hidden"))) is supported. */ 65 | #define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_INTTYPES_H 1 69 | 70 | /* Define if you have the long double type and it is bigger than a double */ 71 | /* #undef HAVE_LONG_DOUBLE */ 72 | 73 | /* Define if you support more than one size of the long double type */ 74 | /* #undef HAVE_LONG_DOUBLE_VARIANT */ 75 | 76 | /* Define to 1 if you have the `memcpy' function. */ 77 | #define HAVE_MEMCPY 1 78 | 79 | /* Define to 1 if you have the `memfd_create' function. */ 80 | /* #undef HAVE_MEMFD_CREATE */ 81 | 82 | /* Define to 1 if you have the `mkostemp' function. */ 83 | #define HAVE_MKOSTEMP 1 84 | 85 | /* Define to 1 if you have the `mkstemp' function. */ 86 | #define HAVE_MKSTEMP 1 87 | 88 | /* Define to 1 if you have the `mmap' function. */ 89 | #define HAVE_MMAP 1 90 | 91 | /* Define if mmap with MAP_ANON(YMOUS) works. */ 92 | #define HAVE_MMAP_ANON 1 93 | 94 | /* Define if mmap of /dev/zero works. */ 95 | /* #undef HAVE_MMAP_DEV_ZERO */ 96 | 97 | /* Define if read-only mmap of a plain file works. */ 98 | #define HAVE_MMAP_FILE 1 99 | 100 | /* Define if your compiler supports pointer authentication. */ 101 | /* #undef HAVE_PTRAUTH */ 102 | 103 | /* Define if .eh_frame sections should be read-only. */ 104 | #define HAVE_RO_EH_FRAME 1 105 | 106 | /* Define to 1 if you have the header file. */ 107 | #define HAVE_STDINT_H 1 108 | 109 | /* Define to 1 if you have the header file. */ 110 | #define HAVE_STDIO_H 1 111 | 112 | /* Define to 1 if you have the header file. */ 113 | #define HAVE_STDLIB_H 1 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #define HAVE_STRINGS_H 1 117 | 118 | /* Define to 1 if you have the header file. */ 119 | #define HAVE_STRING_H 1 120 | 121 | /* Define to 1 if you have the header file. */ 122 | /* #undef HAVE_SYS_MEMFD_H */ 123 | 124 | /* Define to 1 if you have the header file. */ 125 | #define HAVE_SYS_MMAN_H 1 126 | 127 | /* Define to 1 if you have the header file. */ 128 | #define HAVE_SYS_STAT_H 1 129 | 130 | /* Define to 1 if you have the header file. */ 131 | #define HAVE_SYS_TYPES_H 1 132 | 133 | /* Define to 1 if you have the header file. */ 134 | #define HAVE_UNISTD_H 1 135 | 136 | /* Define to 1 if GNU symbol versioning is used for libatomic. */ 137 | /* #undef LIBFFI_GNU_SYMBOL_VERSIONING */ 138 | 139 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 140 | #define LT_OBJDIR ".libs/" 141 | 142 | /* Name of package */ 143 | #define PACKAGE "libffi" 144 | 145 | /* Define to the address where bug reports for this package should be sent. */ 146 | #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues" 147 | 148 | /* Define to the full name of this package. */ 149 | #define PACKAGE_NAME "libffi" 150 | 151 | /* Define to the full name and version of this package. */ 152 | #define PACKAGE_STRING "libffi 3.4.2" 153 | 154 | /* Define to the one symbol short name of this package. */ 155 | #define PACKAGE_TARNAME "libffi" 156 | 157 | /* Define to the home page for this package. */ 158 | #define PACKAGE_URL "" 159 | 160 | /* Define to the version of this package. */ 161 | #define PACKAGE_VERSION "3.4.2" 162 | 163 | /* The size of `double', as computed by sizeof. */ 164 | #define SIZEOF_DOUBLE 8 165 | 166 | /* The size of `long double', as computed by sizeof. */ 167 | #define SIZEOF_LONG_DOUBLE 8 168 | 169 | /* The size of `size_t', as computed by sizeof. */ 170 | #define SIZEOF_SIZE_T 4 171 | 172 | /* If using the C implementation of alloca, define if you know the 173 | direction of stack growth for your system; otherwise it will be 174 | automatically deduced at runtime. 175 | STACK_DIRECTION > 0 => grows toward higher addresses 176 | STACK_DIRECTION < 0 => grows toward lower addresses 177 | STACK_DIRECTION = 0 => direction of growth unknown */ 178 | /* #undef STACK_DIRECTION */ 179 | 180 | /* Define to 1 if all of the C90 standard headers exist (not just the ones 181 | required in a freestanding environment). This macro is provided for 182 | backward compatibility; new code need not use it. */ 183 | #define STDC_HEADERS 1 184 | 185 | /* Define if symbols are underscored. */ 186 | #define SYMBOL_UNDERSCORE 1 187 | 188 | /* Define this if you are using Purify and want to suppress spurious messages. 189 | */ 190 | /* #undef USING_PURIFY */ 191 | 192 | /* Version number of package */ 193 | #define VERSION "3.4.2" 194 | 195 | /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 196 | significant byte first (like Motorola and SPARC, unlike Intel). */ 197 | #if defined AC_APPLE_UNIVERSAL_BUILD 198 | # if defined __BIG_ENDIAN__ 199 | # define WORDS_BIGENDIAN 1 200 | # endif 201 | #else 202 | # ifndef WORDS_BIGENDIAN 203 | /* # undef WORDS_BIGENDIAN */ 204 | # endif 205 | #endif 206 | 207 | /* Define to `unsigned int' if does not define. */ 208 | /* #undef size_t */ 209 | 210 | 211 | #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 212 | #ifdef LIBFFI_ASM 213 | #ifdef __APPLE__ 214 | #define FFI_HIDDEN(name) .private_extern name 215 | #else 216 | #define FFI_HIDDEN(name) .hidden name 217 | #endif 218 | #else 219 | #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) 220 | #endif 221 | #else 222 | #ifdef LIBFFI_ASM 223 | #define FFI_HIDDEN(name) 224 | #else 225 | #define FFI_HIDDEN 226 | #endif 227 | #endif 228 | 229 | 230 | 231 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/fficonfig_i386.h: -------------------------------------------------------------------------------- 1 | #ifdef __i386__ 2 | 3 | /* fficonfig.h. Generated from fficonfig.h.in by configure. */ 4 | /* fficonfig.h.in. Generated from configure.ac by autoheader. */ 5 | 6 | /* Define if building universal (internal helper macro) */ 7 | /* #undef AC_APPLE_UNIVERSAL_BUILD */ 8 | 9 | /* Define to 1 if using 'alloca.c'. */ 10 | /* #undef C_ALLOCA */ 11 | 12 | /* Define to the flags needed for the .section .eh_frame directive. */ 13 | #define EH_FRAME_FLAGS "a" 14 | 15 | /* Define this if you want extra debugging. */ 16 | /* #undef FFI_DEBUG */ 17 | 18 | /* Define this if you want statically defined trampolines */ 19 | /* #undef FFI_EXEC_STATIC_TRAMP */ 20 | 21 | /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ 22 | /* #undef FFI_EXEC_TRAMPOLINE_TABLE */ 23 | 24 | /* Define this if you want to enable pax emulated trampolines */ 25 | /* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */ 26 | 27 | /* Cannot use malloc on this target, so, we revert to alternative means */ 28 | #define FFI_MMAP_EXEC_WRIT 1 29 | 30 | /* Define this if you do not want support for the raw API. */ 31 | /* #undef FFI_NO_RAW_API */ 32 | 33 | /* Define this if you do not want support for aggregate types. */ 34 | /* #undef FFI_NO_STRUCTS */ 35 | 36 | /* Define to 1 if you have 'alloca', as a function or macro. */ 37 | #define HAVE_ALLOCA 1 38 | 39 | /* Define to 1 if works. */ 40 | #define HAVE_ALLOCA_H 1 41 | 42 | /* Define if your assembler supports .cfi_* directives. */ 43 | /* #undef HAVE_AS_CFI_PSEUDO_OP */ 44 | 45 | /* Define if your assembler supports .register. */ 46 | /* #undef HAVE_AS_REGISTER_PSEUDO_OP */ 47 | 48 | /* Define if the compiler uses zarch features. */ 49 | /* #undef HAVE_AS_S390_ZARCH */ 50 | 51 | /* Define if your assembler and linker support unaligned PC relative relocs. 52 | */ 53 | /* #undef HAVE_AS_SPARC_UA_PCREL */ 54 | 55 | /* Define if your assembler supports unwind section type. */ 56 | /* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ 57 | 58 | /* Define if your assembler supports PC relative relocs. */ 59 | #define HAVE_AS_X86_PCREL 1 60 | 61 | /* Define to 1 if you have the header file. */ 62 | #define HAVE_DLFCN_H 1 63 | 64 | /* Define if __attribute__((visibility("hidden"))) is supported. */ 65 | #define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_INTTYPES_H 1 69 | 70 | /* Define if you have the long double type and it is bigger than a double */ 71 | #define HAVE_LONG_DOUBLE 1 72 | 73 | /* Define if you support more than one size of the long double type */ 74 | /* #undef HAVE_LONG_DOUBLE_VARIANT */ 75 | 76 | /* Define to 1 if you have the `memcpy' function. */ 77 | #define HAVE_MEMCPY 1 78 | 79 | /* Define to 1 if you have the `memfd_create' function. */ 80 | /* #undef HAVE_MEMFD_CREATE */ 81 | 82 | /* Define to 1 if you have the `mkostemp' function. */ 83 | #define HAVE_MKOSTEMP 1 84 | 85 | /* Define to 1 if you have the `mkstemp' function. */ 86 | #define HAVE_MKSTEMP 1 87 | 88 | /* Define to 1 if you have the `mmap' function. */ 89 | #define HAVE_MMAP 1 90 | 91 | /* Define if mmap with MAP_ANON(YMOUS) works. */ 92 | #define HAVE_MMAP_ANON 1 93 | 94 | /* Define if mmap of /dev/zero works. */ 95 | /* #undef HAVE_MMAP_DEV_ZERO */ 96 | 97 | /* Define if read-only mmap of a plain file works. */ 98 | #define HAVE_MMAP_FILE 1 99 | 100 | /* Define if your compiler supports pointer authentication. */ 101 | /* #undef HAVE_PTRAUTH */ 102 | 103 | /* Define if .eh_frame sections should be read-only. */ 104 | #define HAVE_RO_EH_FRAME 1 105 | 106 | /* Define to 1 if you have the header file. */ 107 | #define HAVE_STDINT_H 1 108 | 109 | /* Define to 1 if you have the header file. */ 110 | #define HAVE_STDIO_H 1 111 | 112 | /* Define to 1 if you have the header file. */ 113 | #define HAVE_STDLIB_H 1 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #define HAVE_STRINGS_H 1 117 | 118 | /* Define to 1 if you have the header file. */ 119 | #define HAVE_STRING_H 1 120 | 121 | /* Define to 1 if you have the header file. */ 122 | /* #undef HAVE_SYS_MEMFD_H */ 123 | 124 | /* Define to 1 if you have the header file. */ 125 | #define HAVE_SYS_MMAN_H 1 126 | 127 | /* Define to 1 if you have the header file. */ 128 | #define HAVE_SYS_STAT_H 1 129 | 130 | /* Define to 1 if you have the header file. */ 131 | #define HAVE_SYS_TYPES_H 1 132 | 133 | /* Define to 1 if you have the header file. */ 134 | #define HAVE_UNISTD_H 1 135 | 136 | /* Define to 1 if GNU symbol versioning is used for libatomic. */ 137 | /* #undef LIBFFI_GNU_SYMBOL_VERSIONING */ 138 | 139 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 140 | #define LT_OBJDIR ".libs/" 141 | 142 | /* Name of package */ 143 | #define PACKAGE "libffi" 144 | 145 | /* Define to the address where bug reports for this package should be sent. */ 146 | #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues" 147 | 148 | /* Define to the full name of this package. */ 149 | #define PACKAGE_NAME "libffi" 150 | 151 | /* Define to the full name and version of this package. */ 152 | #define PACKAGE_STRING "libffi 3.4.2" 153 | 154 | /* Define to the one symbol short name of this package. */ 155 | #define PACKAGE_TARNAME "libffi" 156 | 157 | /* Define to the home page for this package. */ 158 | #define PACKAGE_URL "" 159 | 160 | /* Define to the version of this package. */ 161 | #define PACKAGE_VERSION "3.4.2" 162 | 163 | /* The size of `double', as computed by sizeof. */ 164 | #define SIZEOF_DOUBLE 8 165 | 166 | /* The size of `long double', as computed by sizeof. */ 167 | #define SIZEOF_LONG_DOUBLE 16 168 | 169 | /* The size of `size_t', as computed by sizeof. */ 170 | #define SIZEOF_SIZE_T 4 171 | 172 | /* If using the C implementation of alloca, define if you know the 173 | direction of stack growth for your system; otherwise it will be 174 | automatically deduced at runtime. 175 | STACK_DIRECTION > 0 => grows toward higher addresses 176 | STACK_DIRECTION < 0 => grows toward lower addresses 177 | STACK_DIRECTION = 0 => direction of growth unknown */ 178 | /* #undef STACK_DIRECTION */ 179 | 180 | /* Define to 1 if all of the C90 standard headers exist (not just the ones 181 | required in a freestanding environment). This macro is provided for 182 | backward compatibility; new code need not use it. */ 183 | #define STDC_HEADERS 1 184 | 185 | /* Define if symbols are underscored. */ 186 | #define SYMBOL_UNDERSCORE 1 187 | 188 | /* Define this if you are using Purify and want to suppress spurious messages. 189 | */ 190 | /* #undef USING_PURIFY */ 191 | 192 | /* Version number of package */ 193 | #define VERSION "3.4.2" 194 | 195 | /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 196 | significant byte first (like Motorola and SPARC, unlike Intel). */ 197 | #if defined AC_APPLE_UNIVERSAL_BUILD 198 | # if defined __BIG_ENDIAN__ 199 | # define WORDS_BIGENDIAN 1 200 | # endif 201 | #else 202 | # ifndef WORDS_BIGENDIAN 203 | /* # undef WORDS_BIGENDIAN */ 204 | # endif 205 | #endif 206 | 207 | /* Define to `unsigned int' if does not define. */ 208 | /* #undef size_t */ 209 | 210 | 211 | #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 212 | #ifdef LIBFFI_ASM 213 | #ifdef __APPLE__ 214 | #define FFI_HIDDEN(name) .private_extern name 215 | #else 216 | #define FFI_HIDDEN(name) .hidden name 217 | #endif 218 | #else 219 | #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) 220 | #endif 221 | #else 222 | #ifdef LIBFFI_ASM 223 | #define FFI_HIDDEN(name) 224 | #else 225 | #define FFI_HIDDEN 226 | #endif 227 | #endif 228 | 229 | 230 | 231 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/fficonfig_x86_64.h: -------------------------------------------------------------------------------- 1 | #ifdef __x86_64__ 2 | 3 | /* fficonfig.h. Generated from fficonfig.h.in by configure. */ 4 | /* fficonfig.h.in. Generated from configure.ac by autoheader. */ 5 | 6 | /* Define if building universal (internal helper macro) */ 7 | /* #undef AC_APPLE_UNIVERSAL_BUILD */ 8 | 9 | /* Define to 1 if using 'alloca.c'. */ 10 | /* #undef C_ALLOCA */ 11 | 12 | /* Define to the flags needed for the .section .eh_frame directive. */ 13 | #define EH_FRAME_FLAGS "a" 14 | 15 | /* Define this if you want extra debugging. */ 16 | /* #undef FFI_DEBUG */ 17 | 18 | /* Define this if you want statically defined trampolines */ 19 | /* #undef FFI_EXEC_STATIC_TRAMP */ 20 | 21 | /* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ 22 | /* #undef FFI_EXEC_TRAMPOLINE_TABLE */ 23 | 24 | /* Define this if you want to enable pax emulated trampolines */ 25 | /* #undef FFI_MMAP_EXEC_EMUTRAMP_PAX */ 26 | 27 | /* Cannot use malloc on this target, so, we revert to alternative means */ 28 | #define FFI_MMAP_EXEC_WRIT 1 29 | 30 | /* Define this if you do not want support for the raw API. */ 31 | /* #undef FFI_NO_RAW_API */ 32 | 33 | /* Define this if you do not want support for aggregate types. */ 34 | /* #undef FFI_NO_STRUCTS */ 35 | 36 | /* Define to 1 if you have 'alloca', as a function or macro. */ 37 | #define HAVE_ALLOCA 1 38 | 39 | /* Define to 1 if works. */ 40 | #define HAVE_ALLOCA_H 1 41 | 42 | /* Define if your assembler supports .cfi_* directives. */ 43 | /* #undef HAVE_AS_CFI_PSEUDO_OP */ 44 | 45 | /* Define if your assembler supports .register. */ 46 | /* #undef HAVE_AS_REGISTER_PSEUDO_OP */ 47 | 48 | /* Define if the compiler uses zarch features. */ 49 | /* #undef HAVE_AS_S390_ZARCH */ 50 | 51 | /* Define if your assembler and linker support unaligned PC relative relocs. 52 | */ 53 | /* #undef HAVE_AS_SPARC_UA_PCREL */ 54 | 55 | /* Define if your assembler supports unwind section type. */ 56 | /* #undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE */ 57 | 58 | /* Define if your assembler supports PC relative relocs. */ 59 | #define HAVE_AS_X86_PCREL 1 60 | 61 | /* Define to 1 if you have the header file. */ 62 | #define HAVE_DLFCN_H 1 63 | 64 | /* Define if __attribute__((visibility("hidden"))) is supported. */ 65 | #define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1 66 | 67 | /* Define to 1 if you have the header file. */ 68 | #define HAVE_INTTYPES_H 1 69 | 70 | /* Define if you have the long double type and it is bigger than a double */ 71 | #define HAVE_LONG_DOUBLE 1 72 | 73 | /* Define if you support more than one size of the long double type */ 74 | /* #undef HAVE_LONG_DOUBLE_VARIANT */ 75 | 76 | /* Define to 1 if you have the `memcpy' function. */ 77 | #define HAVE_MEMCPY 1 78 | 79 | /* Define to 1 if you have the `memfd_create' function. */ 80 | /* #undef HAVE_MEMFD_CREATE */ 81 | 82 | /* Define to 1 if you have the `mkostemp' function. */ 83 | #define HAVE_MKOSTEMP 1 84 | 85 | /* Define to 1 if you have the `mkstemp' function. */ 86 | #define HAVE_MKSTEMP 1 87 | 88 | /* Define to 1 if you have the `mmap' function. */ 89 | #define HAVE_MMAP 1 90 | 91 | /* Define if mmap with MAP_ANON(YMOUS) works. */ 92 | #define HAVE_MMAP_ANON 1 93 | 94 | /* Define if mmap of /dev/zero works. */ 95 | /* #undef HAVE_MMAP_DEV_ZERO */ 96 | 97 | /* Define if read-only mmap of a plain file works. */ 98 | #define HAVE_MMAP_FILE 1 99 | 100 | /* Define if your compiler supports pointer authentication. */ 101 | /* #undef HAVE_PTRAUTH */ 102 | 103 | /* Define if .eh_frame sections should be read-only. */ 104 | #define HAVE_RO_EH_FRAME 1 105 | 106 | /* Define to 1 if you have the header file. */ 107 | #define HAVE_STDINT_H 1 108 | 109 | /* Define to 1 if you have the header file. */ 110 | #define HAVE_STDIO_H 1 111 | 112 | /* Define to 1 if you have the header file. */ 113 | #define HAVE_STDLIB_H 1 114 | 115 | /* Define to 1 if you have the header file. */ 116 | #define HAVE_STRINGS_H 1 117 | 118 | /* Define to 1 if you have the header file. */ 119 | #define HAVE_STRING_H 1 120 | 121 | /* Define to 1 if you have the header file. */ 122 | /* #undef HAVE_SYS_MEMFD_H */ 123 | 124 | /* Define to 1 if you have the header file. */ 125 | #define HAVE_SYS_MMAN_H 1 126 | 127 | /* Define to 1 if you have the header file. */ 128 | #define HAVE_SYS_STAT_H 1 129 | 130 | /* Define to 1 if you have the header file. */ 131 | #define HAVE_SYS_TYPES_H 1 132 | 133 | /* Define to 1 if you have the header file. */ 134 | #define HAVE_UNISTD_H 1 135 | 136 | /* Define to 1 if GNU symbol versioning is used for libatomic. */ 137 | /* #undef LIBFFI_GNU_SYMBOL_VERSIONING */ 138 | 139 | /* Define to the sub-directory where libtool stores uninstalled libraries. */ 140 | #define LT_OBJDIR ".libs/" 141 | 142 | /* Name of package */ 143 | #define PACKAGE "libffi" 144 | 145 | /* Define to the address where bug reports for this package should be sent. */ 146 | #define PACKAGE_BUGREPORT "http://github.com/libffi/libffi/issues" 147 | 148 | /* Define to the full name of this package. */ 149 | #define PACKAGE_NAME "libffi" 150 | 151 | /* Define to the full name and version of this package. */ 152 | #define PACKAGE_STRING "libffi 3.4.2" 153 | 154 | /* Define to the one symbol short name of this package. */ 155 | #define PACKAGE_TARNAME "libffi" 156 | 157 | /* Define to the home page for this package. */ 158 | #define PACKAGE_URL "" 159 | 160 | /* Define to the version of this package. */ 161 | #define PACKAGE_VERSION "3.4.2" 162 | 163 | /* The size of `double', as computed by sizeof. */ 164 | #define SIZEOF_DOUBLE 8 165 | 166 | /* The size of `long double', as computed by sizeof. */ 167 | #define SIZEOF_LONG_DOUBLE 16 168 | 169 | /* The size of `size_t', as computed by sizeof. */ 170 | #define SIZEOF_SIZE_T 8 171 | 172 | /* If using the C implementation of alloca, define if you know the 173 | direction of stack growth for your system; otherwise it will be 174 | automatically deduced at runtime. 175 | STACK_DIRECTION > 0 => grows toward higher addresses 176 | STACK_DIRECTION < 0 => grows toward lower addresses 177 | STACK_DIRECTION = 0 => direction of growth unknown */ 178 | /* #undef STACK_DIRECTION */ 179 | 180 | /* Define to 1 if all of the C90 standard headers exist (not just the ones 181 | required in a freestanding environment). This macro is provided for 182 | backward compatibility; new code need not use it. */ 183 | #define STDC_HEADERS 1 184 | 185 | /* Define if symbols are underscored. */ 186 | #define SYMBOL_UNDERSCORE 1 187 | 188 | /* Define this if you are using Purify and want to suppress spurious messages. 189 | */ 190 | /* #undef USING_PURIFY */ 191 | 192 | /* Version number of package */ 193 | #define VERSION "3.4.2" 194 | 195 | /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most 196 | significant byte first (like Motorola and SPARC, unlike Intel). */ 197 | #if defined AC_APPLE_UNIVERSAL_BUILD 198 | # if defined __BIG_ENDIAN__ 199 | # define WORDS_BIGENDIAN 1 200 | # endif 201 | #else 202 | # ifndef WORDS_BIGENDIAN 203 | /* # undef WORDS_BIGENDIAN */ 204 | # endif 205 | #endif 206 | 207 | /* Define to `unsigned int' if does not define. */ 208 | /* #undef size_t */ 209 | 210 | 211 | #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 212 | #ifdef LIBFFI_ASM 213 | #ifdef __APPLE__ 214 | #define FFI_HIDDEN(name) .private_extern name 215 | #else 216 | #define FFI_HIDDEN(name) .hidden name 217 | #endif 218 | #else 219 | #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) 220 | #endif 221 | #else 222 | #ifdef LIBFFI_ASM 223 | #define FFI_HIDDEN(name) 224 | #else 225 | #define FFI_HIDDEN 226 | #endif 227 | #endif 228 | 229 | 230 | 231 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffitarget.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm64__ 2 | 3 | #if __has_include() 4 | #include 5 | #else 6 | #include "ffitarget_arm64.h" 7 | #endif 8 | 9 | 10 | #endif 11 | #ifdef __i386__ 12 | 13 | #if __has_include() 14 | #include 15 | #else 16 | #include "ffitarget_i386.h" 17 | #endif 18 | 19 | 20 | #endif 21 | #ifdef __arm__ 22 | 23 | #if __has_include() 24 | #include 25 | #else 26 | #include "ffitarget_armv7.h" 27 | #endif 28 | 29 | 30 | #endif 31 | #ifdef __x86_64__ 32 | 33 | #if __has_include() 34 | #include 35 | #else 36 | #include "ffitarget_x86_64.h" 37 | #endif 38 | 39 | 40 | #endif 41 | #ifdef __arm__ 42 | 43 | #if __has_include() 44 | #include 45 | #else 46 | #include "ffitarget_armv7k.h" 47 | #endif 48 | 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffitarget_arm64.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm64__ 2 | 3 | /* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | ``Software''), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 23 | 24 | #ifndef LIBFFI_TARGET_H 25 | #define LIBFFI_TARGET_H 26 | 27 | #ifndef LIBFFI_H 28 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 29 | #endif 30 | 31 | #ifndef LIBFFI_ASM 32 | #ifdef __ILP32__ 33 | #define FFI_SIZEOF_ARG 8 34 | #define FFI_SIZEOF_JAVA_RAW 4 35 | typedef unsigned long long ffi_arg; 36 | typedef signed long long ffi_sarg; 37 | #elif defined(_WIN32) 38 | #define FFI_SIZEOF_ARG 8 39 | typedef unsigned long long ffi_arg; 40 | typedef signed long long ffi_sarg; 41 | #else 42 | typedef unsigned long ffi_arg; 43 | typedef signed long ffi_sarg; 44 | #endif 45 | 46 | typedef enum ffi_abi 47 | { 48 | FFI_FIRST_ABI = 0, 49 | FFI_SYSV, 50 | FFI_WIN64, 51 | FFI_LAST_ABI, 52 | #if defined(_WIN32) 53 | FFI_DEFAULT_ABI = FFI_WIN64 54 | #else 55 | FFI_DEFAULT_ABI = FFI_SYSV 56 | #endif 57 | } ffi_abi; 58 | #endif 59 | 60 | /* ---- Definitions for closures ----------------------------------------- */ 61 | 62 | #define FFI_CLOSURES 1 63 | #define FFI_NATIVE_RAW_API 0 64 | 65 | #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE 66 | 67 | #ifdef __MACH__ 68 | #define FFI_TRAMPOLINE_SIZE 16 69 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET 16 70 | #else 71 | #error "No trampoline table implementation" 72 | #endif 73 | 74 | #else 75 | #define FFI_TRAMPOLINE_SIZE 24 76 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE 77 | #endif 78 | 79 | #ifdef _WIN32 80 | #define FFI_EXTRA_CIF_FIELDS unsigned is_variadic 81 | #endif 82 | #define FFI_TARGET_SPECIFIC_VARIADIC 83 | 84 | /* ---- Internal ---- */ 85 | 86 | #if defined (__APPLE__) 87 | #define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs 88 | #elif !defined(_WIN32) 89 | /* iOS and Windows reserve x18 for the system. Disable Go closures until 90 | a new static chain is chosen. */ 91 | #define FFI_GO_CLOSURES 1 92 | #endif 93 | 94 | #ifndef _WIN32 95 | /* No complex type on Windows */ 96 | #define FFI_TARGET_HAS_COMPLEX_TYPE 97 | #endif 98 | 99 | #endif 100 | 101 | 102 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffitarget_armv7.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm__ 2 | 3 | /* -----------------------------------------------------------------*-C-*- 4 | ffitarget.h - Copyright (c) 2012 Anthony Green 5 | Copyright (c) 2010 CodeSourcery 6 | Copyright (c) 1996-2003 Red Hat, Inc. 7 | 8 | Target configuration macros for ARM. 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | ``Software''), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included 19 | in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | DEALINGS IN THE SOFTWARE. 29 | 30 | ----------------------------------------------------------------------- */ 31 | 32 | #ifndef LIBFFI_TARGET_H 33 | #define LIBFFI_TARGET_H 34 | 35 | #ifndef LIBFFI_H 36 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 37 | #endif 38 | 39 | #ifndef LIBFFI_ASM 40 | typedef unsigned long ffi_arg; 41 | typedef signed long ffi_sarg; 42 | 43 | typedef enum ffi_abi { 44 | FFI_FIRST_ABI = 0, 45 | FFI_SYSV, 46 | FFI_VFP, 47 | FFI_LAST_ABI, 48 | #if defined(__ARM_PCS_VFP) || defined(_WIN32) 49 | FFI_DEFAULT_ABI = FFI_VFP, 50 | #else 51 | FFI_DEFAULT_ABI = FFI_SYSV, 52 | #endif 53 | } ffi_abi; 54 | #endif 55 | 56 | #define FFI_EXTRA_CIF_FIELDS \ 57 | int vfp_used; \ 58 | unsigned short vfp_reg_free, vfp_nargs; \ 59 | signed char vfp_args[16] \ 60 | 61 | #define FFI_TARGET_SPECIFIC_VARIADIC 62 | #ifndef _WIN32 63 | #define FFI_TARGET_HAS_COMPLEX_TYPE 64 | #endif 65 | 66 | /* ---- Definitions for closures ----------------------------------------- */ 67 | 68 | #define FFI_CLOSURES 1 69 | #define FFI_GO_CLOSURES 1 70 | #define FFI_NATIVE_RAW_API 0 71 | 72 | #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE 73 | 74 | #ifdef __MACH__ 75 | #define FFI_TRAMPOLINE_SIZE 12 76 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET 8 77 | #else 78 | #error "No trampoline table implementation" 79 | #endif 80 | 81 | #else 82 | #ifdef _WIN32 83 | #define FFI_TRAMPOLINE_SIZE 16 84 | #define FFI_TRAMPOLINE_CLOSURE_FUNCTION 12 85 | #else 86 | #define FFI_TRAMPOLINE_SIZE 12 87 | #endif 88 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE 89 | #endif 90 | 91 | #endif 92 | 93 | 94 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffitarget_armv7k.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm__ 2 | 3 | /* -----------------------------------------------------------------*-C-*- 4 | ffitarget.h - Copyright (c) 2012 Anthony Green 5 | Copyright (c) 2010 CodeSourcery 6 | Copyright (c) 1996-2003 Red Hat, Inc. 7 | 8 | Target configuration macros for ARM. 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | ``Software''), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included 19 | in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | DEALINGS IN THE SOFTWARE. 29 | 30 | ----------------------------------------------------------------------- */ 31 | 32 | #ifndef LIBFFI_TARGET_H 33 | #define LIBFFI_TARGET_H 34 | 35 | #ifndef LIBFFI_H 36 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 37 | #endif 38 | 39 | #ifndef LIBFFI_ASM 40 | typedef unsigned long ffi_arg; 41 | typedef signed long ffi_sarg; 42 | 43 | typedef enum ffi_abi { 44 | FFI_FIRST_ABI = 0, 45 | FFI_SYSV, 46 | FFI_VFP, 47 | FFI_LAST_ABI, 48 | #if defined(__ARM_PCS_VFP) || defined(_WIN32) 49 | FFI_DEFAULT_ABI = FFI_VFP, 50 | #else 51 | FFI_DEFAULT_ABI = FFI_SYSV, 52 | #endif 53 | } ffi_abi; 54 | #endif 55 | 56 | #define FFI_EXTRA_CIF_FIELDS \ 57 | int vfp_used; \ 58 | unsigned short vfp_reg_free, vfp_nargs; \ 59 | signed char vfp_args[16] \ 60 | 61 | #define FFI_TARGET_SPECIFIC_VARIADIC 62 | #ifndef _WIN32 63 | #define FFI_TARGET_HAS_COMPLEX_TYPE 64 | #endif 65 | 66 | /* ---- Definitions for closures ----------------------------------------- */ 67 | 68 | #define FFI_CLOSURES 1 69 | #define FFI_GO_CLOSURES 1 70 | #define FFI_NATIVE_RAW_API 0 71 | 72 | #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE 73 | 74 | #ifdef __MACH__ 75 | #define FFI_TRAMPOLINE_SIZE 12 76 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET 8 77 | #else 78 | #error "No trampoline table implementation" 79 | #endif 80 | 81 | #else 82 | #ifdef _WIN32 83 | #define FFI_TRAMPOLINE_SIZE 16 84 | #define FFI_TRAMPOLINE_CLOSURE_FUNCTION 12 85 | #else 86 | #define FFI_TRAMPOLINE_SIZE 12 87 | #endif 88 | #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE 89 | #endif 90 | 91 | #endif 92 | 93 | 94 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffitarget_i386.h: -------------------------------------------------------------------------------- 1 | #ifdef __i386__ 2 | 3 | /* -----------------------------------------------------------------*-C-*- 4 | ffitarget.h - Copyright (c) 2012, 2014, 2018 Anthony Green 5 | Copyright (c) 1996-2003, 2010 Red Hat, Inc. 6 | Copyright (C) 2008 Free Software Foundation, Inc. 7 | 8 | Target configuration macros for x86 and x86-64. 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | ``Software''), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included 19 | in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | DEALINGS IN THE SOFTWARE. 29 | 30 | ----------------------------------------------------------------------- */ 31 | 32 | #ifndef LIBFFI_TARGET_H 33 | #define LIBFFI_TARGET_H 34 | 35 | #ifndef LIBFFI_H 36 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 37 | #endif 38 | 39 | /* ---- System specific configurations ----------------------------------- */ 40 | 41 | /* For code common to all platforms on x86 and x86_64. */ 42 | #define X86_ANY 43 | 44 | #if defined (X86_64) && defined (__i386__) 45 | #undef X86_64 46 | #define X86 47 | #endif 48 | 49 | #ifdef X86_WIN64 50 | #define FFI_SIZEOF_ARG 8 51 | #define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ 52 | #endif 53 | 54 | #define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION 55 | #ifndef _MSC_VER 56 | #define FFI_TARGET_HAS_COMPLEX_TYPE 57 | #endif 58 | 59 | /* ---- Generic type definitions ----------------------------------------- */ 60 | 61 | #ifndef LIBFFI_ASM 62 | #ifdef X86_WIN64 63 | #ifdef _MSC_VER 64 | typedef unsigned __int64 ffi_arg; 65 | typedef __int64 ffi_sarg; 66 | #else 67 | typedef unsigned long long ffi_arg; 68 | typedef long long ffi_sarg; 69 | #endif 70 | #else 71 | #if defined __x86_64__ && defined __ILP32__ 72 | #define FFI_SIZEOF_ARG 8 73 | #define FFI_SIZEOF_JAVA_RAW 4 74 | typedef unsigned long long ffi_arg; 75 | typedef long long ffi_sarg; 76 | #else 77 | typedef unsigned long ffi_arg; 78 | typedef signed long ffi_sarg; 79 | #endif 80 | #endif 81 | 82 | typedef enum ffi_abi { 83 | #if defined(X86_WIN64) 84 | FFI_FIRST_ABI = 0, 85 | FFI_WIN64, /* sizeof(long double) == 8 - microsoft compilers */ 86 | FFI_GNUW64, /* sizeof(long double) == 16 - GNU compilers */ 87 | FFI_LAST_ABI, 88 | #ifdef __GNUC__ 89 | FFI_DEFAULT_ABI = FFI_GNUW64 90 | #else 91 | FFI_DEFAULT_ABI = FFI_WIN64 92 | #endif 93 | 94 | #elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) 95 | FFI_FIRST_ABI = 1, 96 | FFI_UNIX64, 97 | FFI_WIN64, 98 | FFI_EFI64 = FFI_WIN64, 99 | FFI_GNUW64, 100 | FFI_LAST_ABI, 101 | FFI_DEFAULT_ABI = FFI_UNIX64 102 | 103 | #elif defined(X86_WIN32) 104 | FFI_FIRST_ABI = 0, 105 | FFI_SYSV = 1, 106 | FFI_STDCALL = 2, 107 | FFI_THISCALL = 3, 108 | FFI_FASTCALL = 4, 109 | FFI_MS_CDECL = 5, 110 | FFI_PASCAL = 6, 111 | FFI_REGISTER = 7, 112 | FFI_LAST_ABI, 113 | FFI_DEFAULT_ABI = FFI_MS_CDECL 114 | #else 115 | FFI_FIRST_ABI = 0, 116 | FFI_SYSV = 1, 117 | FFI_THISCALL = 3, 118 | FFI_FASTCALL = 4, 119 | FFI_STDCALL = 5, 120 | FFI_PASCAL = 6, 121 | FFI_REGISTER = 7, 122 | FFI_MS_CDECL = 8, 123 | FFI_LAST_ABI, 124 | FFI_DEFAULT_ABI = FFI_SYSV 125 | #endif 126 | } ffi_abi; 127 | #endif 128 | 129 | /* ---- Definitions for closures ----------------------------------------- */ 130 | 131 | #define FFI_CLOSURES 1 132 | #define FFI_GO_CLOSURES 1 133 | 134 | #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) 135 | #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) 136 | #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) 137 | #define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) 138 | 139 | #if defined (X86_64) || defined(X86_WIN64) \ 140 | || (defined (__x86_64__) && defined (X86_DARWIN)) 141 | /* 4 bytes of ENDBR64 + 7 bytes of LEA + 6 bytes of JMP + 7 bytes of NOP 142 | + 8 bytes of pointer. */ 143 | # define FFI_TRAMPOLINE_SIZE 32 144 | # define FFI_NATIVE_RAW_API 0 145 | #else 146 | /* 4 bytes of ENDBR32 + 5 bytes of MOV + 5 bytes of JMP + 2 unused 147 | bytes. */ 148 | # define FFI_TRAMPOLINE_SIZE 16 149 | # define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ 150 | #endif 151 | 152 | #if !defined(GENERATE_LIBFFI_MAP) && defined(__CET__) 153 | # include 154 | # if (__CET__ & 1) != 0 155 | # define ENDBR_PRESENT 156 | # endif 157 | # define _CET_NOTRACK notrack 158 | #else 159 | # define _CET_ENDBR 160 | # define _CET_NOTRACK 161 | #endif 162 | 163 | #endif 164 | 165 | 166 | 167 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/ffitarget_x86_64.h: -------------------------------------------------------------------------------- 1 | #ifdef __x86_64__ 2 | 3 | /* -----------------------------------------------------------------*-C-*- 4 | ffitarget.h - Copyright (c) 2012, 2014, 2018 Anthony Green 5 | Copyright (c) 1996-2003, 2010 Red Hat, Inc. 6 | Copyright (C) 2008 Free Software Foundation, Inc. 7 | 8 | Target configuration macros for x86 and x86-64. 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining 11 | a copy of this software and associated documentation files (the 12 | ``Software''), to deal in the Software without restriction, including 13 | without limitation the rights to use, copy, modify, merge, publish, 14 | distribute, sublicense, and/or sell copies of the Software, and to 15 | permit persons to whom the Software is furnished to do so, subject to 16 | the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included 19 | in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 | DEALINGS IN THE SOFTWARE. 29 | 30 | ----------------------------------------------------------------------- */ 31 | 32 | #ifndef LIBFFI_TARGET_H 33 | #define LIBFFI_TARGET_H 34 | 35 | #ifndef LIBFFI_H 36 | #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." 37 | #endif 38 | 39 | /* ---- System specific configurations ----------------------------------- */ 40 | 41 | /* For code common to all platforms on x86 and x86_64. */ 42 | #define X86_ANY 43 | 44 | #if defined (X86_64) && defined (__i386__) 45 | #undef X86_64 46 | #define X86 47 | #endif 48 | 49 | #ifdef X86_WIN64 50 | #define FFI_SIZEOF_ARG 8 51 | #define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ 52 | #endif 53 | 54 | #define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION 55 | #ifndef _MSC_VER 56 | #define FFI_TARGET_HAS_COMPLEX_TYPE 57 | #endif 58 | 59 | /* ---- Generic type definitions ----------------------------------------- */ 60 | 61 | #ifndef LIBFFI_ASM 62 | #ifdef X86_WIN64 63 | #ifdef _MSC_VER 64 | typedef unsigned __int64 ffi_arg; 65 | typedef __int64 ffi_sarg; 66 | #else 67 | typedef unsigned long long ffi_arg; 68 | typedef long long ffi_sarg; 69 | #endif 70 | #else 71 | #if defined __x86_64__ && defined __ILP32__ 72 | #define FFI_SIZEOF_ARG 8 73 | #define FFI_SIZEOF_JAVA_RAW 4 74 | typedef unsigned long long ffi_arg; 75 | typedef long long ffi_sarg; 76 | #else 77 | typedef unsigned long ffi_arg; 78 | typedef signed long ffi_sarg; 79 | #endif 80 | #endif 81 | 82 | typedef enum ffi_abi { 83 | #if defined(X86_WIN64) 84 | FFI_FIRST_ABI = 0, 85 | FFI_WIN64, /* sizeof(long double) == 8 - microsoft compilers */ 86 | FFI_GNUW64, /* sizeof(long double) == 16 - GNU compilers */ 87 | FFI_LAST_ABI, 88 | #ifdef __GNUC__ 89 | FFI_DEFAULT_ABI = FFI_GNUW64 90 | #else 91 | FFI_DEFAULT_ABI = FFI_WIN64 92 | #endif 93 | 94 | #elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) 95 | FFI_FIRST_ABI = 1, 96 | FFI_UNIX64, 97 | FFI_WIN64, 98 | FFI_EFI64 = FFI_WIN64, 99 | FFI_GNUW64, 100 | FFI_LAST_ABI, 101 | FFI_DEFAULT_ABI = FFI_UNIX64 102 | 103 | #elif defined(X86_WIN32) 104 | FFI_FIRST_ABI = 0, 105 | FFI_SYSV = 1, 106 | FFI_STDCALL = 2, 107 | FFI_THISCALL = 3, 108 | FFI_FASTCALL = 4, 109 | FFI_MS_CDECL = 5, 110 | FFI_PASCAL = 6, 111 | FFI_REGISTER = 7, 112 | FFI_LAST_ABI, 113 | FFI_DEFAULT_ABI = FFI_MS_CDECL 114 | #else 115 | FFI_FIRST_ABI = 0, 116 | FFI_SYSV = 1, 117 | FFI_THISCALL = 3, 118 | FFI_FASTCALL = 4, 119 | FFI_STDCALL = 5, 120 | FFI_PASCAL = 6, 121 | FFI_REGISTER = 7, 122 | FFI_MS_CDECL = 8, 123 | FFI_LAST_ABI, 124 | FFI_DEFAULT_ABI = FFI_SYSV 125 | #endif 126 | } ffi_abi; 127 | #endif 128 | 129 | /* ---- Definitions for closures ----------------------------------------- */ 130 | 131 | #define FFI_CLOSURES 1 132 | #define FFI_GO_CLOSURES 1 133 | 134 | #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) 135 | #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) 136 | #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) 137 | #define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) 138 | 139 | #if defined (X86_64) || defined(X86_WIN64) \ 140 | || (defined (__x86_64__) && defined (X86_DARWIN)) 141 | /* 4 bytes of ENDBR64 + 7 bytes of LEA + 6 bytes of JMP + 7 bytes of NOP 142 | + 8 bytes of pointer. */ 143 | # define FFI_TRAMPOLINE_SIZE 32 144 | # define FFI_NATIVE_RAW_API 0 145 | #else 146 | /* 4 bytes of ENDBR32 + 5 bytes of MOV + 5 bytes of JMP + 2 unused 147 | bytes. */ 148 | # define FFI_TRAMPOLINE_SIZE 16 149 | # define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ 150 | #endif 151 | 152 | #if !defined(GENERATE_LIBFFI_MAP) && defined(__CET__) 153 | # include 154 | # if (__CET__ & 1) != 0 155 | # define ENDBR_PRESENT 156 | # endif 157 | # define _CET_NOTRACK notrack 158 | #else 159 | # define _CET_ENDBR 160 | # define _CET_NOTRACK 161 | #endif 162 | 163 | #endif 164 | 165 | 166 | 167 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/include/tramp.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | ffi_tramp.h - Copyright (C) 2021 Microsoft, Inc. 3 | 4 | Static trampoline definitions. 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the ``Software''), to deal in the Software without 9 | restriction, including without limitation the rights to use, copy, 10 | modify, merge, publish, distribute, sublicense, and/or sell copies 11 | of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | 26 | ----------------------------------------------------------------------- */ 27 | 28 | #ifndef FFI_TRAMP_H 29 | #define FFI_TRAMP_H 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | int ffi_tramp_is_supported(void); 36 | void *ffi_tramp_alloc (int flags); 37 | void ffi_tramp_set_parms (void *tramp, void *data, void *code); 38 | void *ffi_tramp_get_addr (void *tramp); 39 | void ffi_tramp_free (void *tramp); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* FFI_TRAMP_H */ 46 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/aarch64/internal_arm64.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm64__ 2 | 3 | /* 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | ``Software''), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 22 | 23 | #define AARCH64_RET_VOID 0 24 | #define AARCH64_RET_INT64 1 25 | #define AARCH64_RET_INT128 2 26 | 27 | #define AARCH64_RET_UNUSED3 3 28 | #define AARCH64_RET_UNUSED4 4 29 | #define AARCH64_RET_UNUSED5 5 30 | #define AARCH64_RET_UNUSED6 6 31 | #define AARCH64_RET_UNUSED7 7 32 | 33 | /* Note that FFI_TYPE_FLOAT == 2, _DOUBLE == 3, _LONGDOUBLE == 4, 34 | so _S4 through _Q1 are layed out as (TYPE * 4) + (4 - COUNT). */ 35 | #define AARCH64_RET_S4 8 36 | #define AARCH64_RET_S3 9 37 | #define AARCH64_RET_S2 10 38 | #define AARCH64_RET_S1 11 39 | 40 | #define AARCH64_RET_D4 12 41 | #define AARCH64_RET_D3 13 42 | #define AARCH64_RET_D2 14 43 | #define AARCH64_RET_D1 15 44 | 45 | #define AARCH64_RET_Q4 16 46 | #define AARCH64_RET_Q3 17 47 | #define AARCH64_RET_Q2 18 48 | #define AARCH64_RET_Q1 19 49 | 50 | /* Note that each of the sub-64-bit integers gets two entries. */ 51 | #define AARCH64_RET_UINT8 20 52 | #define AARCH64_RET_UINT16 22 53 | #define AARCH64_RET_UINT32 24 54 | 55 | #define AARCH64_RET_SINT8 26 56 | #define AARCH64_RET_SINT16 28 57 | #define AARCH64_RET_SINT32 30 58 | 59 | #define AARCH64_RET_MASK 31 60 | 61 | #define AARCH64_RET_IN_MEM (1 << 5) 62 | #define AARCH64_RET_NEED_COPY (1 << 6) 63 | 64 | #define AARCH64_FLAG_ARG_V_BIT 7 65 | #define AARCH64_FLAG_ARG_V (1 << AARCH64_FLAG_ARG_V_BIT) 66 | #define AARCH64_FLAG_VARARG (1 << 8) 67 | 68 | #define N_X_ARG_REG 8 69 | #define N_V_ARG_REG 8 70 | #define CALL_CONTEXT_SIZE (N_V_ARG_REG * 16 + N_X_ARG_REG * 8) 71 | 72 | #if defined(FFI_EXEC_STATIC_TRAMP) 73 | /* 74 | * For the trampoline code table mapping, a mapping size of 16K is chosen to 75 | * cover the base page sizes of 4K and 16K. 76 | */ 77 | #define AARCH64_TRAMP_MAP_SHIFT 14 78 | #define AARCH64_TRAMP_MAP_SIZE (1 << AARCH64_TRAMP_MAP_SHIFT) 79 | #define AARCH64_TRAMP_SIZE 32 80 | 81 | #endif 82 | 83 | /* Helpers for writing assembly compatible with arm ptr auth */ 84 | #ifdef LIBFFI_ASM 85 | 86 | #ifdef HAVE_PTRAUTH 87 | #define SIGN_LR pacibsp 88 | #define SIGN_LR_WITH_REG(x) pacib lr, x 89 | #define AUTH_LR_AND_RET retab 90 | #define AUTH_LR_WITH_REG(x) autib lr, x 91 | #define BRANCH_AND_LINK_TO_REG blraaz 92 | #define BRANCH_TO_REG braaz 93 | #else 94 | #define SIGN_LR 95 | #define SIGN_LR_WITH_REG(x) 96 | #define AUTH_LR_AND_RET ret 97 | #define AUTH_LR_WITH_REG(x) 98 | #define BRANCH_AND_LINK_TO_REG blr 99 | #define BRANCH_TO_REG br 100 | #endif 101 | 102 | #endif 103 | 104 | 105 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/arm/internal_arm.h: -------------------------------------------------------------------------------- 1 | #ifdef __arm__ 2 | 3 | #define ARM_TYPE_VFP_S 0 4 | #define ARM_TYPE_VFP_D 1 5 | #define ARM_TYPE_VFP_N 2 6 | #define ARM_TYPE_INT64 3 7 | #define ARM_TYPE_INT 4 8 | #define ARM_TYPE_VOID 5 9 | #define ARM_TYPE_STRUCT 6 10 | 11 | #if defined(FFI_EXEC_STATIC_TRAMP) 12 | /* 13 | * For the trampoline table mapping, a mapping size of 4K (base page size) 14 | * is chosen. 15 | */ 16 | #define ARM_TRAMP_MAP_SHIFT 12 17 | #define ARM_TRAMP_MAP_SIZE (1 << ARM_TRAMP_MAP_SHIFT) 18 | #define ARM_TRAMP_SIZE 20 19 | #endif 20 | 21 | 22 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/common/debug.c: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | debug.c - Copyright (c) 1996 Red Hat, Inc. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | ``Software''), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included 13 | in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22 | DEALINGS IN THE SOFTWARE. 23 | ----------------------------------------------------------------------- */ 24 | 25 | #if __has_include() 26 | #include 27 | #else 28 | #include "ffi.h" 29 | #endif 30 | 31 | #if __has_include() 32 | #include 33 | #else 34 | #include "ffi_common.h" 35 | #endif 36 | 37 | #include 38 | #include 39 | 40 | /* General debugging routines */ 41 | 42 | void ffi_stop_here(void) 43 | { 44 | /* This function is only useful for debugging purposes. 45 | Place a breakpoint on ffi_stop_here to be notified of 46 | significant events. */ 47 | } 48 | 49 | /* This function should only be called via the FFI_ASSERT() macro */ 50 | 51 | void ffi_assert(char *expr, char *file, int line) 52 | { 53 | fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); 54 | ffi_stop_here(); 55 | abort(); 56 | } 57 | 58 | /* Perform a sanity check on an ffi_type structure */ 59 | 60 | void ffi_type_test(ffi_type *a, char *file, int line) 61 | { 62 | FFI_ASSERT_AT(a != NULL, file, line); 63 | 64 | FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line); 65 | FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line); 66 | FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line); 67 | FFI_ASSERT_AT((a->type != FFI_TYPE_STRUCT && a->type != FFI_TYPE_COMPLEX) 68 | || a->elements != NULL, file, line); 69 | FFI_ASSERT_AT(a->type != FFI_TYPE_COMPLEX 70 | || (a->elements != NULL 71 | && a->elements[0] != NULL && a->elements[1] == NULL), 72 | file, line); 73 | 74 | } 75 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/common/ffi_common.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | ffi_common.h - Copyright (C) 2011, 2012, 2013 Anthony Green 3 | Copyright (C) 2007 Free Software Foundation, Inc 4 | Copyright (c) 1996 Red Hat, Inc. 5 | 6 | Common internal definitions and macros. Only necessary for building 7 | libffi. 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the ``Software''), to deal in the Software without 12 | restriction, including without limitation the rights to use, copy, 13 | modify, merge, publish, distribute, sublicense, and/or sell copies 14 | of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be 18 | included in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 24 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 25 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 | DEALINGS IN THE SOFTWARE. 28 | 29 | ----------------------------------------------------------------------- */ 30 | 31 | #ifndef FFI_COMMON_H 32 | #define FFI_COMMON_H 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | #if __has_include() 39 | #include 40 | #else 41 | #include "fficonfig.h" 42 | #endif 43 | 44 | /* Do not move this. Some versions of AIX are very picky about where 45 | this is positioned. */ 46 | #ifdef __GNUC__ 47 | # if HAVE_ALLOCA_H 48 | # include 49 | # else 50 | /* mingw64 defines this already in malloc.h. */ 51 | # ifndef alloca 52 | # define alloca __builtin_alloca 53 | # endif 54 | # endif 55 | # define MAYBE_UNUSED __attribute__((__unused__)) 56 | #else 57 | # define MAYBE_UNUSED 58 | # if HAVE_ALLOCA_H 59 | # include 60 | # else 61 | # ifdef _AIX 62 | # pragma alloca 63 | # else 64 | # ifndef alloca /* predefined by HP cc +Olibcalls */ 65 | # ifdef _MSC_VER 66 | # define alloca _alloca 67 | # else 68 | char *alloca (); 69 | # endif 70 | # endif 71 | # endif 72 | # endif 73 | #endif 74 | 75 | /* Check for the existence of memcpy. */ 76 | #if STDC_HEADERS 77 | # include 78 | #else 79 | # ifndef HAVE_MEMCPY 80 | # define memcpy(d, s, n) bcopy ((s), (d), (n)) 81 | # endif 82 | #endif 83 | 84 | #if defined(FFI_DEBUG) 85 | #include 86 | #endif 87 | 88 | #ifdef FFI_DEBUG 89 | void ffi_assert(char *expr, char *file, int line); 90 | void ffi_stop_here(void); 91 | void ffi_type_test(ffi_type *a, char *file, int line); 92 | 93 | #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) 94 | #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) 95 | #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) 96 | #else 97 | #define FFI_ASSERT(x) 98 | #define FFI_ASSERT_AT(x, f, l) 99 | #define FFI_ASSERT_VALID_TYPE(x) 100 | #endif 101 | 102 | /* v cast to size_t and aligned up to a multiple of a */ 103 | #define FFI_ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) 104 | /* v cast to size_t and aligned down to a multiple of a */ 105 | #define FFI_ALIGN_DOWN(v, a) (((size_t) (v)) & -a) 106 | 107 | /* Perform machine dependent cif processing */ 108 | ffi_status ffi_prep_cif_machdep(ffi_cif *cif); 109 | ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, 110 | unsigned int nfixedargs, unsigned int ntotalargs); 111 | 112 | 113 | #if HAVE_LONG_DOUBLE_VARIANT 114 | /* Used to adjust size/alignment of ffi types. */ 115 | void ffi_prep_types (ffi_abi abi); 116 | #endif 117 | 118 | /* Used internally, but overridden by some architectures */ 119 | ffi_status ffi_prep_cif_core(ffi_cif *cif, 120 | ffi_abi abi, 121 | unsigned int isvariadic, 122 | unsigned int nfixedargs, 123 | unsigned int ntotalargs, 124 | ffi_type *rtype, 125 | ffi_type **atypes); 126 | 127 | /* Translate a data pointer to a code pointer. Needed for closures on 128 | some targets. */ 129 | void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN; 130 | 131 | /* The arch code calls this to determine if a given closure has a 132 | static trampoline. */ 133 | int ffi_tramp_is_present (void *closure) FFI_HIDDEN; 134 | 135 | /* Extended cif, used in callback from assembly routine */ 136 | typedef struct 137 | { 138 | ffi_cif *cif; 139 | void *rvalue; 140 | void **avalue; 141 | } extended_cif; 142 | 143 | /* Terse sized type definitions. */ 144 | #if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) 145 | typedef unsigned char UINT8; 146 | typedef signed char SINT8; 147 | typedef unsigned short UINT16; 148 | typedef signed short SINT16; 149 | typedef unsigned int UINT32; 150 | typedef signed int SINT32; 151 | # ifdef _MSC_VER 152 | typedef unsigned __int64 UINT64; 153 | typedef signed __int64 SINT64; 154 | # else 155 | # include 156 | typedef uint64_t UINT64; 157 | typedef int64_t SINT64; 158 | # endif 159 | #else 160 | typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); 161 | typedef signed int SINT8 __attribute__((__mode__(__QI__))); 162 | typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); 163 | typedef signed int SINT16 __attribute__((__mode__(__HI__))); 164 | typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); 165 | typedef signed int SINT32 __attribute__((__mode__(__SI__))); 166 | typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); 167 | typedef signed int SINT64 __attribute__((__mode__(__DI__))); 168 | #endif 169 | 170 | typedef float FLOAT32; 171 | 172 | #ifndef __GNUC__ 173 | #define __builtin_expect(x, expected_value) (x) 174 | #endif 175 | #define LIKELY(x) __builtin_expect(!!(x),1) 176 | #define UNLIKELY(x) __builtin_expect((x)!=0,0) 177 | 178 | #ifdef __cplusplus 179 | } 180 | #endif 181 | 182 | #endif 183 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/common/prep_cif.c: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | prep_cif.c - Copyright (c) 2011, 2012, 2021 Anthony Green 3 | Copyright (c) 1996, 1998, 2007 Red Hat, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | ``Software''), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | ----------------------------------------------------------------------- */ 25 | 26 | #if __has_include() 27 | #include 28 | #else 29 | #include "ffi.h" 30 | #endif 31 | 32 | #if __has_include() 33 | #include 34 | #else 35 | #include "ffi_common.h" 36 | #endif 37 | 38 | #include 39 | 40 | /* Round up to FFI_SIZEOF_ARG. */ 41 | 42 | #define STACK_ARG_SIZE(x) FFI_ALIGN(x, FFI_SIZEOF_ARG) 43 | 44 | /* Perform machine independent initialization of aggregate type 45 | specifications. */ 46 | 47 | static ffi_status initialize_aggregate(ffi_type *arg, size_t *offsets) 48 | { 49 | ffi_type **ptr; 50 | 51 | if (UNLIKELY(arg == NULL || arg->elements == NULL)) 52 | return FFI_BAD_TYPEDEF; 53 | 54 | arg->size = 0; 55 | arg->alignment = 0; 56 | 57 | ptr = &(arg->elements[0]); 58 | 59 | if (UNLIKELY(ptr == 0)) 60 | return FFI_BAD_TYPEDEF; 61 | 62 | while ((*ptr) != NULL) 63 | { 64 | if (UNLIKELY(((*ptr)->size == 0) 65 | && (initialize_aggregate((*ptr), NULL) != FFI_OK))) 66 | return FFI_BAD_TYPEDEF; 67 | 68 | /* Perform a sanity check on the argument type */ 69 | FFI_ASSERT_VALID_TYPE(*ptr); 70 | 71 | arg->size = FFI_ALIGN(arg->size, (*ptr)->alignment); 72 | if (offsets) 73 | *offsets++ = arg->size; 74 | arg->size += (*ptr)->size; 75 | 76 | arg->alignment = (arg->alignment > (*ptr)->alignment) ? 77 | arg->alignment : (*ptr)->alignment; 78 | 79 | ptr++; 80 | } 81 | 82 | /* Structure size includes tail padding. This is important for 83 | structures that fit in one register on ABIs like the PowerPC64 84 | Linux ABI that right justify small structs in a register. 85 | It's also needed for nested structure layout, for example 86 | struct A { long a; char b; }; struct B { struct A x; char y; }; 87 | should find y at an offset of 2*sizeof(long) and result in a 88 | total size of 3*sizeof(long). */ 89 | arg->size = FFI_ALIGN (arg->size, arg->alignment); 90 | 91 | /* On some targets, the ABI defines that structures have an additional 92 | alignment beyond the "natural" one based on their elements. */ 93 | #ifdef FFI_AGGREGATE_ALIGNMENT 94 | if (FFI_AGGREGATE_ALIGNMENT > arg->alignment) 95 | arg->alignment = FFI_AGGREGATE_ALIGNMENT; 96 | #endif 97 | 98 | if (arg->size == 0) 99 | return FFI_BAD_TYPEDEF; 100 | else 101 | return FFI_OK; 102 | } 103 | 104 | #ifndef __CRIS__ 105 | /* The CRIS ABI specifies structure elements to have byte 106 | alignment only, so it completely overrides this functions, 107 | which assumes "natural" alignment and padding. */ 108 | 109 | /* Perform machine independent ffi_cif preparation, then call 110 | machine dependent routine. */ 111 | 112 | /* For non variadic functions isvariadic should be 0 and 113 | nfixedargs==ntotalargs. 114 | 115 | For variadic calls, isvariadic should be 1 and nfixedargs 116 | and ntotalargs set as appropriate. nfixedargs must always be >=1 */ 117 | 118 | 119 | ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi, 120 | unsigned int isvariadic, 121 | unsigned int nfixedargs, 122 | unsigned int ntotalargs, 123 | ffi_type *rtype, ffi_type **atypes) 124 | { 125 | unsigned bytes = 0; 126 | unsigned int i; 127 | ffi_type **ptr; 128 | 129 | FFI_ASSERT(cif != NULL); 130 | FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); 131 | FFI_ASSERT(nfixedargs <= ntotalargs); 132 | 133 | if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)) 134 | return FFI_BAD_ABI; 135 | 136 | cif->abi = abi; 137 | cif->arg_types = atypes; 138 | cif->nargs = ntotalargs; 139 | cif->rtype = rtype; 140 | 141 | cif->flags = 0; 142 | #if (defined(_M_ARM64) || defined(__aarch64__)) && defined(_WIN32) 143 | cif->is_variadic = isvariadic; 144 | #endif 145 | #if HAVE_LONG_DOUBLE_VARIANT 146 | ffi_prep_types (abi); 147 | #endif 148 | 149 | /* Initialize the return type if necessary */ 150 | if ((cif->rtype->size == 0) 151 | && (initialize_aggregate(cif->rtype, NULL) != FFI_OK)) 152 | return FFI_BAD_TYPEDEF; 153 | 154 | #ifndef FFI_TARGET_HAS_COMPLEX_TYPE 155 | if (rtype->type == FFI_TYPE_COMPLEX) 156 | abort(); 157 | #endif 158 | /* Perform a sanity check on the return type */ 159 | FFI_ASSERT_VALID_TYPE(cif->rtype); 160 | 161 | /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ 162 | #if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION 163 | /* Make space for the return structure pointer */ 164 | if (cif->rtype->type == FFI_TYPE_STRUCT 165 | #ifdef TILE 166 | && (cif->rtype->size > 10 * FFI_SIZEOF_ARG) 167 | #endif 168 | #ifdef XTENSA 169 | && (cif->rtype->size > 16) 170 | #endif 171 | #ifdef NIOS2 172 | && (cif->rtype->size > 8) 173 | #endif 174 | ) 175 | bytes = STACK_ARG_SIZE(sizeof(void*)); 176 | #endif 177 | 178 | for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) 179 | { 180 | 181 | /* Initialize any uninitialized aggregate type definitions */ 182 | if (((*ptr)->size == 0) 183 | && (initialize_aggregate((*ptr), NULL) != FFI_OK)) 184 | return FFI_BAD_TYPEDEF; 185 | 186 | #ifndef FFI_TARGET_HAS_COMPLEX_TYPE 187 | if ((*ptr)->type == FFI_TYPE_COMPLEX) 188 | abort(); 189 | #endif 190 | /* Perform a sanity check on the argument type, do this 191 | check after the initialization. */ 192 | FFI_ASSERT_VALID_TYPE(*ptr); 193 | 194 | #if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION 195 | { 196 | /* Add any padding if necessary */ 197 | if (((*ptr)->alignment - 1) & bytes) 198 | bytes = (unsigned)FFI_ALIGN(bytes, (*ptr)->alignment); 199 | 200 | #ifdef TILE 201 | if (bytes < 10 * FFI_SIZEOF_ARG && 202 | bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG) 203 | { 204 | /* An argument is never split between the 10 parameter 205 | registers and the stack. */ 206 | bytes = 10 * FFI_SIZEOF_ARG; 207 | } 208 | #endif 209 | #ifdef XTENSA 210 | if (bytes <= 6*4 && bytes + STACK_ARG_SIZE((*ptr)->size) > 6*4) 211 | bytes = 6*4; 212 | #endif 213 | 214 | bytes += (unsigned int)STACK_ARG_SIZE((*ptr)->size); 215 | } 216 | #endif 217 | } 218 | 219 | cif->bytes = bytes; 220 | 221 | /* Perform machine dependent cif processing */ 222 | #ifdef FFI_TARGET_SPECIFIC_VARIADIC 223 | if (isvariadic) 224 | return ffi_prep_cif_machdep_var(cif, nfixedargs, ntotalargs); 225 | #endif 226 | 227 | return ffi_prep_cif_machdep(cif); 228 | } 229 | #endif /* not __CRIS__ */ 230 | 231 | ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, 232 | ffi_type *rtype, ffi_type **atypes) 233 | { 234 | return ffi_prep_cif_core(cif, abi, 0, nargs, nargs, rtype, atypes); 235 | } 236 | 237 | ffi_status ffi_prep_cif_var(ffi_cif *cif, 238 | ffi_abi abi, 239 | unsigned int nfixedargs, 240 | unsigned int ntotalargs, 241 | ffi_type *rtype, 242 | ffi_type **atypes) 243 | { 244 | ffi_status rc; 245 | size_t int_size = ffi_type_sint.size; 246 | int i; 247 | 248 | rc = ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes); 249 | 250 | if (rc != FFI_OK) 251 | return rc; 252 | 253 | for (i = 1; i < ntotalargs; i++) 254 | { 255 | ffi_type *arg_type = atypes[i]; 256 | if (arg_type == &ffi_type_float 257 | || ((arg_type->type != FFI_TYPE_STRUCT 258 | && arg_type->type != FFI_TYPE_COMPLEX) 259 | && arg_type->size < int_size)) 260 | return FFI_BAD_ARGTYPE; 261 | } 262 | 263 | return FFI_OK; 264 | } 265 | 266 | #if FFI_CLOSURES 267 | 268 | ffi_status 269 | ffi_prep_closure (ffi_closure* closure, 270 | ffi_cif* cif, 271 | void (*fun)(ffi_cif*,void*,void**,void*), 272 | void *user_data) 273 | { 274 | return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); 275 | } 276 | 277 | #endif 278 | 279 | ffi_status 280 | ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, size_t *offsets) 281 | { 282 | if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)) 283 | return FFI_BAD_ABI; 284 | if (struct_type->type != FFI_TYPE_STRUCT) 285 | return FFI_BAD_TYPEDEF; 286 | 287 | #if HAVE_LONG_DOUBLE_VARIANT 288 | ffi_prep_types (abi); 289 | #endif 290 | 291 | return initialize_aggregate(struct_type, offsets); 292 | } 293 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/common/raw_api.c: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. 3 | 4 | Author: Kresten Krab Thorup 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | ``Software''), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included 15 | in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | ----------------------------------------------------------------------- */ 26 | 27 | /* This file defines generic functions for use with the raw api. */ 28 | 29 | #if __has_include() 30 | #include 31 | #else 32 | #include "ffi.h" 33 | #endif 34 | 35 | #if __has_include() 36 | #include 37 | #else 38 | #include "ffi_common.h" 39 | #endif 40 | 41 | #if !FFI_NO_RAW_API 42 | 43 | size_t 44 | ffi_raw_size (ffi_cif *cif) 45 | { 46 | size_t result = 0; 47 | int i; 48 | 49 | ffi_type **at = cif->arg_types; 50 | 51 | for (i = cif->nargs-1; i >= 0; i--, at++) 52 | { 53 | #if !FFI_NO_STRUCTS 54 | if ((*at)->type == FFI_TYPE_STRUCT) 55 | result += FFI_ALIGN (sizeof (void*), FFI_SIZEOF_ARG); 56 | else 57 | #endif 58 | result += FFI_ALIGN ((*at)->size, FFI_SIZEOF_ARG); 59 | } 60 | 61 | return result; 62 | } 63 | 64 | 65 | void 66 | ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) 67 | { 68 | unsigned i; 69 | ffi_type **tp = cif->arg_types; 70 | 71 | #if WORDS_BIGENDIAN 72 | 73 | for (i = 0; i < cif->nargs; i++, tp++, args++) 74 | { 75 | switch ((*tp)->type) 76 | { 77 | case FFI_TYPE_UINT8: 78 | case FFI_TYPE_SINT8: 79 | *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); 80 | break; 81 | 82 | case FFI_TYPE_UINT16: 83 | case FFI_TYPE_SINT16: 84 | *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); 85 | break; 86 | 87 | #if FFI_SIZEOF_ARG >= 4 88 | case FFI_TYPE_UINT32: 89 | case FFI_TYPE_SINT32: 90 | *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); 91 | break; 92 | #endif 93 | 94 | #if !FFI_NO_STRUCTS 95 | case FFI_TYPE_STRUCT: 96 | *args = (raw++)->ptr; 97 | break; 98 | #endif 99 | 100 | case FFI_TYPE_COMPLEX: 101 | *args = (raw++)->ptr; 102 | break; 103 | 104 | case FFI_TYPE_POINTER: 105 | *args = (void*) &(raw++)->ptr; 106 | break; 107 | 108 | default: 109 | *args = raw; 110 | raw += FFI_ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; 111 | } 112 | } 113 | 114 | #else /* WORDS_BIGENDIAN */ 115 | 116 | #if !PDP 117 | 118 | /* then assume little endian */ 119 | for (i = 0; i < cif->nargs; i++, tp++, args++) 120 | { 121 | #if !FFI_NO_STRUCTS 122 | if ((*tp)->type == FFI_TYPE_STRUCT) 123 | { 124 | *args = (raw++)->ptr; 125 | } 126 | else 127 | #endif 128 | if ((*tp)->type == FFI_TYPE_COMPLEX) 129 | { 130 | *args = (raw++)->ptr; 131 | } 132 | else 133 | { 134 | *args = (void*) raw; 135 | raw += FFI_ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); 136 | } 137 | } 138 | 139 | #else 140 | #error "pdp endian not supported" 141 | #endif /* ! PDP */ 142 | 143 | #endif /* WORDS_BIGENDIAN */ 144 | } 145 | 146 | void 147 | ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) 148 | { 149 | unsigned i; 150 | ffi_type **tp = cif->arg_types; 151 | 152 | for (i = 0; i < cif->nargs; i++, tp++, args++) 153 | { 154 | switch ((*tp)->type) 155 | { 156 | case FFI_TYPE_UINT8: 157 | (raw++)->uint = *(UINT8*) (*args); 158 | break; 159 | 160 | case FFI_TYPE_SINT8: 161 | (raw++)->sint = *(SINT8*) (*args); 162 | break; 163 | 164 | case FFI_TYPE_UINT16: 165 | (raw++)->uint = *(UINT16*) (*args); 166 | break; 167 | 168 | case FFI_TYPE_SINT16: 169 | (raw++)->sint = *(SINT16*) (*args); 170 | break; 171 | 172 | #if FFI_SIZEOF_ARG >= 4 173 | case FFI_TYPE_UINT32: 174 | (raw++)->uint = *(UINT32*) (*args); 175 | break; 176 | 177 | case FFI_TYPE_SINT32: 178 | (raw++)->sint = *(SINT32*) (*args); 179 | break; 180 | #endif 181 | 182 | #if !FFI_NO_STRUCTS 183 | case FFI_TYPE_STRUCT: 184 | (raw++)->ptr = *args; 185 | break; 186 | #endif 187 | 188 | case FFI_TYPE_COMPLEX: 189 | (raw++)->ptr = *args; 190 | break; 191 | 192 | case FFI_TYPE_POINTER: 193 | (raw++)->ptr = **(void***) args; 194 | break; 195 | 196 | default: 197 | memcpy ((void*) raw->data, (void*)*args, (*tp)->size); 198 | raw += FFI_ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; 199 | } 200 | } 201 | } 202 | 203 | #if !FFI_NATIVE_RAW_API 204 | 205 | 206 | /* This is a generic definition of ffi_raw_call, to be used if the 207 | * native system does not provide a machine-specific implementation. 208 | * Having this, allows code to be written for the raw API, without 209 | * the need for system-specific code to handle input in that format; 210 | * these following couple of functions will handle the translation forth 211 | * and back automatically. */ 212 | 213 | void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) 214 | { 215 | void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); 216 | ffi_raw_to_ptrarray (cif, raw, avalue); 217 | ffi_call (cif, fn, rvalue, avalue); 218 | } 219 | 220 | #if FFI_CLOSURES /* base system provides closures */ 221 | 222 | static void 223 | ffi_translate_args (ffi_cif *cif, void *rvalue, 224 | void **avalue, void *user_data) 225 | { 226 | ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); 227 | ffi_raw_closure *cl = (ffi_raw_closure*)user_data; 228 | 229 | ffi_ptrarray_to_raw (cif, avalue, raw); 230 | (*cl->fun) (cif, rvalue, raw, cl->user_data); 231 | } 232 | 233 | ffi_status 234 | ffi_prep_raw_closure_loc (ffi_raw_closure* cl, 235 | ffi_cif *cif, 236 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 237 | void *user_data, 238 | void *codeloc) 239 | { 240 | ffi_status status; 241 | 242 | status = ffi_prep_closure_loc ((ffi_closure*) cl, 243 | cif, 244 | &ffi_translate_args, 245 | codeloc, 246 | codeloc); 247 | if (status == FFI_OK) 248 | { 249 | cl->fun = fun; 250 | cl->user_data = user_data; 251 | } 252 | 253 | return status; 254 | } 255 | 256 | #endif /* FFI_CLOSURES */ 257 | #endif /* !FFI_NATIVE_RAW_API */ 258 | 259 | #if FFI_CLOSURES 260 | 261 | /* Again, here is the generic version of ffi_prep_raw_closure, which 262 | * will install an intermediate "hub" for translation of arguments from 263 | * the pointer-array format, to the raw format */ 264 | 265 | ffi_status 266 | ffi_prep_raw_closure (ffi_raw_closure* cl, 267 | ffi_cif *cif, 268 | void (*fun)(ffi_cif*,void*,ffi_raw*,void*), 269 | void *user_data) 270 | { 271 | return ffi_prep_raw_closure_loc (cl, cif, fun, user_data, cl); 272 | } 273 | 274 | #endif /* FFI_CLOSURES */ 275 | 276 | #endif /* !FFI_NO_RAW_API */ 277 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/common/types.c: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------------------------- 2 | types.c - Copyright (c) 1996, 1998 Red Hat, Inc. 3 | 4 | Predefined ffi_types needed by libffi. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining 7 | a copy of this software and associated documentation files (the 8 | ``Software''), to deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, merge, publish, 10 | distribute, sublicense, and/or sell copies of the Software, and to 11 | permit persons to whom the Software is furnished to do so, subject to 12 | the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included 15 | in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | ----------------------------------------------------------------------- */ 26 | 27 | /* Hide the basic type definitions from the header file, so that we 28 | can redefine them here as "const". */ 29 | #define LIBFFI_HIDE_BASIC_TYPES 30 | 31 | #if __has_include() 32 | #include 33 | #else 34 | #include "ffi.h" 35 | #endif 36 | 37 | #if __has_include() 38 | #include 39 | #else 40 | #include "ffi_common.h" 41 | #endif 42 | 43 | /* Type definitions */ 44 | 45 | #define FFI_TYPEDEF(name, type, id, maybe_const)\ 46 | struct struct_align_##name { \ 47 | char c; \ 48 | type x; \ 49 | }; \ 50 | FFI_EXTERN \ 51 | maybe_const ffi_type ffi_type_##name = { \ 52 | sizeof(type), \ 53 | offsetof(struct struct_align_##name, x), \ 54 | id, NULL \ 55 | } 56 | 57 | #define FFI_COMPLEX_TYPEDEF(name, type, maybe_const) \ 58 | static ffi_type *ffi_elements_complex_##name [2] = { \ 59 | (ffi_type *)(&ffi_type_##name), NULL \ 60 | }; \ 61 | struct struct_align_complex_##name { \ 62 | char c; \ 63 | _Complex type x; \ 64 | }; \ 65 | FFI_EXTERN \ 66 | maybe_const ffi_type ffi_type_complex_##name = { \ 67 | sizeof(_Complex type), \ 68 | offsetof(struct struct_align_complex_##name, x), \ 69 | FFI_TYPE_COMPLEX, \ 70 | (ffi_type **)ffi_elements_complex_##name \ 71 | } 72 | 73 | /* Size and alignment are fake here. They must not be 0. */ 74 | FFI_EXTERN const ffi_type ffi_type_void = { 75 | 1, 1, FFI_TYPE_VOID, NULL 76 | }; 77 | 78 | FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8, const); 79 | FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8, const); 80 | FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16, const); 81 | FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16, const); 82 | FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32, const); 83 | FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32, const); 84 | FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64, const); 85 | FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64, const); 86 | 87 | FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER, const); 88 | 89 | FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT, const); 90 | FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE, const); 91 | 92 | #if !defined HAVE_LONG_DOUBLE_VARIANT || defined __alpha__ 93 | #define FFI_LDBL_CONST const 94 | #else 95 | #define FFI_LDBL_CONST 96 | #endif 97 | 98 | #ifdef __alpha__ 99 | /* Even if we're not configured to default to 128-bit long double, 100 | maintain binary compatibility, as -mlong-double-128 can be used 101 | at any time. */ 102 | /* Validate the hard-coded number below. */ 103 | # if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 104 | # error FFI_TYPE_LONGDOUBLE out of date 105 | # endif 106 | const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; 107 | #elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 108 | FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE, FFI_LDBL_CONST); 109 | #endif 110 | 111 | #ifdef FFI_TARGET_HAS_COMPLEX_TYPE 112 | FFI_COMPLEX_TYPEDEF(float, float, const); 113 | FFI_COMPLEX_TYPEDEF(double, double, const); 114 | #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE 115 | FFI_COMPLEX_TYPEDEF(longdouble, long double, FFI_LDBL_CONST); 116 | #endif 117 | #endif 118 | -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/x86/asmnames.h: -------------------------------------------------------------------------------- 1 | #ifdef __x86_64__ 2 | 3 | #ifndef ASMNAMES_H 4 | #define ASMNAMES_H 5 | 6 | #define C2(X, Y) X ## Y 7 | #define C1(X, Y) C2(X, Y) 8 | #ifdef __USER_LABEL_PREFIX__ 9 | # define C(X) C1(__USER_LABEL_PREFIX__, X) 10 | #else 11 | # define C(X) X 12 | #endif 13 | 14 | #ifdef __APPLE__ 15 | # define L(X) C1(L, X) 16 | #else 17 | # define L(X) C1(.L, X) 18 | #endif 19 | 20 | #if defined(__ELF__) && defined(__PIC__) 21 | # define PLT(X) X@PLT 22 | #else 23 | # define PLT(X) X 24 | #endif 25 | 26 | #ifdef __ELF__ 27 | # define ENDF(X) .type X,@function; .size X, . - X 28 | #else 29 | # define ENDF(X) 30 | #endif 31 | 32 | #endif /* ASMNAMES_H */ 33 | 34 | 35 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/x86/internal64.h: -------------------------------------------------------------------------------- 1 | #ifdef __x86_64__ 2 | 3 | #define UNIX64_RET_VOID 0 4 | #define UNIX64_RET_UINT8 1 5 | #define UNIX64_RET_UINT16 2 6 | #define UNIX64_RET_UINT32 3 7 | #define UNIX64_RET_SINT8 4 8 | #define UNIX64_RET_SINT16 5 9 | #define UNIX64_RET_SINT32 6 10 | #define UNIX64_RET_INT64 7 11 | #define UNIX64_RET_XMM32 8 12 | #define UNIX64_RET_XMM64 9 13 | #define UNIX64_RET_X87 10 14 | #define UNIX64_RET_X87_2 11 15 | #define UNIX64_RET_ST_XMM0_RAX 12 16 | #define UNIX64_RET_ST_RAX_XMM0 13 17 | #define UNIX64_RET_ST_XMM0_XMM1 14 18 | #define UNIX64_RET_ST_RAX_RDX 15 19 | 20 | #define UNIX64_RET_LAST 15 21 | 22 | #define UNIX64_FLAG_RET_IN_MEM (1 << 10) 23 | #define UNIX64_FLAG_XMM_ARGS (1 << 11) 24 | #define UNIX64_SIZE_SHIFT 12 25 | 26 | #if defined(FFI_EXEC_STATIC_TRAMP) 27 | /* 28 | * For the trampoline code table mapping, a mapping size of 4K (base page size) 29 | * is chosen. 30 | */ 31 | #define UNIX64_TRAMP_MAP_SHIFT 12 32 | #define UNIX64_TRAMP_MAP_SIZE (1 << UNIX64_TRAMP_MAP_SHIFT) 33 | #ifdef ENDBR_PRESENT 34 | #define UNIX64_TRAMP_SIZE 40 35 | #else 36 | #define UNIX64_TRAMP_SIZE 32 37 | #endif 38 | #endif 39 | 40 | 41 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/x86/internal_i386.h: -------------------------------------------------------------------------------- 1 | #ifdef __i386__ 2 | 3 | #define X86_RET_FLOAT 0 4 | #define X86_RET_DOUBLE 1 5 | #define X86_RET_LDOUBLE 2 6 | #define X86_RET_SINT8 3 7 | #define X86_RET_SINT16 4 8 | #define X86_RET_UINT8 5 9 | #define X86_RET_UINT16 6 10 | #define X86_RET_INT64 7 11 | #define X86_RET_INT32 8 12 | #define X86_RET_VOID 9 13 | #define X86_RET_STRUCTPOP 10 14 | #define X86_RET_STRUCTARG 11 15 | #define X86_RET_STRUCT_1B 12 16 | #define X86_RET_STRUCT_2B 13 17 | #define X86_RET_UNUSED14 14 18 | #define X86_RET_UNUSED15 15 19 | 20 | #define X86_RET_TYPE_MASK 15 21 | #define X86_RET_POP_SHIFT 4 22 | 23 | #define R_EAX 0 24 | #define R_EDX 1 25 | #define R_ECX 2 26 | 27 | #ifdef __PCC__ 28 | # define HAVE_FASTCALL 0 29 | #else 30 | # define HAVE_FASTCALL 1 31 | #endif 32 | 33 | #if defined(FFI_EXEC_STATIC_TRAMP) 34 | /* 35 | * For the trampoline code table mapping, a mapping size of 4K (base page size) 36 | * is chosen. 37 | */ 38 | #define X86_TRAMP_MAP_SHIFT 12 39 | #define X86_TRAMP_MAP_SIZE (1 << X86_TRAMP_MAP_SHIFT) 40 | #ifdef ENDBR_PRESENT 41 | #define X86_TRAMP_SIZE 44 42 | #else 43 | #define X86_TRAMP_SIZE 40 44 | #endif 45 | #endif 46 | 47 | 48 | #endif -------------------------------------------------------------------------------- /Pods/ZDLibffi/Source/src/x86/win64_x86_64.S: -------------------------------------------------------------------------------- 1 | #ifdef __x86_64__ 2 | 3 | #ifdef __x86_64__ 4 | #define LIBFFI_ASM 5 | #if __has_include() 6 | #include 7 | #else 8 | #include "fficonfig.h" 9 | #endif 10 | 11 | #if __has_include() 12 | #include 13 | #else 14 | #include "ffi.h" 15 | #endif 16 | 17 | #if __has_include() 18 | #include 19 | #else 20 | #include "ffi_cfi.h" 21 | #endif 22 | 23 | #include "asmnames.h" 24 | 25 | #if defined(HAVE_AS_CFI_PSEUDO_OP) 26 | .cfi_sections .debug_frame 27 | #endif 28 | 29 | #ifdef X86_WIN64 30 | #define SEH(...) __VA_ARGS__ 31 | #define arg0 %rcx 32 | #define arg1 %rdx 33 | #define arg2 %r8 34 | #define arg3 %r9 35 | #else 36 | #define SEH(...) 37 | #define arg0 %rdi 38 | #define arg1 %rsi 39 | #define arg2 %rdx 40 | #define arg3 %rcx 41 | #endif 42 | 43 | /* This macro allows the safe creation of jump tables without an 44 | actual table. The entry points into the table are all 8 bytes. 45 | The use of ORG asserts that we're at the correct location. */ 46 | /* ??? The clang assembler doesn't handle .org with symbolic expressions. */ 47 | #if defined(__clang__) || defined(__APPLE__) || (defined (__sun__) && defined(__svr4__)) 48 | # define E(BASE, X) .balign 8 49 | #else 50 | # define E(BASE, X) .balign 8; .org BASE + (X) * 8 51 | #endif 52 | 53 | .text 54 | 55 | /* ffi_call_win64 (void *stack, struct win64_call_frame *frame, void *r10) 56 | 57 | Bit o trickiness here -- FRAME is the base of the stack frame 58 | for this function. This has been allocated by ffi_call. We also 59 | deallocate some of the stack that has been alloca'd. */ 60 | 61 | .align 8 62 | .globl C(ffi_call_win64) 63 | FFI_HIDDEN(C(ffi_call_win64)) 64 | 65 | SEH(.seh_proc ffi_call_win64) 66 | C(ffi_call_win64): 67 | cfi_startproc 68 | _CET_ENDBR 69 | /* Set up the local stack frame and install it in rbp/rsp. */ 70 | movq (%rsp), %rax 71 | movq %rbp, (arg1) 72 | movq %rax, 8(arg1) 73 | movq arg1, %rbp 74 | cfi_def_cfa(%rbp, 16) 75 | cfi_rel_offset(%rbp, 0) 76 | SEH(.seh_pushreg %rbp) 77 | SEH(.seh_setframe %rbp, 0) 78 | SEH(.seh_endprologue) 79 | movq arg0, %rsp 80 | 81 | movq arg2, %r10 82 | 83 | /* Load all slots into both general and xmm registers. */ 84 | movq (%rsp), %rcx 85 | movsd (%rsp), %xmm0 86 | movq 8(%rsp), %rdx 87 | movsd 8(%rsp), %xmm1 88 | movq 16(%rsp), %r8 89 | movsd 16(%rsp), %xmm2 90 | movq 24(%rsp), %r9 91 | movsd 24(%rsp), %xmm3 92 | 93 | call *16(%rbp) 94 | 95 | movl 24(%rbp), %ecx 96 | movq 32(%rbp), %r8 97 | leaq 0f(%rip), %r10 98 | cmpl $FFI_TYPE_SMALL_STRUCT_4B, %ecx 99 | leaq (%r10, %rcx, 8), %r10 100 | ja 99f 101 | _CET_NOTRACK jmp *%r10 102 | 103 | /* Below, we're space constrained most of the time. Thus we eschew the 104 | modern "mov, pop, ret" sequence (5 bytes) for "leave, ret" (2 bytes). */ 105 | .macro epilogue 106 | leaveq 107 | cfi_remember_state 108 | cfi_def_cfa(%rsp, 8) 109 | cfi_restore(%rbp) 110 | ret 111 | cfi_restore_state 112 | .endm 113 | 114 | .align 8 115 | 0: 116 | E(0b, FFI_TYPE_VOID) 117 | epilogue 118 | E(0b, FFI_TYPE_INT) 119 | movslq %eax, %rax 120 | movq %rax, (%r8) 121 | epilogue 122 | E(0b, FFI_TYPE_FLOAT) 123 | movss %xmm0, (%r8) 124 | epilogue 125 | E(0b, FFI_TYPE_DOUBLE) 126 | movsd %xmm0, (%r8) 127 | epilogue 128 | // FFI_TYPE_LONGDOUBLE may be FFI_TYPE_DOUBLE but we need a different value here. 129 | E(0b, FFI_TYPE_DOUBLE + 1) 130 | call PLT(C(abort)) 131 | E(0b, FFI_TYPE_UINT8) 132 | movzbl %al, %eax 133 | movq %rax, (%r8) 134 | epilogue 135 | E(0b, FFI_TYPE_SINT8) 136 | movsbq %al, %rax 137 | jmp 98f 138 | E(0b, FFI_TYPE_UINT16) 139 | movzwl %ax, %eax 140 | movq %rax, (%r8) 141 | epilogue 142 | E(0b, FFI_TYPE_SINT16) 143 | movswq %ax, %rax 144 | jmp 98f 145 | E(0b, FFI_TYPE_UINT32) 146 | movl %eax, %eax 147 | movq %rax, (%r8) 148 | epilogue 149 | E(0b, FFI_TYPE_SINT32) 150 | movslq %eax, %rax 151 | movq %rax, (%r8) 152 | epilogue 153 | E(0b, FFI_TYPE_UINT64) 154 | 98: movq %rax, (%r8) 155 | epilogue 156 | E(0b, FFI_TYPE_SINT64) 157 | movq %rax, (%r8) 158 | epilogue 159 | E(0b, FFI_TYPE_STRUCT) 160 | epilogue 161 | E(0b, FFI_TYPE_POINTER) 162 | movq %rax, (%r8) 163 | epilogue 164 | E(0b, FFI_TYPE_COMPLEX) 165 | call PLT(C(abort)) 166 | E(0b, FFI_TYPE_SMALL_STRUCT_1B) 167 | movb %al, (%r8) 168 | epilogue 169 | E(0b, FFI_TYPE_SMALL_STRUCT_2B) 170 | movw %ax, (%r8) 171 | epilogue 172 | E(0b, FFI_TYPE_SMALL_STRUCT_4B) 173 | movl %eax, (%r8) 174 | epilogue 175 | 176 | .align 8 177 | 99: call PLT(C(abort)) 178 | 179 | epilogue 180 | 181 | cfi_endproc 182 | SEH(.seh_endproc) 183 | 184 | 185 | /* 32 bytes of outgoing register stack space, 8 bytes of alignment, 186 | 16 bytes of result, 32 bytes of xmm registers. */ 187 | #define ffi_clo_FS (32+8+16+32) 188 | #define ffi_clo_OFF_R (32+8) 189 | #define ffi_clo_OFF_X (32+8+16) 190 | 191 | .align 8 192 | .globl C(ffi_go_closure_win64) 193 | FFI_HIDDEN(C(ffi_go_closure_win64)) 194 | 195 | SEH(.seh_proc ffi_go_closure_win64) 196 | C(ffi_go_closure_win64): 197 | cfi_startproc 198 | _CET_ENDBR 199 | /* Save all integer arguments into the incoming reg stack space. */ 200 | movq %rcx, 8(%rsp) 201 | movq %rdx, 16(%rsp) 202 | movq %r8, 24(%rsp) 203 | movq %r9, 32(%rsp) 204 | 205 | movq 8(%r10), %rcx /* load cif */ 206 | movq 16(%r10), %rdx /* load fun */ 207 | movq %r10, %r8 /* closure is user_data */ 208 | jmp 0f 209 | cfi_endproc 210 | SEH(.seh_endproc) 211 | 212 | .align 8 213 | .globl C(ffi_closure_win64) 214 | FFI_HIDDEN(C(ffi_closure_win64)) 215 | 216 | SEH(.seh_proc ffi_closure_win64) 217 | C(ffi_closure_win64): 218 | cfi_startproc 219 | _CET_ENDBR 220 | /* Save all integer arguments into the incoming reg stack space. */ 221 | movq %rcx, 8(%rsp) 222 | movq %rdx, 16(%rsp) 223 | movq %r8, 24(%rsp) 224 | movq %r9, 32(%rsp) 225 | 226 | movq FFI_TRAMPOLINE_SIZE(%r10), %rcx /* load cif */ 227 | movq FFI_TRAMPOLINE_SIZE+8(%r10), %rdx /* load fun */ 228 | movq FFI_TRAMPOLINE_SIZE+16(%r10), %r8 /* load user_data */ 229 | 0: 230 | subq $ffi_clo_FS, %rsp 231 | cfi_adjust_cfa_offset(ffi_clo_FS) 232 | SEH(.seh_stackalloc ffi_clo_FS) 233 | SEH(.seh_endprologue) 234 | 235 | /* Save all sse arguments into the stack frame. */ 236 | movsd %xmm0, ffi_clo_OFF_X(%rsp) 237 | movsd %xmm1, ffi_clo_OFF_X+8(%rsp) 238 | movsd %xmm2, ffi_clo_OFF_X+16(%rsp) 239 | movsd %xmm3, ffi_clo_OFF_X+24(%rsp) 240 | 241 | leaq ffi_clo_OFF_R(%rsp), %r9 242 | call PLT(C(ffi_closure_win64_inner)) 243 | 244 | /* Load the result into both possible result registers. */ 245 | movq ffi_clo_OFF_R(%rsp), %rax 246 | movsd ffi_clo_OFF_R(%rsp), %xmm0 247 | 248 | addq $ffi_clo_FS, %rsp 249 | cfi_adjust_cfa_offset(-ffi_clo_FS) 250 | ret 251 | 252 | cfi_endproc 253 | SEH(.seh_endproc) 254 | 255 | #if defined(FFI_EXEC_STATIC_TRAMP) 256 | .align 8 257 | .globl C(ffi_closure_win64_alt) 258 | FFI_HIDDEN(C(ffi_closure_win64_alt)) 259 | 260 | SEH(.seh_proc ffi_closure_win64_alt) 261 | C(ffi_closure_win64_alt): 262 | _CET_ENDBR 263 | movq 8(%rsp), %r10 264 | addq $16, %rsp 265 | jmp C(ffi_closure_win64) 266 | SEH(.seh_endproc) 267 | #endif 268 | #endif /* __x86_64__ */ 269 | 270 | #if defined __ELF__ && defined __linux__ 271 | .section .note.GNU-stack,"",@progbits 272 | #endif 273 | 274 | 275 | #endif 276 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libffi 2 | 3 | ## 一、libffi简介 4 | 5 | > 维基百科:
6 | > [libffi](https://github.com/libffi/libffi) 是一个外部函数接口库。它提供了一个C编程语言接口,用于在运行时(而不是编译时)给定有关目标函数的信息来调用本地编译函数。它还实现了相反的功能:`libffi`可以生成一个指向可以接受和解码在运行时定义的参数组合的函数的指针。 7 | 8 | `FFI(Foreign Function Interface)`允许以一种语言编写的代码调用另一种语言的代码,而[libffi](https://github.com/libffi/libffi)库提供了最底层的、与架构相关的、完整的`FFI`。`libffi`的作用就相当于编译器,它为多种调用规则提供了一系列高级语言编程接口,然后通过相应接口完成函数调用,底层会根据对应的规则,完成数据准备,生成相应的汇编指令代码。 9 | 10 |     [libffi](https://github.com/libffi/libffi) 被称为`C语言的runtime`,它可根据 `参数类型`(`ffi_type`)、`参数个数`生成一个模板(`ffi_cif`),然后通过`模板`、`函数指针` 、`参数地址` 来直接完成函数的调用(`ffi_call`)。 11 | 12 |     它也可以生成一个`闭包`(`ffi_closure`),并同时得到一个函数指针`newIMP`,把这个新的函数指针`newIMP`与自定义的函数`void xx_func(ffi_cif *cif, void *ret, void **args, void *userdata)` 关联到一起,然后当我们执行`newIMP`时,会执行到我们自定义的`xx_func_`函数里(这个函数的参数格式是固定的),这里我们可以获得所有参数的地址和返回值以及自定义数据`userdata`。最后我们通过`ffi_call`函数来调用其他函数,简要流程是通过模板`cif`和`参数值`,把参数都按规则塞到栈/寄存器,然后调用的函数可以按规则获取到参数,调用完再获取返回值,最后记得释放内存。 13 | 14 | ## 二、用法 15 | 16 | 我们都知道`Objective-C`底层最终都会转成`objc_msgsend`这个`C`层的函数,而 `libffi` 能调用任意 `C` 函数,所以这也是`libffi`支持`Objective-C`的原因。`libffi`底层也是用汇编实现的。 17 | 18 | 19 | > [**✅ 全部测试case**](./ZDLibffiDemoTests/ZDLibffiDemoTests.m) 20 | 21 | 22 |
23 | 先介绍一下 libffi 使用流程: 24 | 25 | ```c 26 | //1. 生成参数类型列表 27 | 根据方法签名获取参数类型,然后转换成`ffi_type`类型 28 | 29 | //2. 创建函数模版 30 | ffi_status ffi_prep_cif(ffi_cif *cif, 31 | ffi_abi abi, 32 | unsigned int nargs, 33 | ffi_type *rtype, 34 | ffi_type **atypes); 35 | 36 | //3. 如果需要用到切面,用下面函数生成一个`ffi_closure`闭包,否则直接执行第5步 37 | void *ffi_closure_alloc(size_t size, void **code); 38 | //4. 生成一个函数指针,并把闭包和函数指针绑定到函数模版上 39 | ffi_status ffi_prep_closure_loc(ffi_closure*, 40 | ffi_cif *, 41 | void (*fun)(ffi_cif*,void*,void**,void*), //cif指针、返回值、参数列表、user_data 42 | void *user_data,     43 | void*codeloc); // 函数指针,执行函数实体 44 | 45 | //5. 调用函数 46 | void ffi_call(ffi_cif *cif, 47 | void (*fn)(void), 48 | void *rvalue, 49 | void **avalue); 50 | 51 | //6. 在合适的时机释放`ffi_closure` 52 | ffi_closure_free(void *) 53 | ``` 54 | 55 |
56 | 57 | 58 | ##### 1. 调用C函数 59 | 60 |
61 | Code 62 | 63 | ```c 64 | int cFunc(int a , int b) { 65 | int x = a + b; 66 | return x; 67 | } 68 | 69 | - (void)testCallCFunc { 70 | ffi_cif cif; 71 | ffi_type *argTypes[] = {&ffi_type_sint, &ffi_type_sint}; 72 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, argTypes); 73 | 74 | int a = 123; 75 | int b = 456; 76 | void *args[] = {&a, &b}; 77 | int retValue; 78 | ffi_call(&cif, (void *)cFunc, &retValue, args); 79 | } 80 | ``` 81 | 82 |
83 | 84 | 85 | ##### 2.调用OC方法 86 | 87 |
88 | Code 89 | 90 | ```objectivec 91 | // 直接调用OC方法 92 | - (void)testCallObjc { 93 | SEL selector = @selector(a:b:c:); 94 | NSMethodSignature *signature = [self methodSignatureForSelector:selector]; 95 | 96 | ffi_cif cif; 97 | ffi_type *argTypes[] = {&ffi_type_pointer, &ffi_type_pointer, &ffi_type_sint, &ffi_type_pointer, &ffi_type_pointer}; 98 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, (uint32_t)signature.numberOfArguments, &ffi_type_pointer, argTypes); 99 | 100 | NSInteger arg1 = 100; 101 | NSString *arg2 = @"hello"; 102 | id arg3 = NSObject.class; 103 | void *args[] = {&self, &selector, &arg1, &arg2, &arg3}; 104 | __unsafe_unretained id ret = nil; 105 | IMP func = [self methodForSelector:selector]; 106 | ffi_call(&cif, func, &ret, args); 107 | NSLog(@"===== %@", ret); 108 | } 109 | 110 | - (id)a:(NSInteger)a b:(NSString *)b c:(NSObject *)c { 111 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 112 | NSLog(@"result = %@", ret); 113 | return ret; 114 | } 115 | ``` 116 | 117 |
118 | 119 | 120 | ##### 3. 关联C函数 121 | 122 |
123 | Code 124 | 125 | ```c 126 | static void bindCFunc(ffi_cif *cif, int *ret, void **args, void *userdata) { 127 | struct UserData ud = *(struct UserData *)userdata; 128 | *ret = 999; 129 | printf("==== %s, %d\n", ud.c, *(int *)ret); 130 | 131 | //ffi_call(cif, ud.imp, ret, args); //再调用此方法会进入死循环 132 | } 133 | 134 | - (void)testBindCFunc { 135 | ffi_cif cif; 136 | ffi_type *argTypes[] = {&ffi_type_sint, &ffi_type_sint, &ffi_type_sint}; 137 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint, argTypes); 138 | 139 | // 新定义一个C函数指针 140 | int(*newCFunc)(int, int, int); 141 | ffi_closure *cloure = ffi_closure_alloc(sizeof(ffi_closure), (void *)&newCFunc); 142 | struct UserData userdata = {"圣诞快乐", 8888, newCFunc}; 143 | // 将newCFunc与bingCFunc关联 144 | ffi_status status = ffi_prep_closure_loc(cloure, &cif, (void *)bindCFunc, &userdata, newCFunc); 145 | if (status != FFI_OK) { 146 | NSLog(@"新函数指针生成失败"); 147 | return; 148 | } 149 | 150 | int ret = newCFunc(11, 34, 24); 151 | printf("********** %d\n", ret); 152 | 153 | ffi_closure_free(cloure); 154 | } 155 | ``` 156 | 157 |
158 | 159 | 160 | ##### 4. 生成`OC`切面函数 161 | 162 | > 大家熟知的几种hook方式: 163 | > 164 | > 1. 方法交换 165 | > 166 | > 2. 消息转发([Aspects](https://github.com/steipete/Aspects)) 167 | > 168 | > 3. 分类覆盖原方法 169 | 170 |
171 | Code 172 | 173 | ```objectivec 174 | static void zdfunc(ffi_cif *cif, void *ret, void **args, void *userdata) { 175 | ZDFfiHookInfo *info = (__bridge ZDFfiHookInfo *)userdata; 176 | 177 | // 打印参数 178 | NSMethodSignature *methodSignature = info.signature; 179 | NSInteger beginIndex = 2; 180 | if (info.isBlock) { 181 | beginIndex = 1; 182 | } 183 | for (NSInteger i = beginIndex; i < methodSignature.numberOfArguments; ++i) { 184 | id argValue = ZD_ArgumentAtIndex(methodSignature, ret, args, userdata, i); 185 | NSLog(@"arg ==> index: %ld, value: %@", i, argValue); 186 | } 187 | 188 | // 根据cif (函数原型,函数指针,返回值内存指针,函数参数) 调用这个函数 189 | ffi_call(&(info->_cif), info->_originalIMP, ret, args); 190 | } 191 | 192 | - (void)testHookOC { 193 | SEL selector = @selector(x:y:z:); 194 | NSMethodSignature *signature = [self methodSignatureForSelector:selector]; 195 | IMP originIMP = [self methodForSelector:selector]; 196 | 197 | 198 | ffi_type *argTypes[] = {&ffi_type_pointer, &ffi_type_pointer, &ffi_type_sint, &ffi_type_pointer, &ffi_type_pointer}; 199 | 200 | ffi_cif cif; 201 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, (uint32_t)signature.numberOfArguments, &ffi_type_pointer, argTypes); 202 | 203 | IMP newIMP = NULL; 204 | ffi_closure *cloure = ffi_closure_alloc(sizeof(ffi_closure), (void *)&newIMP); 205 | ZDFfiHookInfo *info = ({ 206 | ZDFfiHookInfo *model = ZDFfiHookInfo.new; 207 | model->_cif = cif; 208 | model->_argTypes = argTypes; 209 | model->_closure = cloure; 210 | model->_originalIMP = originIMP; 211 | model->_newIMP = newIMP; 212 | model.signature = signature; 213 | model; 214 | }); 215 | ffi_status status = ffi_prep_closure_loc(cloure, &cif, zdfunc, (__bridge void *)info, newIMP); 216 | if (status != FFI_OK) { 217 | NSLog(@"新函数指针生成失败"); 218 | return; 219 | } 220 | 221 | //替换实现 222 | Method method = class_getInstanceMethod(self.class, selector); 223 | method_setImplementation(method, newIMP); 224 | 225 | NSInteger arg1 = 100; 226 | NSString *arg2 = @"Zero.D.Saber"; 227 | id arg3 = @(909090); 228 | [self x:arg1 y:arg2 z:arg3]; 229 | } 230 | 231 | - (id)x:(NSInteger)a y:(NSString *)b z:(id)c { 232 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 233 | NSLog(@"result = %@", ret); 234 | return ret; 235 | } 236 | ``` 237 | 238 |
239 | 240 | 241 | ## 三、如何 hook 单个实例对象? 242 | 243 | > 只提供思路 244 | 245 | 仿照`KVO`的实现机制,以当前实例对象所属类为父类,动态创建一个新的子类,把当前实例的`isa`设置为新建的子类,并重写`class`方法。接下来只要  `hook` 这个子类就可以了; 246 | 247 | ### 四、总结: 248 | 249 | 1. libffi的优势: 250 | 251 | > + 支持多平台 252 | > 253 | > + 支持调用`C`、`Objective-C` 254 | > 255 | > + 执行速度快 256 | > 257 | > + 可以做到像[Aspects](https://github.com/steipete/Aspects)一样多次`hook`同一方法 258 | > 259 | > + 可以像`NSInvocation`动态调用`Objective-C` 260 | 261 | 2. 缺点: 262 | 263 | > + 构建模版函数时略繁琐 264 | 265 | 3. 使用场景: 266 | 267 | > + `hook` 原生方法 268 | > 269 | > + 替代`performSelector:`、`NSInvocation`调用`Objective-C`方法 270 | 271 | 272 | > 通过`消息转发`和`libffi`两种方式实现对`block`的`hook` 273 | 274 | + [ZDBlockHook](https://github.com/faimin/ZDBlockHook) 275 | 276 | ## 编译: 277 | 278 | #### libffi编译 279 | 280 | > 笔者其实更倾向于直接使用源码而不是编译成静态库,因为静态库需要适配多种架构,比较麻烦。 281 | > 282 | > 直接用源码不用考虑架构问题,而且还可以很好的支持`modulemap`,在`iOS`混编环境中更易使用。 283 | 284 | ```shell 285 | 1. `./autogen.sh` 286 | 2. `python generate-darwin-source-and-headers.py --only-ios` 287 | 3. open `libffi.xcodeproj` 288 | 4. select scheme `libffi-iOS` and device `Generic iOS Device` 289 | 5. click "Product - Build" 290 | 291 | If success, you would see a "Product/libffi.a" in the side bar, you can right click it to get the lib in the finder. 292 | ``` 293 | 294 | #### ZDLibffi 295 | 296 | 笔者基于当前最新的 [3.4.6](https://github.com/libffi/libffi/releases/tag/v3.4.6) 版本制作了一个源码版本的 [ZDLibffi](https://github.com/faimin/ZDLibffi_iOS),支持`modulemap`,可以更好的兼容混编开发环境。 297 | 298 | ```ruby 299 | pod 'ZDLibffi' 300 | ``` 301 | 302 | ## 参考: 303 | 304 | - [libffi](https://github.com/libffi/libffi) 305 | 306 | - [libffi文档](http://www.chiark.greenend.org.uk/doc/libffi-dev/html/Index.html#Index) 307 | 308 | - [使用libffi实现AOP](https://juejin.im/post/5a600d20518825732c539622) 309 | 310 | - [动态调用&定义C函数](https://www.jianshu.com/p/92d4c06223e7) 311 | 312 | - [Stinger](https://github.com/eleme/Stinger) 313 | 314 | - [libffi编译方法](https://github.com/libffi/libffi/issues/510#issuecomment-654689416) 315 | -------------------------------------------------------------------------------- /ZDLibffiDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ZDLibffiDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ZDLibffiDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ZDLibffiDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | #pragma mark - UISceneSession lifecycle 25 | 26 | 27 | - (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { 28 | // Called when a new scene session is being created. 29 | // Use this method to select a configuration to create the new scene with. 30 | return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; 31 | } 32 | 33 | 34 | - (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { 35 | // Called when the user discards a scene session. 36 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 37 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 38 | } 39 | 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /ZDLibffiDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /ZDLibffiDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ZDLibffiDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ZDLibffiDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /ZDLibffiDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /ZDLibffiDemo/SceneDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.h 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface SceneDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow * window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /ZDLibffiDemo/SceneDelegate.m: -------------------------------------------------------------------------------- 1 | #import "SceneDelegate.h" 2 | 3 | @interface SceneDelegate () 4 | 5 | @end 6 | 7 | @implementation SceneDelegate 8 | 9 | 10 | - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { 11 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 12 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 13 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 14 | } 15 | 16 | 17 | - (void)sceneDidDisconnect:(UIScene *)scene { 18 | // Called as the scene is being released by the system. 19 | // This occurs shortly after the scene enters the background, or when its session is discarded. 20 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 21 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 22 | } 23 | 24 | 25 | - (void)sceneDidBecomeActive:(UIScene *)scene { 26 | // Called when the scene has moved from an inactive state to an active state. 27 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 28 | } 29 | 30 | 31 | - (void)sceneWillResignActive:(UIScene *)scene { 32 | // Called when the scene will move from an active state to an inactive state. 33 | // This may occur due to temporary interruptions (ex. an incoming phone call). 34 | } 35 | 36 | 37 | - (void)sceneWillEnterForeground:(UIScene *)scene { 38 | // Called as the scene transitions from the background to the foreground. 39 | // Use this method to undo the changes made on entering the background. 40 | } 41 | 42 | 43 | - (void)sceneDidEnterBackground:(UIScene *)scene { 44 | // Called as the scene transitions from the foreground to the background. 45 | // Use this method to save data, release shared resources, and store enough scene-specific state information 46 | // to restore the scene back to its current state. 47 | } 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /ZDLibffiDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /ZDLibffiDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | } 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ZDLibffiDemo/ZDLibffiController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ZDLibffiController.h 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface ZDLibffiController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /ZDLibffiDemo/ZDLibffiController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZDLibffiController.m 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import "ZDLibffiController.h" 10 | #import "NSObject+ZDAOP.h" 11 | 12 | @interface ZDLibffiController () 13 | 14 | @end 15 | 16 | @implementation ZDLibffiController 17 | 18 | + (void)load { 19 | [self zd_hookInstanceMethod:@selector(x:y:z:) option:ZDHookOption_After callback:^(NSInteger a, NSString *b, id c){ 20 | NSLog(@"###########收到Hook信息 ==> 小狗%zd岁了, %@, %@", a, b, c); 21 | }]; 22 | } 23 | 24 | - (void)dealloc { 25 | printf("%s, %d\n", __PRETTY_FUNCTION__, __LINE__); 26 | } 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | // Do any additional setup after loading the view. 31 | 32 | id r = [self x:110 y:@"阿尔托莉雅·潘德拉贡" z:NSObject.new]; 33 | NSLog(@"$$$$$$$$$$$$ %s => %@", __PRETTY_FUNCTION__, r); 34 | } 35 | 36 | - (id)x:(NSInteger)a y:(NSString *)b z:(id)c { 37 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 38 | NSLog(@"result = %@", ret); 39 | return ret; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ZDLibffiDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ZDLibffiDemo 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | NSString * appDelegateClassName; 14 | @autoreleasepool { 15 | // Setup code that might create autoreleased objects goes here. 16 | appDelegateClassName = NSStringFromClass([AppDelegate class]); 17 | } 18 | return UIApplicationMain(argc, argv, nil, appDelegateClassName); 19 | } 20 | -------------------------------------------------------------------------------- /ZDLibffiDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZDLibffiDemoTests/ZDLibffiDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZDLibffiDemoTests.m 3 | // ZDLibffiDemoTests 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | // libffi基本用法 9 | 10 | #import 11 | #import "NSObject+ZDAOP.h" 12 | 13 | NSUInteger const MaxCount = 100000; 14 | 15 | @interface ZDLibffiDemoTests : XCTestCase 16 | 17 | @end 18 | 19 | @implementation ZDLibffiDemoTests 20 | 21 | - (void)setUp { 22 | // Put setup code here. This method is called before the invocation of each test method in the class. 23 | 24 | } 25 | 26 | - (void)tearDown { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | } 29 | 30 | - (void)testExample { 31 | // This is an example of a functional test case. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | //######################################################### 36 | #pragma mark - ####################################################### 37 | 38 | #pragma mark - 调用C函数 39 | 40 | static int cFunc(int a , int b, int c) { 41 | int x = a + b + c; 42 | return x; 43 | } 44 | 45 | - (void)testCallCFunc { 46 | ffi_cif cif; 47 | ffi_type *argTypes[] = {&ffi_type_sint, &ffi_type_sint, &ffi_type_sint}; 48 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint, argTypes); 49 | 50 | int a = 123; 51 | int b = 456; 52 | int c = 890; 53 | 54 | void **args = alloca(sizeof(void *) * 3); 55 | args[0] = &a; 56 | args[1] = &b; 57 | args[2] = &c; 58 | int retValue; 59 | ffi_call(&cif, (void *)cFunc, &retValue, args); 60 | 61 | int m = cFunc(a, b, c); 62 | 63 | XCTAssertEqual(retValue, m); 64 | } 65 | 66 | #pragma mark - 调用OC方法 67 | 68 | // 直接调用OC方法 69 | - (void)testCallObjC1 { 70 | SEL selector = @selector(a:b:c:); 71 | NSMethodSignature *signature = [self methodSignatureForSelector:selector]; 72 | 73 | ffi_cif *cif = alloca(sizeof(ffi_cif)); 74 | ffi_type *argTypes[] = {&ffi_type_pointer, &ffi_type_schar, &ffi_type_sint, &ffi_type_pointer, &ffi_type_pointer}; 75 | ffi_prep_cif(cif, FFI_DEFAULT_ABI, (uint32_t)signature.numberOfArguments, &ffi_type_pointer, argTypes); 76 | 77 | NSInteger arg1 = 100; 78 | NSString *arg2 = @"hello"; 79 | id arg3 = NSObject.class; 80 | void *args[] = {(void *)&self, &selector, &arg1, &arg2, &arg3}; 81 | __unsafe_unretained id ret = nil; 82 | IMP func = [self methodForSelector:selector]; 83 | ffi_call(cif, func, &ret, args); 84 | NSLog(@"===== %@", ret); 85 | } 86 | 87 | - (id)a:(NSInteger)a b:(NSString *)b c:(id)c { 88 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 89 | NSLog(@"result = %@", ret); 90 | return ret; 91 | } 92 | 93 | - (void)testCallObjC2 { 94 | SEL selector = @selector(aa:bb:cc:); 95 | NSMethodSignature *signature = [self methodSignatureForSelector:selector]; 96 | 97 | ffi_cif *cif = alloca(sizeof(ffi_cif)); 98 | ffi_type *argTypes[] = {&ffi_type_pointer, &ffi_type_schar, &ffi_type_sint, &ffi_type_pointer, &ffi_type_pointer}; 99 | ffi_type *retType = &ffi_type_sint; 100 | ffi_prep_cif(cif, FFI_DEFAULT_ABI, (uint32_t)signature.numberOfArguments, retType, argTypes); 101 | 102 | NSInteger arg1 = 100; 103 | NSString *arg2 = @"hello"; 104 | id arg3 = NSObject.class; 105 | void *args[] = {(void *)&self, &selector, &arg1, &arg2, &arg3}; 106 | 107 | // https://github.com/bang590/JSPatch/blob/e80a5573af223936647e5869871804bfd7751d4f/Extensions/JPCFunction/JPCFunction.m 108 | #if 0 109 | // 正常 110 | IMP afunc = [self methodForSelector:selector]; 111 | void *retPtr = alloca(retType->size); 112 | ffi_call(cif, afunc, retPtr, args); 113 | NSLog(@"===== %d", *(int *)retPtr); 114 | #endif 115 | 116 | #if 1 117 | // 正常 118 | // 如果先定义ret再获取bfunc则crash。why? 119 | IMP bfunc = [self methodForSelector:selector]; 120 | int ret; 121 | ffi_call(cif, bfunc, &ret, args); 122 | NSLog(@"===== %d", ret); 123 | #endif 124 | 125 | #if 0 126 | // crash 127 | int ret; 128 | IMP bfunc = [self methodForSelector:selector]; 129 | ffi_call(cif, bfunc, &ret, args); 130 | NSLog(@"===== %d", ret); 131 | #endif 132 | } 133 | 134 | - (int)aa:(NSInteger)a bb:(NSString *)b cc:(id)c { 135 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 136 | NSLog(@"result = %@", ret); 137 | return 100; 138 | } 139 | 140 | #pragma mark - -------------------------- 141 | #pragma mark - BindC 142 | 143 | struct ZDUserData { 144 | char *c; 145 | int a; 146 | void *imp; 147 | }; 148 | 149 | static void bindCFunc(ffi_cif *cif, int *ret, void **args, void *userdata) { 150 | struct ZDUserData ud = *(struct ZDUserData *)userdata; 151 | *ret = 999; 152 | printf("==== %s, %d\n", ud.c, *(int *)ret); 153 | 154 | //ffi_call(cif, ud.imp, ret, args); //再调用此方法会进入死循环 155 | } 156 | 157 | - (void)testBindCFunc { 158 | ffi_cif cif; 159 | ffi_type *argTypes[] = {&ffi_type_sint, &ffi_type_sint, &ffi_type_sint}; 160 | unsigned int argTypesCount = sizeof(argTypes) / sizeof(ffi_type *); 161 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, argTypesCount, &ffi_type_sint, argTypes); 162 | 163 | // 新定义一个C函数指针 164 | int(*newCFunc)(int, int, int) = NULL; 165 | ffi_closure *cloure = ffi_closure_alloc(sizeof(ffi_closure), (void *)&newCFunc); 166 | struct ZDUserData userdata = {"元旦快乐", 8888, newCFunc}; 167 | // 将newCFunc与bingCFunc关联 168 | ffi_status status = ffi_prep_closure_loc(cloure, &cif, (void *)bindCFunc, &userdata, newCFunc); 169 | if (status != FFI_OK) { 170 | NSLog(@"新函数指针生成失败"); 171 | return; 172 | } 173 | 174 | int ret = newCFunc(11, 34, 24); 175 | printf("********** %d\n", ret); 176 | 177 | ffi_closure_free(cloure); 178 | } 179 | 180 | #pragma mark - HookOC 181 | 182 | static void zdfunc(ffi_cif *cif, void *ret, void **args, void *userdata) { 183 | ZDFfiHookInfo *info = (__bridge ZDFfiHookInfo *)userdata; 184 | 185 | // 打印参数 186 | NSMethodSignature *methodSignature = info.signature; 187 | NSInteger beginIndex = 2; 188 | if (info.isBlock) { 189 | beginIndex = 1; 190 | } 191 | for (NSInteger i = beginIndex; i < methodSignature.numberOfArguments; ++i) { 192 | id argValue = ZD_ArgumentAtIndex(methodSignature, args, i); 193 | NSLog(@"arg ==> index: %ld, value: %@", i, argValue); 194 | } 195 | 196 | // https://github.com/sunnyxx/libffi-iOS/blob/master/Demo/ViewController.m 197 | // 根据cif (函数原型,函数指针,返回值内存指针,函数参数) 调用这个函数 198 | ffi_call(cif, info->_originalIMP, ret, args); 199 | } 200 | 201 | - (void)testHookOC { 202 | SEL selector = @selector(x:y:z:); 203 | NSMethodSignature *signature = [self methodSignatureForSelector:selector]; 204 | IMP originIMP = [self methodForSelector:selector]; 205 | 206 | //ffi_type *argTypes[] = {&ffi_type_pointer, &ffi_type_pointer, &ffi_type_sint, &ffi_type_pointer, &ffi_type_pointer}; 207 | ffi_type **argTypes = calloc(signature.numberOfArguments, sizeof(ffi_type *)); 208 | argTypes[0] = &ffi_type_pointer; 209 | argTypes[1] = &ffi_type_schar; 210 | argTypes[2] = &ffi_type_sint; 211 | argTypes[3] = &ffi_type_pointer; 212 | argTypes[4] = &ffi_type_pointer; 213 | 214 | ffi_cif *cif = calloc(1, sizeof(ffi_cif)); 215 | ffi_prep_cif(cif, FFI_DEFAULT_ABI, (uint32_t)signature.numberOfArguments, &ffi_type_pointer, argTypes); 216 | 217 | IMP newIMP = NULL; 218 | ffi_closure *cloure = ffi_closure_alloc(sizeof(ffi_closure), (void *)&newIMP); 219 | ZDFfiHookInfo *info = ({ 220 | ZDFfiHookInfo *model = ZDFfiHookInfo.new; 221 | model->_cif = cif; 222 | model->_argTypes = argTypes; 223 | model->_closure = cloure; 224 | model->_originalIMP = originIMP; 225 | model->_newIMP = newIMP; 226 | model.signature = signature; 227 | model; 228 | }); 229 | ffi_status status = ffi_prep_closure_loc(cloure, cif, zdfunc, (__bridge void *)info, newIMP); 230 | if (status != FFI_OK) { 231 | NSLog(@"新函数指针生成失败"); 232 | return; 233 | } 234 | 235 | //替换实现 236 | Method method = class_getInstanceMethod(self.class, selector); 237 | method_setImplementation(method, newIMP); 238 | 239 | NSInteger arg1 = 100; 240 | NSString *arg2 = @"Zero.D.Saber"; 241 | id arg3 = @(909090); 242 | [self x:arg1 y:arg2 z:arg3]; 243 | } 244 | 245 | - (id)x:(NSInteger)a y:(NSString *)b z:(id)c { 246 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 247 | NSLog(@"result = %@", ret); 248 | return ret; 249 | } 250 | 251 | @end 252 | -------------------------------------------------------------------------------- /ZDLibffiDemoTests/ZDLibffiVSAspectTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZDLibffiVSAspectTests.m 3 | // ZDLibffiDemoTests 4 | // 5 | // Created by Zero.D.Saber on 2019/12/17. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | // aspect与libffi性能对比 9 | 10 | #import 11 | #import "NSObject+ZDAOP.h" 12 | #import 13 | 14 | FOUNDATION_EXPORT NSUInteger const MaxCount; 15 | 16 | 17 | @interface ZDLibffiVSAspectTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation ZDLibffiVSAspectTests 22 | 23 | // 执行被hook后的OC方法的效率 24 | #define HOOK_Libffi (0) 25 | - (void)testOCPerformanceAfterHook { 26 | printf("********************* %s\n", __PRETTY_FUNCTION__); 27 | SEL selector = @selector(a:b:c:); 28 | #if HOOK_Libffi 29 | [self.class zd_hookInstanceMethod:selector option:ZDHookOption_After callback:^(NSInteger a, NSString *b, id c){ 30 | //NSLog(@"###########收到Hook信息 ==> 小狗%zd岁了, %@, %@", a, b, c); 31 | }]; 32 | #else 33 | [self.class aspect_hookSelector:selector withOptions:AspectPositionAfter usingBlock:^(id info, NSInteger a, NSString *b, id c){ 34 | 35 | } error:nil]; 36 | #endif 37 | 38 | [self measureBlock:^{ 39 | for (NSInteger i = 0; i < MaxCount; ++i) { 40 | NSInteger arg1 = 100; 41 | NSString *arg2 = @"hello"; 42 | id arg3 = NSObject.class; 43 | [self a:arg1 b:arg2 c:arg3]; 44 | } 45 | }]; 46 | } 47 | 48 | #pragma mark - OC Method 49 | 50 | - (id)a:(NSInteger)a b:(NSString *)b c:(id)c { 51 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 52 | return ret; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /ZDLibffiDemoTests/ZDPerformanceTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZDPerformanceTests.m 3 | // ZDLibffiDemoTests 4 | // 5 | // Created by Zero.D.Saber on 2019/12/17. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | // 原生方法、Invocation、libffi调用方法的性能测试 9 | 10 | #import 11 | #import "NSObject+ZDAOP.h" 12 | 13 | FOUNDATION_EXPORT NSUInteger const MaxCount; 14 | 15 | @interface ZDPerformanceTests : XCTestCase 16 | 17 | @end 18 | 19 | @implementation ZDPerformanceTests 20 | 21 | #pragma mark - 性能测试 22 | 23 | // 用libffi执行oc方法的效率 24 | - (void)testLibffiPerformance { 25 | // This is an example of a performance test case. 26 | [self measureBlock:^{ 27 | for (NSInteger i = 0; i < MaxCount; ++i) { 28 | SEL selector = @selector(a:b:c:); 29 | NSMethodSignature *signature = [self methodSignatureForSelector:selector]; 30 | 31 | ffi_cif cif; 32 | ffi_type *argTypes[] = {&ffi_type_pointer, &ffi_type_pointer, &ffi_type_sint, &ffi_type_pointer, &ffi_type_pointer}; 33 | ffi_prep_cif(&cif, FFI_DEFAULT_ABI, (uint)signature.numberOfArguments, &ffi_type_pointer, argTypes); 34 | 35 | NSInteger arg1 = 100; 36 | NSString *arg2 = @"hello"; 37 | id arg3 = NSObject.class; 38 | void *args[] = {(void *)&self, &selector, &arg1, &arg2, &arg3}; 39 | __unsafe_unretained id ret = nil; 40 | IMP func = [self methodForSelector:selector]; 41 | ffi_call(&cif, func, &ret, args); 42 | } 43 | }]; 44 | } 45 | 46 | // Invitation执行OC方法的效率 47 | - (void)testInvocationPerformance { 48 | [self measureBlock:^{ 49 | for (NSInteger i = 0; i < MaxCount; ++i) { 50 | NSInteger arg1 = 100; 51 | NSString *arg2 = @"hello"; 52 | id arg3 = NSObject.class; 53 | __unsafe_unretained id retValue = nil; 54 | 55 | SEL selector = @selector(a:b:c:); 56 | NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:selector]]; 57 | [invocation setSelector:selector]; 58 | [invocation setArgument:&arg1 atIndex:2]; 59 | [invocation setArgument:&arg2 atIndex:3]; 60 | [invocation setArgument:&arg3 atIndex:4]; 61 | [invocation invokeWithTarget:self]; 62 | [invocation getReturnValue:&retValue]; 63 | //NSLog(@"### %@", retValue); 64 | } 65 | }]; 66 | } 67 | 68 | // 直接执行OC方法的效率 69 | - (void)testOCPerformance { 70 | [self measureBlock:^{ 71 | for (NSInteger i = 0; i < MaxCount; ++i) { 72 | NSInteger arg1 = 100; 73 | NSString *arg2 = @"hello"; 74 | id arg3 = NSObject.class; 75 | [self a:arg1 b:arg2 c:arg3]; 76 | } 77 | }]; 78 | } 79 | 80 | #pragma mark - OC Method 81 | 82 | - (id)a:(NSInteger)a b:(NSString *)b c:(id)c { 83 | NSString *ret = [NSString stringWithFormat:@"%zd + %@ + %@", a, b, c]; 84 | return ret; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /ZDLibffiDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ZDLibffiDemoUITests/ZDLibffiDemoUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ZDLibffiDemoUITests.m 3 | // ZDLibffiDemoUITests 4 | // 5 | // Created by Zero.D.Saber on 2019/12/12. 6 | // Copyright © 2019 Zero.D.Saber. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ZDLibffiDemoUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ZDLibffiDemoUITests 16 | 17 | - (void)setUp { 18 | // Put setup code here. This method is called before the invocation of each test method in the class. 19 | 20 | // In UI tests it is usually best to stop immediately when a failure occurs. 21 | self.continueAfterFailure = NO; 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | - (void)tearDown { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | } 29 | 30 | - (void)testExample { 31 | // UI tests must launch the application that they test. 32 | XCUIApplication *app = [[XCUIApplication alloc] init]; 33 | [app launch]; 34 | 35 | // Use recording to get started writing UI tests. 36 | // Use XCTAssert and related functions to verify your tests produce the correct results. 37 | } 38 | 39 | - (void)testLaunchPerformance { 40 | if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { 41 | // This measures how long it takes to launch your application. 42 | [self measureWithMetrics:@[XCTOSSignpostMetric.applicationLaunchMetric] block:^{ 43 | [[[XCUIApplication alloc] init] launch]; 44 | }]; 45 | } 46 | } 47 | 48 | @end 49 | --------------------------------------------------------------------------------