为什么Apple的Clang(来自Xcode 5)为arm64制作typeinfos private_extern?

tml*_*tml 8 c++ clang typeinfo ios arm64

如果您编译此文件p3.cxx:

class foobarclass
{
 public:
  int i0;
};

void otherfun(void);
void mumble(void);

void fun(void)
{
  try {
    otherfun();
  } catch(foobarclass &e) {
    mumble();
  }
}
Run Code Online (Sandbox Code Playgroud)

像这样:

xcrun clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -fexceptions -c p3.cxx -p3.64.o
Run Code Online (Sandbox Code Playgroud)

xcrun clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -fexceptions -c p3.cxx -o p3.32.o
Run Code Online (Sandbox Code Playgroud)

然后检查"typeinfo for foobarclass"的符号:

nm -m p3.64.o|grep ZTI
0000000000000110 (__DATA,__datacoal_nt) weak private external __ZTI11foobarclass

nm -m p3.32.o|grep ZTI
00000134 (__DATA,__datacoal_nt) weak external __ZTI11foobarclass
Run Code Online (Sandbox Code Playgroud)

为什么arm64中的符号弱私有外部?这意味着dlsym()将无法在运行时找到它.这打破了LibreOffice代码库中的某些低级内容.

Vis*_*tri -2

将构建设置中的体系结构设置为标准体系结构(armv7,armv7s)

ARCHS = **armv7 armv7s**

VALID_ARCHS = **armv6 armv7 armv7s**
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Xcode 可以构建包含 32 位和 64 位二进制文​​件的应用程序。此组合二进制文件需要 iOS 7 或更高版本的最低部署目标。

注意:未来版本的 Xcode 将允许您创建一个在 iOS 6 及更高版本上支持 32 位运行时以及在 iOS 7 上支持 64 位运行时的单个应用程序。

  • Xcode 可以为单个应用程序创建 64 位和 32 位二进制文​​件,但部署目标应该是 iOS7。
  • 他们说将来 iOS 6.0 32 位二进制将在 iPhone 5S(64 位处理器)上正常工作。

更新 在 Xcode 5.0.1 中,他们添加了为 iOS 5.1.1 及以上版本创建 64 位二进制文​​件的支持。

Xcode 5.0.1 可以构建包含 32 位和 64 位二进制文​​件的应用程序。此组合二进制文件需要 iOS 5.1.1 或更高版本的最低部署目标。64 位二进制文​​件仅在运行 iOS 7.0.3 及更高版本的 64 位设备上运行。