Automated rollback of commit 6989b830b6406ec84db56043ad886db665a3abd1. *** Reason for rollback *** This change isn't necessary. On macOS, all compiled apps have their debug data spread out across all generated .o files, rather than linking it directly into the binary. The binary itself has a small debug map to point to these .o files. The .dSYM bundle pulls all the information from those .o files into a common binary structure, but this is typically assumed to be optional. https://stackoverflow.com/a/12827463 https://stackoverflow.com/a/33307778 (to a lesser extent) Meanwhile, this -g0 is ignored as it follows the '-g' to emit debug symbols. Clang's response to combining these flags is to read the '-g' first and ignore later flags related to emitting debug symbols. Because the dSYM bundle is composed directly from the generated .o files and the debug map, there is not a fantastic way to defer or mitigate that cost. Some investigation could be done of the dsymutil -minimize feature that has been in macOS for some time, and recently upstreamed in llvm-dsymutil (https://reviews.llvm.org/D42688), but that is not yet a priority. PiperOrigin-RevId: 187017593
diff --git a/src/TulsiGenerator/Scripts/bazel_build.py b/src/TulsiGenerator/Scripts/bazel_build.py index 2867409..6066805 100755 --- a/src/TulsiGenerator/Scripts/bazel_build.py +++ b/src/TulsiGenerator/Scripts/bazel_build.py
@@ -188,18 +188,9 @@ # The build configurations handled by this parser. KNOWN_CONFIGS = ['Debug', 'Release', 'Fastbuild'] - def __init__(self, sdk_version, platform_name, arch, main_group_path, - generate_dsym): + def __init__(self, sdk_version, platform_name, arch, main_group_path): self.targets = [] self.startup_options = collections.defaultdict(list) - debug_options = [ - '--compilation_mode=dbg', - ] - if generate_dsym: - # Avoid linking debug symbols in the binary, which will be in the - # dSYM bundle instead. Allows for faster incremental builds with - # dSYM bundles, and reduced duplication of debug info. - debug_options.append('--copt=-g0') self.build_options = collections.defaultdict( list, { @@ -208,7 +199,9 @@ '--announce_rc', ], - 'Debug': debug_options, + 'Debug': [ + '--compilation_mode=dbg', + ], 'Release': [ '--compilation_mode=opt', @@ -617,8 +610,7 @@ parser = _OptionsParser(self.sdk_version, self.platform_name, self.arch, - self.main_group_path, - self.generate_dsym) + self.main_group_path) timer = Timer('Parsing options', 'parsing_options').Start() message, exit_code = parser.ParseOptions(args[1:]) timer.End() @@ -1461,7 +1453,7 @@ outfile.write('command source %s\n' % self._TULSI_LLDBINIT_EPILOGUE_FILE) def _UpdateLLDBInit(self, clear_source_map=False): - """Updates ~/.lldbinit-tulsi for debugging of Bazel binaries.""" + """Updates ~/.lldbinit-tulsi to enable debugging of Bazel binaries.""" # Apple Watch app binaries do not contain any sources. if self.product_type == 'com.apple.product-type.application.watchapp2':