Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM64e未适配 #15

Closed
sthyuhao opened this issue Dec 9, 2019 · 2 comments
Closed

ARM64e未适配 #15

sthyuhao opened this issue Dec 9, 2019 · 2 comments

Comments

@sthyuhao
Copy link

sthyuhao commented Dec 9, 2019

我这打静态库的时候出现编译失败的问题

@sthyuhao
Copy link
Author

sthyuhao commented Dec 9, 2019

------------命令(xcodebuild build -workspace gen/App.xcworkspace -scheme XXX -configuration 'Debug' -sdk iphoneos -arch 'arm64e' SYMROOT='../../BuildTemp')执行错误------------

@sthyuhao
Copy link
Author

sthyuhao commented Dec 13, 2019

/*

  • By default, the pointer fields in the arm_thread_state64_t structure are
  • opaque on the arm64e architecture and require the use of accessor macros.
  • This mode can also be enabled on the arm64 architecture by building with
  • -D__DARWIN_OPAQUE_ARM_THREAD_STATE64=1.
    */
    #if defined(arm64) && defined(LP64)

#if __has_feature(ptrauth_calls)
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 1
#define __DARWIN_PTRAUTH_ARM_THREAD_STATE64 1
#endif /* __has_feature(ptrauth_calls) */

#ifndef __DARWIN_OPAQUE_ARM_THREAD_STATE64
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0
#endif

#else /* defined(arm64) && defined(LP64) */

#undef __DARWIN_OPAQUE_ARM_THREAD_STATE64
#define __DARWIN_OPAQUE_ARM_THREAD_STATE64 0

#endif /* defined(arm64) && defined(LP64) */

库里的注释说明了在arm64e架构下需要开启_DARWIN_OPAQUE_ARM_THREAD_STATE64,开始天真的以为有__arm64__就会有__arm64e__。通过源码的调用方式修改一下属性就行了

`

uintptr_t bs_mach_framePointer(_STRUCT_MCONTEXT * const machineContext) {

#if __has_feature(ptrauth_calls)

    return machineContext->__ss.__opaque_fp;

#else

    return machineContext->__ss.__fp;

#endif

}

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant