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