BUILD.gn 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # Copyright 2017 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. import("//build/config/sanitizers/sanitizers.gni")
  5. import("//build/toolchain/toolchain.gni")
  6. # This is included by reference in the //build/config/compiler config that
  7. # is applied to all targets. It is here to separate out the logic.
  8. config("compiler") {
  9. # These flags are shared between the C compiler and linker.
  10. defines = [
  11. "_LINUX_SOURCE_COMPAT=1",
  12. "__STDC_FORMAT_MACROS",
  13. "_ALL_SOURCE=1",
  14. ]
  15. cflags = [
  16. "-Wall",
  17. "-Wno-unused-parameter",
  18. "-pthread",
  19. "-Wmissing-field-initializers",
  20. "-Wno-uninitialized",
  21. "-mcpu=power5+",
  22. "-mfprnd",
  23. "-mno-popcntb",
  24. "-maix64",
  25. "-fdata-sections",
  26. "-ffunction-sections",
  27. "-fno-extern-tls-init",
  28. "-O3",
  29. # "-Werror"
  30. # We need to find a way to fix the TOC warnings if we want to enable this.
  31. ]
  32. cflags_cc = [
  33. "-fno-rtti",
  34. "-fno-exceptions",
  35. "-Wno-narrowing",
  36. "-Wno-non-virtual-dtor",
  37. ]
  38. ldflags = [
  39. "-pthread",
  40. "-maix64",
  41. "-Wl,-bbigtoc",
  42. ]
  43. if (is_component_build) {
  44. cflags += [ "-fpic" ]
  45. ldflags += [
  46. "-Wl,-brtl",
  47. # -bnoipath so that only names of .so objects are stored in loader
  48. # section, excluding leading "./"
  49. "-Wl,-bnoipath",
  50. ]
  51. }
  52. }