lionheart / openradar-mirror

A mirror of radars pulled from http://openradar.me/.
245 stars 17 forks source link

35781555: HIDE_BITCODE_SYMBOLS should be NO by default #18994

Open openradar-mirror opened 6 years ago

openradar-mirror commented 6 years ago

Description

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:

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.

- Product Version: Xcode 9.1 (9B55) Created: 2017-11-30T21:53:18.493780 Originated: 2017-11-30T13:53:00 Open Radar Link: http://www.openradar.me/35781555

openradar-mirror commented 6 years ago

Modified: 2018-01-30T02:03:15.684340