Commit 19adc908 authored by antz's avatar antz Committed by Commit bot

Revert "[Chromecast] Only include all libstdc++/libgcc symbols in executable as needed"

Reason for revert:
The original fix is opt-in, which causes unit test binaries to miss symbols. I will
reimplement an opt-out for binaries that we do not want to whole-archive libs.

Original issue description:
>> All chromecast executable include all libstdc++/libgcc symbols by default
>> due to b/25566835. Added a config for --whole-archive for only ones that
>> depend on shared libs. ~700kb saving per executable.

BUG=internal b/31417380

This reverts commit 92947f23.

Review-Url: https://codereview.chromium.org/2334163004
Cr-Commit-Position: refs/heads/master@{#418640}
parent 07ac77f3
...@@ -6,8 +6,6 @@ import("//build/config/chromecast_build.gni") ...@@ -6,8 +6,6 @@ import("//build/config/chromecast_build.gni")
assert(is_chromecast) assert(is_chromecast)
is_arm_chromecast_device = current_cpu == "arm" && !is_android
config("static_config") { config("static_config") {
ldflags = [ ldflags = [
# We want to statically link libstdc++/libgcc. # We want to statically link libstdc++/libgcc.
...@@ -36,10 +34,10 @@ config("ldconfig") { ...@@ -36,10 +34,10 @@ config("ldconfig") {
] ]
} }
# Whole archiving libgcc.a and libstdc++ is needed if dynamic shared libs are config("executable_config") {
# used, see b/25566835. configs = [ ":ldconfig" ]
config("executable_whole_archive_config") {
if (is_arm_chromecast_device) { if (current_cpu == "arm") {
ldflags = [ ldflags = [
# Export stdlibc++ and libgcc symbols to force shlibs to refer to these # Export stdlibc++ and libgcc symbols to force shlibs to refer to these
# symbols from the executable. # symbols from the executable.
...@@ -47,33 +45,25 @@ config("executable_whole_archive_config") { ...@@ -47,33 +45,25 @@ config("executable_whole_archive_config") {
"-lm", # stdlibc++ requires math.h "-lm", # stdlibc++ requires math.h
# In case we redefined stdlibc++ symbols (e.g. tc_malloc). # In case we redefined stdlibc++ symbols (e.g. tc_malloc)
"-Wl,--allow-multiple-definition", "-Wl,--allow-multiple-definition",
# Adding all symbols from libgcc and libstdc++.
"-Wl,--whole-archive", "-Wl,--whole-archive",
"-l:libstdc++.a", "-l:libstdc++.a",
"-l:libgcc.a", "-l:libgcc.a",
"-Wl,--no-whole-archive", "-Wl,--no-whole-archive",
] ]
}
}
# Statically linking against libstdc++/libgcc should happen for arm chromecast
# devices, and is not needed for Android builds.
config("executable_config") {
configs = [ ":ldconfig" ]
if (is_arm_chromecast_device) { # Despite including libstdc++/libgcc archives, we still need to specify
# Statically link libstdc++ and libgcc to avoid having a dynamic dependency # static linking for them in order to prevent the executable from having a
# on them. # dynamic dependency on them.
configs += [ ":static_config" ] configs += [ ":static_config" ]
} }
} }
config("shared_library_config") { config("shared_library_config") {
configs = [ ":ldconfig" ] configs = [ ":ldconfig" ]
if (is_arm_chromecast_device) { if (current_cpu == "arm") {
configs += [ ":static_config" ] configs += [ ":static_config" ]
} }
} }
...@@ -223,10 +223,6 @@ executable("cast_shell") { ...@@ -223,10 +223,6 @@ executable("cast_shell") {
if (chromecast_branding != "public") { if (chromecast_branding != "public") {
deps += [ "//chromecast/internal:cast_shell_internal" ] deps += [ "//chromecast/internal:cast_shell_internal" ]
} }
# Whole archiving libgcc.a and libstdc++ is needed if dynamic share libs are
# used, see b/25566835.
configs += [ "//build/config/chromecast:executable_whole_archive_config" ]
} }
repack("cast_shell_pak") { repack("cast_shell_pak") {
......
...@@ -62,10 +62,6 @@ executable("crash_uploader") { ...@@ -62,10 +62,6 @@ executable("crash_uploader") {
if (chromecast_branding != "public") { if (chromecast_branding != "public") {
deps += [ "//chromecast/base:cast_sys_info_shlib" ] deps += [ "//chromecast/base:cast_sys_info_shlib" ]
# Whole archiving libgcc.a and libstdc++ is needed if dynamic share libs
# are used, see b/25566835.
configs += [ "//build/config/chromecast:executable_whole_archive_config" ]
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment