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
   46
   47
   48
   49
   50
   51
   52
   53

chrome / android / static_initializers.gni [blame]

# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/features.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//components/optimization_guide/features.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//ui/gl/features.gni")

# The check_chrome_static_initializers target will cause release bots to fail if
# the count of static initializers change in either direction. Please try not to
# increase the numbers. If they come from third-party code, please try to update
# the code, or apply a local modification to remove them.
#
# Some helpful hints at //docs/static_initializers.md
if (proprietary_codecs && !is_debug && !is_component_build) {
  # Comments show static_initializers according to
  # tools/linux/dump-static-initializers.py.
  _chrome_common_count = 0
  _chrome_64only_count = 0

  # 64bit only:
  # Caused by "outline atomics". https://crbug.com/1272795
  # cpu_model.c: init_have_lse_atomics, init_cpu_features
  _chrome_64only_count += 2

  # 64bit only:
  # Caused by AArch64 SME.
  # sme-abi-init.c: init_aarch64_has_sme
  _chrome_64only_count += 1

  # iostream.cpp: _GLOBAL__I_000101
  _chrome_common_count += 1

  # v8/src/parsing/token.cc: _GLOBAL__sub_I_token.cc
  _chrome_common_count += 1

  if (use_clang_coverage) {
    # InstrProfilingRuntime.cpp, Only in coverage builds, not production.
    _chrome_common_count += 1
  }

  # Define expectations only for GN args covered by android-binary-size trybot.
  if ((target_cpu == "arm" && !is_high_end_android) ||
      (target_cpu == "arm64" && !is_high_end_android_secondary_toolchain)) {
    expected_static_initializer_32bit_count = _chrome_common_count
  }
  if (target_cpu == "arm64" && is_high_end_android) {
    expected_static_initializer_64bit_count =
        _chrome_common_count + _chrome_64only_count
  }
}