Skip to content

Commit

Permalink
Revert "[Chromecast] Only include all libstdc++/libgcc symbols in exe…
Browse files Browse the repository at this point in the history
…cutable 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 92947f2.

Review-Url: https://codereview.chromium.org/2334163004
Cr-Commit-Position: refs/heads/master@{#418640}
  • Loading branch information
antz authored and Commit bot committed Sep 14, 2016
1 parent 07ac77f commit 19adc90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 27 deletions.
28 changes: 9 additions & 19 deletions build/config/chromecast/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import("//build/config/chromecast_build.gni")

assert(is_chromecast)

is_arm_chromecast_device = current_cpu == "arm" && !is_android

config("static_config") {
ldflags = [
# We want to statically link libstdc++/libgcc.
Expand Down Expand Up @@ -36,44 +34,36 @@ config("ldconfig") {
]
}

# Whole archiving libgcc.a and libstdc++ is needed if dynamic shared libs are
# used, see b/25566835.
config("executable_whole_archive_config") {
if (is_arm_chromecast_device) {
config("executable_config") {
configs = [ ":ldconfig" ]

if (current_cpu == "arm") {
ldflags = [
# Export stdlibc++ and libgcc symbols to force shlibs to refer to these
# symbols from the executable.
"-Wl,--export-dynamic",

"-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",

# Adding all symbols from libgcc and libstdc++.
"-Wl,--whole-archive",
"-l:libstdc++.a",
"-l:libgcc.a",
"-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) {
# Statically link libstdc++ and libgcc to avoid having a dynamic dependency
# on them.
# Despite including libstdc++/libgcc archives, we still need to specify
# static linking for them in order to prevent the executable from having a
# dynamic dependency on them.
configs += [ ":static_config" ]
}
}

config("shared_library_config") {
configs = [ ":ldconfig" ]
if (is_arm_chromecast_device) {
if (current_cpu == "arm") {
configs += [ ":static_config" ]
}
}
4 changes: 0 additions & 4 deletions chromecast/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ executable("cast_shell") {
if (chromecast_branding != "public") {
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") {
Expand Down
4 changes: 0 additions & 4 deletions chromecast/crash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ executable("crash_uploader") {

if (chromecast_branding != "public") {
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" ]
}
}

Expand Down

0 comments on commit 19adc90

Please sign in to comment.