OLD | NEW |
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 config("static_config") { | 9 config("static_config") { |
10 ldflags = [ | 10 ldflags = [ |
11 # We want to statically link libstdc++/libgcc. | 11 # We want to statically link libstdc++/libgcc. |
12 "-static-libstdc++", | 12 "-static-libstdc++", |
13 "-static-libgcc", | 13 "-static-libgcc", |
14 | 14 |
15 # Don't allow visible symbols from libraries that contain | 15 # Don't allow visible symbols from libraries that contain |
16 # assembly code with symbols that aren't hidden properly. | 16 # assembly code with symbols that aren't hidden properly. |
17 # http://b/26390825 | 17 # http://b/26390825 |
18 "-Wl,--exclude-libs=libffmpeg.a", | 18 "-Wl,--exclude-libs=libffmpeg.a", |
19 ] | 19 ] |
20 } | 20 } |
21 | 21 |
| 22 config("ldconfig") { |
| 23 visibility = [ ":*" ] |
| 24 |
| 25 # Chromecast executables depend on several shared libraries in $ORIGIN. Add |
| 26 # $ORIGIN to the rpath of these executables. This is not inherited by default |
| 27 # when depending on these targets for security reasons (see comments in |
| 28 # //build/config/gcc/BUILD.gn) |
| 29 configs = [ "//build/config/gcc:rpath_for_built_shared_libraries" ] |
| 30 } |
| 31 |
22 config("executable_config") { | 32 config("executable_config") { |
| 33 configs = [ ":ldconfig" ] |
| 34 |
23 if (current_cpu == "arm") { | 35 if (current_cpu == "arm") { |
24 ldflags = [ | 36 ldflags = [ |
25 # Export stdlibc++ and libgcc symbols to force shlibs to refer to these | 37 # Export stdlibc++ and libgcc symbols to force shlibs to refer to these |
26 # symbols from the executable. | 38 # symbols from the executable. |
27 "-Wl,--export-dynamic", | 39 "-Wl,--export-dynamic", |
28 | 40 |
29 "-lm", # stdlibc++ requires math.h | 41 "-lm", # stdlibc++ requires math.h |
30 | 42 |
31 # In case we redefined stdlibc++ symbols (e.g. tc_malloc) | 43 # In case we redefined stdlibc++ symbols (e.g. tc_malloc) |
32 "-Wl,--allow-multiple-definition", | 44 "-Wl,--allow-multiple-definition", |
33 | 45 |
34 "-Wl,--whole-archive", | 46 "-Wl,--whole-archive", |
35 "-l:libstdc++.a", | 47 "-l:libstdc++.a", |
36 "-l:libgcc.a", | 48 "-l:libgcc.a", |
37 "-Wl,--no-whole-archive", | 49 "-Wl,--no-whole-archive", |
38 ] | 50 ] |
39 | 51 |
40 # Despite including libstdc++/libgcc archives, we still need to specify | 52 # Despite including libstdc++/libgcc archives, we still need to specify |
41 # static linking for them in order to prevent the executable from having a | 53 # static linking for them in order to prevent the executable from having a |
42 # dynamic dependency on them. | 54 # dynamic dependency on them. |
43 configs = [ ":static_config" ] | 55 configs += [ ":static_config" ] |
44 } | 56 } |
45 } | 57 } |
46 | 58 |
47 config("shared_library_config") { | 59 config("shared_library_config") { |
| 60 configs = [ ":ldconfig" ] |
48 if (current_cpu == "arm") { | 61 if (current_cpu == "arm") { |
49 configs = [ ":static_config" ] | 62 configs += [ ":static_config" ] |
50 } | 63 } |
51 } | 64 } |
OLD | NEW |