小编tml*_*tml的帖子

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

如果您编译此文件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代码库中的某些低级内容.

c++ clang typeinfo ios arm64

8
推荐指数
1
解决办法
608
查看次数

标签 统计

arm64 ×1

c++ ×1

clang ×1

ios ×1

typeinfo ×1