summaryrefslogtreecommitdiffstats
path: root/build/config/gcc/BUILD.gn
blob: edfb92c768fec30d14f1e1b35c277b4c8a42e2ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# This config causes functions not to be automatically exported from shared
# libraries. By default, all symbols are exported but this means there are
# lots of exports that slow everything down. In general we explicitly mark
# which functiosn we want to export from components.
#
# Some third_party code assumes all functions are exported so this is separated
# into its own config so such libraries can remove this config to make symbols
# public again.
#
# See http://gcc.gnu.org/wiki/Visibility
config("symbol_visibility_hidden") {
  # Note that -fvisibility-inlines-hidden is set globally in the compiler
  # config since that can almost always be applied.
  cflags = [ "-fvisibility=hidden" ]
}

# Settings for executables and shared libraries.
config("executable_ldconfig") {
  if (is_android) {
    ldflags = [
      "-Bdynamic",
      "-Wl,-z,nocopyreloc",
    ]
  } else {
    # Android doesn't support rpath.
    ldflags = [
      # Want to pass "\$". GN will re-escape as required for ninja.
      "-Wl,-rpath=\$ORIGIN/",
      "-Wl,-rpath-link=",

      # Newer binutils don't set DT_RPATH unless you disable "new" dtags
      # and the new DT_RUNPATH doesn't work without --no-as-needed flag.
      "-Wl,--disable-new-dtags",
    ]
  }
}

config("no_exceptions") {
  cflags_cc = [ "-fno-exceptions" ]
  cflags_objcc = cflags_cc
}