Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: build/config/chromecast/BUILD.gn

Issue 2334163004: Revert "[Chromecast] Only include all libstdc++/libgcc symbols in executable as needed" (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chromecast/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/chromecast_build.gni") 5 import("//build/config/chromecast_build.gni")
6 6
7 assert(is_chromecast) 7 assert(is_chromecast)
8 8
9 is_arm_chromecast_device = current_cpu == "arm" && !is_android
10
11 config("static_config") { 9 config("static_config") {
12 ldflags = [ 10 ldflags = [
13 # We want to statically link libstdc++/libgcc. 11 # We want to statically link libstdc++/libgcc.
14 "-static-libstdc++", 12 "-static-libstdc++",
15 "-static-libgcc", 13 "-static-libgcc",
16 14
17 # Don't allow visible symbols from libraries that contain 15 # Don't allow visible symbols from libraries that contain
18 # assembly code with symbols that aren't hidden properly. 16 # assembly code with symbols that aren't hidden properly.
19 # http://b/26390825 17 # http://b/26390825
20 "-Wl,--exclude-libs=libffmpeg.a", 18 "-Wl,--exclude-libs=libffmpeg.a",
21 ] 19 ]
22 } 20 }
23 21
24 config("ldconfig") { 22 config("ldconfig") {
25 visibility = [ ":*" ] 23 visibility = [ ":*" ]
26 24
27 # Chromecast executables depend on several shared libraries in 25 # Chromecast executables depend on several shared libraries in
28 # /oem_cast_shlib, $ORIGIN, and $ORIGIN/lib. Add these rpaths to each binary. 26 # /oem_cast_shlib, $ORIGIN, and $ORIGIN/lib. Add these rpaths to each binary.
29 # This is explicitly disabled in Chrome for security reasons (see comments in 27 # This is explicitly disabled in Chrome for security reasons (see comments in
30 # //build/config/gcc/BUILD.gn), but necessary on Chromecast so that OEM's may 28 # //build/config/gcc/BUILD.gn), but necessary on Chromecast so that OEM's may
31 # override the default libraries shipped in the Cast receiver package. 29 # override the default libraries shipped in the Cast receiver package.
32 ldflags = [ 30 ldflags = [
33 "-Wl,-rpath=/oem_cast_shlib", 31 "-Wl,-rpath=/oem_cast_shlib",
34 "-Wl,-rpath=\$ORIGIN/lib", 32 "-Wl,-rpath=\$ORIGIN/lib",
35 "-Wl,-rpath=\$ORIGIN", 33 "-Wl,-rpath=\$ORIGIN",
36 ] 34 ]
37 } 35 }
38 36
39 # Whole archiving libgcc.a and libstdc++ is needed if dynamic shared libs are 37 config("executable_config") {
40 # used, see b/25566835. 38 configs = [ ":ldconfig" ]
41 config("executable_whole_archive_config") { 39
42 if (is_arm_chromecast_device) { 40 if (current_cpu == "arm") {
43 ldflags = [ 41 ldflags = [
44 # Export stdlibc++ and libgcc symbols to force shlibs to refer to these 42 # Export stdlibc++ and libgcc symbols to force shlibs to refer to these
45 # symbols from the executable. 43 # symbols from the executable.
46 "-Wl,--export-dynamic", 44 "-Wl,--export-dynamic",
47 45
48 "-lm", # stdlibc++ requires math.h 46 "-lm", # stdlibc++ requires math.h
49 47
50 # In case we redefined stdlibc++ symbols (e.g. tc_malloc). 48 # In case we redefined stdlibc++ symbols (e.g. tc_malloc)
51 "-Wl,--allow-multiple-definition", 49 "-Wl,--allow-multiple-definition",
52 50
53 # Adding all symbols from libgcc and libstdc++.
54 "-Wl,--whole-archive", 51 "-Wl,--whole-archive",
55 "-l:libstdc++.a", 52 "-l:libstdc++.a",
56 "-l:libgcc.a", 53 "-l:libgcc.a",
57 "-Wl,--no-whole-archive", 54 "-Wl,--no-whole-archive",
58 ] 55 ]
59 }
60 }
61 56
62 # Statically linking against libstdc++/libgcc should happen for arm chromecast 57 # Despite including libstdc++/libgcc archives, we still need to specify
63 # devices, and is not needed for Android builds. 58 # static linking for them in order to prevent the executable from having a
64 config("executable_config") { 59 # dynamic dependency on them.
65 configs = [ ":ldconfig" ]
66
67 if (is_arm_chromecast_device) {
68 # Statically link libstdc++ and libgcc to avoid having a dynamic dependency
69 # on them.
70 configs += [ ":static_config" ] 60 configs += [ ":static_config" ]
71 } 61 }
72 } 62 }
73 63
74 config("shared_library_config") { 64 config("shared_library_config") {
75 configs = [ ":ldconfig" ] 65 configs = [ ":ldconfig" ]
76 if (is_arm_chromecast_device) { 66 if (current_cpu == "arm") {
77 configs += [ ":static_config" ] 67 configs += [ ":static_config" ]
78 } 68 }
79 } 69 }
OLDNEW
« no previous file with comments | « no previous file | chromecast/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698