Symbolication issue with SPM 5.3 packages containing resources (BCSymbolMaps contains _hidden entries)

Originator:defagos
Number:rdar://FB8932965 Date Originated:Dec 8, 2020
Status:Open Resolved:
Product:Xcode Product Version:12.2
Classification:Incorrect/Unexpected behavior Reproducible:Always
 
> Please describe the issue:

SPM 5.3 was introduced with Xcode 12.0. This version in particular allows resources to be provided within a Swift package. But if resources are bundled within a package product, the associated BCSymbolMaps entries are _hidden when archiving a project linked with the package.

As a result crash log symbolication is incomplete and associated symbols appear as _hidden. This makes crash logs from App Store Connect (or App Center and similar services) very hard to read, as symbols of affected libraries all appear as _hidden.

Note that this issue also affects Xcode 12.3 beta 1.


> Please list the steps you took to reproduce the issue:

I created a sample project, attached to this issue in a zip file. The project contains a Swift package with 4 combination of programming languages and resource bundling:

- An Objective-C library without resources (ObjCWithoutResources).
- An Objective-C library with resources (ObjCWithResources).
- A Swift library without resources (SwiftWithoutResources).
- A Swift library with resources (SwiftWithResources).

Objective-C products expose a class with a class and an instance method, as well as a global-scope function. Swift products expose a struct and an enum with similar methods, as well as a global-scope function. The idea is to see whether public symbols for these entities are then found in the BCSymbolMaps exported for a project using such products.

An Example workspace is therefore provided as well. Out of the zip file it links with all 4 products but does not use them directly in its source code. The idea is to use this project with the 4 products above, but linked one at a time to get the BCSymbolMaps for each case:

1. Open the Example workspace.
2. Under Frameworks, Libraries and Embedded Content (General tab of the Example target), remove all libraries except ObjCWithoutResources.
2. Archive the project.
3. Open the xcarchive and extract the BCSymbolMaps.

Repeat again these four steps by linking the Example project successively with the other 3 individual package products (ObjCWithResources, SwiftWithoutResources, SwiftWithResources). You will get 4 symbol maps.

For convenience I attached the 4 obtained BCSymbolMaps to this issue, as well as two screenshots of my diff tool for comparison between the two Objective-C cases, respectively the two Swift cases. You can see that when resources are bundled the symbol maps contain a lot of _hidden entries, which are readable when no resources are bundled. This is true for both Objective-C and Swift package products (I initially thought only Objective-C might be affected).


> What did you expect to happen?

For products integrating Swift 5.3 packages containing resources, crash logs are properly symbolicated.


> What actually happened?

For products integrating Swift 5.3 packages containing resources, crash logs are not properly symbolicated, due to incomplete BCSymbolMaps.

Comments

Xcode 12.5 beta 1 seems to have a fix. I've tried successfully with the shared example.

By py.bertholon at Feb. 6, 2021, 7:15 p.m. (reply...)

Sample code and mentioned documents

See https://github.com/defagos/radars/tree/master/spm-symbolication-issues


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!