blob: f1cbfe61946fb68e18ab195dc1e3e9aae4012ad7 [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001# Copyright 2015 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/chromecast_build.gni")
6
7assert(is_chromecast)
8
9config("static_config") {
10 ldflags = [
11 # We want to statically link libstdc++/libgcc.
12 "-static-libstdc++",
13 "-static-libgcc",
14
15 # Don't allow visible symbols from libraries that contain
16 # assembly code with symbols that aren't hidden properly.
17 # http://b/26390825
18 "-Wl,--exclude-libs=libffmpeg.a",
19 ]
20}
21
22config("ldconfig") {
23 visibility = [ ":*" ]
24
25 # Chromecast executables depend on several shared libraries in
26 # /oem_cast_shlib, $ORIGIN, and $ORIGIN/lib. Add these rpaths to each binary.
27 # This is explicitly disabled in Chrome for security reasons (see comments in
28 # //build/config/gcc/BUILD.gn), but necessary on Chromecast so that OEM's may
29 # override the default libraries shipped in the Cast receiver package.
30 ldflags = [
31 "-Wl,-rpath=/oem_cast_shlib",
32 "-Wl,-rpath=\$ORIGIN/lib",
33 "-Wl,-rpath=\$ORIGIN",
34 ]
35}
36
37config("executable_config") {
38 configs = [ ":ldconfig" ]
39
40 if (current_cpu == "arm") {
41 ldflags = [
42 # Export stdlibc++ and libgcc symbols to force shlibs to refer to these
43 # symbols from the executable.
44 "-Wl,--export-dynamic",
45
46 "-lm", # stdlibc++ requires math.h
47
48 # In case we redefined stdlibc++ symbols (e.g. tc_malloc)
49 "-Wl,--allow-multiple-definition",
50
51 "-Wl,--whole-archive",
52 "-l:libstdc++.a",
53 "-l:libgcc.a",
54 "-Wl,--no-whole-archive",
55 ]
56
57 # Despite including libstdc++/libgcc archives, we still need to specify
58 # static linking for them in order to prevent the executable from having a
59 # dynamic dependency on them.
60 configs += [ ":static_config" ]
61 }
62}
63
64config("shared_library_config") {
65 configs = [ ":ldconfig" ]
66 if (current_cpu == "arm") {
67 configs += [ ":static_config" ]
68 }
69}