简体   繁体   中英

Why does Apple's Clang (from Xcode 5) make typeinfos private_extern for arm64?

If you compile this file p3.cxx:

class foobarclass
{
 public:
  int i0;
};

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

void fun(void)
{
  try {
    otherfun();
  } catch(foobarclass &e) {
    mumble();
  }
}

Like this:

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

and

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

and then check the symbol of the "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

Why is the symbol weak private external in the arm64 case? This means dlsym() won't find it at run-time. This breaks certain low-level stuff in the LibreOffice codebase.

I asked the same question in the relevant Apple Developer forum, and got the reply that this is intentional, to reduce the number of globally visible symbols in an executable. So I will just have to live with it.

Set the architecture in build setting to Standard architectures(armv7,armv7s)

ARCHS = **armv7 armv7s**

VALID_ARCHS = **armv6 armv7 armv7s**

在此处输入图片说明

Xcode can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 7 or later.

Note: A future version of Xcode will let you create a single app that supports the 32-bit runtime on iOS 6 and later, and that supports the 64-bit runtime on iOS 7.

  • Xcode can create both 64bit 32bit binaries for a single app but the deployment target should be iOS7.
  • They are saying in future it will be iOS 6.0 32 bit binary will work fine in iPhone 5S(64 bit processor).

Update In Xcode 5.0.1 they added the support to create 64 bit binary for iOS 5.1.1 onwards.

Xcode 5.0.1 can build your app with both 32-bit and 64-bit binaries included. This combined binary requires a minimum deployment target of iOS 5.1.1 or later. The 64-bit binary runs only on 64-bit devices running iOS 7.0.3 and later.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM