envoyproxy / envoy-mobile

Client HTTP and networking library based on the Envoy project for iOS, Android, and more.
https://envoymobile.io
Apache License 2.0
562 stars 84 forks source link

support binary size analysis tool with split DWARF support #1274

Open junr03 opened 3 years ago

junr03 commented 3 years ago

After this change Envoy starting using split DWARF capabilities to reduce link time and binary size when compiling debug symbols. However, Bloaty (the analysis tool documented in the Envoy Mobile docs) does not support using .dwp files as a source for debug symbols (tracked in this issue

junr03 commented 3 years ago

Applying this patch to the Envoy submodule reverts split DWARF support in upstream envoy and allows the analysis documented in Envoy Mobile.

diff --git a/.bazelrc b/.bazelrc
index c7a6e779b..5c57d6675 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -24,8 +24,6 @@ build --enable_platform_specific_config
 build:linux --copt=-fPIC
 build:linux --cxxopt=-std=c++17
 build:linux --conlyopt=-fexceptions
-build:linux --fission=dbg,opt
-build:linux --features=per_object_debug_info

 # We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace.
 build --define absl=1
diff --git a/bazel/envoy_internal.bzl b/bazel/envoy_internal.bzl
index fc41557fe..b19656466 100644
--- a/bazel/envoy_internal.bzl
+++ b/bazel/envoy_internal.bzl
@@ -50,9 +50,9 @@ def envoy_copts(repository, test = False):
                # debugging info detailing some 1600 test binaries would be wasteful.
                # targets listed in order from generic to increasing specificity.
                # Bazel adds an implicit -DNDEBUG for opt targets.
-               repository + "//bazel:opt_build": [] if test else ["-ggdb3", "-gsplit-dwarf"],
+               repository + "//bazel:opt_build": [] if test else ["-ggdb3"],
                repository + "//bazel:fastbuild_build": [],
-               repository + "//bazel:dbg_build": ["-ggdb3", "-gsplit-dwarf"],
+               repository + "//bazel:dbg_build": ["-ggdb3"],
                repository + "//bazel:windows_opt_build": [] if test else ["-Z7"],
                repository + "//bazel:windows_fastbuild_build": [],
                repository + "//bazel:windows_dbg_build": [],
Reflejo commented 3 years ago

Note ^ This was removed already from envoy as part as my effort to improve the local debugging experience. So no need for that diff anymore