HIDE_BITCODE_SYMBOLS should be NO by default

Originator:keithbsmiley
Number:rdar://35781555 Date Originated:30-Nov-2017 13:53
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.1 (9B55)
Classification:Serious Bug Reproducible:Always
 
Summary:
In Xcode there is an undocumented build setting called HIDE_BITCODE_SYMBOLS, this setting translates later to LD_HIDE_BITCODE_SYMBOLS, and eventually causes `-Xlinker -bitcode_hide_symbols` to be passed to the compiler in some cases.

One example case of this is if you create a framework bundle where the MACH_O_TYPE is mh_object (or "Relocatable Object File").

Passing these arguments to the linker results in the final binary's bitcode to have all its symbols replaced with `__hidden` symbols instead. This makes crash reports extremely difficult to debug.

Neither of the above build settings are surfaced in the Build Settings tab of Xcode either, so I assume many projects where this behavior applies, aren't doing it intentionally.

Steps to Reproduce:
1. Create a new Xcode project with type "Cocoa Touch Framework"
2. Change the MACH_O_TYPE build setting to be mh_object (Relocatable Object File in the UI)
3. Archive the project for "Generic iOS Device"
4. Check the "Link" step in the build log

Expected Results:
`-Xlinker -bitcode_hide_symbols` should not be passed by default. Instead the `HIDE_BITCODE_SYMBOLS` Build Setting should be surfaced in Xcode and NO by default

Actual Results:
In this case `-Xlinker -bitcode_hide_symbols` is passed unless you set `HIDE_BITCODE_SYMBOLS` to `NO` as a user defined setting

Version:
Xcode 9.1 (9B55)

Notes:
- This setting doesn't seem to be used for either dynamic frameworks nor static libraries
- To see an example of this in the wild download GoogleMaps 2.5.0 https://dl.google.com/dl/cpdc/6e5f7d9da3112ca6/GoogleMaps-2.5.0.tar.gz and extract the bitcode from it.

To extract the bitcode run:

```
$ cd GoogleMaps.framework
$ lipo -thin arm64 -output slice GoogleMaps
$ segedit slice -extract __LLVM __bundle slice.arm64.xar
$ xar -xf slice.arm64.xar
```

Then run `nm` on any of the created numbered files in the same directory. You will see output like this:

```
$ nm 001 | grep __hidden
---------------- t __hidden#0_
...
```

These __hidden symbols eventually make it into crash reports in Xcode like the one attached.

Comments


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!