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