xref: /aosp_15_r20/external/pigweed/pw_toolchain/host_gcc/BUILD.gn (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2020 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15import("//build_overrides/pigweed.gni")
16
17# Disable obnoxious ABI warning.
18#
19# GCC 7.1 adds an over-zealous ABI warning with little useful information
20# on how to resolve the issue. The warning you get is:
21#
22#   note: parameter passing for argument of type '...' changed in GCC 7.1
23#
24# There is no other information, and searching for the error is needed to
25# understand what is happening. For upstream Pigweed, we compile from
26# source so this is irrelevant; so disable it.
27#
28# See: https://gcc.gnu.org/gcc-7/changes.html (search for "psabi").
29#      https://gcc.gnu.org/ml/gcc/2017-05/msg00073.html
30config("disable_psabi_warning") {
31  cflags = [ "-Wno-psabi" ]
32}
33
34config("mingw_z_format") {
35  if (host_os == "win") {
36    # MinGW can't handle %z format specifiers without this flag enabled. This
37    # flag is deprecated in future versions of MinGW, and should be replaced by
38    # setting __MINGW_FEATURES__=__MINGW_ANSI_STDIO__ when switching to a
39    # version of MinGW that uses the new flags.
40    cflags = [ "-D__USE_MINGW_ANSI_STDIO=1" ]
41  }
42}
43
44# GCC needs the -pthread option to support multithreading. This must be
45# specified to build e.g. pw_thread_stl.
46config("threading_support") {
47  ldflags = [ "-pthread" ]
48}
49