Async Await crash on iOS14 with Xcode 13.2.1

It looks like part of the problem is that the chained fixups seg_count is 5, which corresponds to:

chained starts in image
  seg_count = 5
    seg_offset[0] = 0 (__TEXT)
    seg_offset[1] = 24 (__DATA_CONST)
    seg_offset[2] = 48 (__DATA)
    seg_offset[3] = 0 (__LLVM)
    seg_offset[4] = 0 (__LINKEDIT)

But then when you build your app, Xcode appears to strip bitcode from the dylib (since it isn't used by default in debug mode), but the fixups seg_count remains 5, so the output from otool actually appears to overflow and show something that's no a segment in its previous place:

chained starts in image
  seg_count = 5
    seg_offset[0] = 0 (__TEXT)
    seg_offset[1] = 24 (__DATA_CONST)
    seg_offset[2] = 48 (__DATA)
    seg_offset[3] = 0 (__LINKEDIT)
    seg_offset[4] = 0 (libobjc)

Interestingly if I set the undocumented BITCODE_GENERATION_MODE=bitcode build setting to force bitcode even in debug mode, the dylib still contains bitcode so it gets past the original issue, but I get a different crash still in dyld.

1 Like