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:
Create a new Xcode project with type "Cocoa Touch Framework"
Change the MACH_O_TYPE build setting to be mh_object (Relocatable Object File in the UI)
Archive the project for "Generic iOS Device"
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
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:
Expected Results:
-Xlinker -bitcode_hide_symbols
should not be passed by default. Instead theHIDE_BITCODE_SYMBOLS
Build Setting should be surfaced in Xcode and NO by defaultActual Results: In this case
-Xlinker -bitcode_hide_symbols
is passed unless you setHIDE_BITCODE_SYMBOLS
toNO
as a user defined settingVersion: Xcode 9.1 (9B55)
Notes:
To extract the bitcode run:
Then run
nm
on any of the created numbered files in the same directory. You will see output like this: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