mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-10 03:47:44 -03:00
Update BUILD.gn
This commit is contained in:
parent
0a8453bdc2
commit
7325b89b6a
1 changed files with 38 additions and 37 deletions
|
@ -317,7 +317,7 @@ config("compiler") {
|
|||
cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204
|
||||
|
||||
# Stack protection.
|
||||
if (is_mac) {
|
||||
if (is_apple) {
|
||||
# The strong variant of the stack protector significantly increases
|
||||
# binary size, so only enable it in debug mode.
|
||||
if (is_debug) {
|
||||
|
@ -369,7 +369,7 @@ config("compiler") {
|
|||
]
|
||||
}
|
||||
|
||||
# Non-Mac Posix and Fuchsia compiler flags setup.
|
||||
# Non-Apple Posix and Fuchsia compiler flags setup.
|
||||
# -----------------------------------
|
||||
if ((is_posix && !is_apple) || is_fuchsia) {
|
||||
if (enable_profiling) {
|
||||
|
@ -420,6 +420,23 @@ config("compiler") {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Apple compiler flags setup.
|
||||
# ---------------------------------
|
||||
if (is_apple) {
|
||||
# On Intel, clang emits both Apple's "compact unwind" information and
|
||||
# DWARF eh_frame unwind information by default, for compatibility reasons.
|
||||
# This flag limits emission of eh_frame information to functions
|
||||
# whose unwind information can't be expressed in the compact unwind format
|
||||
# (which in practice means almost everything gets only compact unwind
|
||||
# entries). This reduces object file size a bit and makes linking a bit
|
||||
# faster.
|
||||
# On arm64, this is already the default behavior.
|
||||
if (current_cpu == "x64") {
|
||||
asmflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||
cflags += [ "-femit-dwarf-unwind=no-compact-unwind" ]
|
||||
}
|
||||
}
|
||||
|
||||
# Linux/Android/Fuchsia common flags setup.
|
||||
# ---------------------------------
|
||||
|
@ -591,10 +608,11 @@ config("compiler") {
|
|||
cflags_c += [ "/std:c11" ]
|
||||
cflags_cc += [ "/std:c++17" ]
|
||||
} else if (!is_nacl) {
|
||||
# TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either gnu11/gnu++11
|
||||
# or c11/c++11; we technically don't need this toolchain any more, but there
|
||||
# are still a few buildbots using it, so until those are turned off
|
||||
# we need the !is_nacl clause and the (is_nacl && is_clang) clause, above.
|
||||
# TODO(mcgrathr) - the NaCl GCC toolchain doesn't support either
|
||||
# gnu11/gnu++11 or c11/c++11; we technically don't need this toolchain any
|
||||
# more, but there are still a few buildbots using it, so until those are
|
||||
# turned off we need the !is_nacl clause and the (is_nacl && is_clang)
|
||||
# clause, above.
|
||||
cflags_c += [ "-std=c11" ]
|
||||
cflags_cc += [ "-std=c++17" ]
|
||||
}
|
||||
|
@ -605,33 +623,6 @@ config("compiler") {
|
|||
cflags_cc += [ "-Wno-trigraphs" ]
|
||||
}
|
||||
|
||||
# Before C++17, an `alignas(N)` type would be N-aligned on the stack,
|
||||
# but heap allocation would just return something aligned to whatever the
|
||||
# default allocator happens to return. Starting with C++17, operator new
|
||||
# called on aligned types with N > __STDCPP_DEFAULT_NEW_ALIGNMENT__ will
|
||||
# call a special overload that hands in the desired alignment, and that will
|
||||
# honor the alignas even for memory on the heap.
|
||||
# However, that requires that operator new overload to exist. At least on
|
||||
# macOS and iOS, they are in libc++abi, and system libc++abi has them as of
|
||||
# "macOS 10.12, iOS 10.0" (https://reviews.llvm.org/D112921#3128089).
|
||||
# However, we do statically link libc++abi, so maybe just explicitly passing
|
||||
# -faligned-allocation is enough to make things work.
|
||||
# For now, explicitly disable this feature though to keep the C++14 aligned
|
||||
# allocation behavior (and do that on all platforms so that we have
|
||||
# consistent behavior across platforms), to make the change more incremental.
|
||||
if (!is_nacl || is_nacl_saigo) {
|
||||
if (is_win) {
|
||||
cflags_cc += [ "/Zc:alignedNew-" ]
|
||||
} else {
|
||||
cflags_cc += [ "-fno-aligned-new" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
# The system libc++ on Mac doesn't have aligned allocation in C++17.
|
||||
defines += [ "_LIBCPP_HAS_NO_ALIGNED_ALLOCATION" ]
|
||||
}
|
||||
|
||||
# Add flags for link-time optimization. These flags enable
|
||||
# optimizations/transformations that require whole-program visibility at link
|
||||
# time, so they need to be applied to all translation units, and we may end up
|
||||
|
@ -753,9 +744,7 @@ config("compiler") {
|
|||
if (use_lld && !enable_call_graph_profile_sort) {
|
||||
if (is_win) {
|
||||
ldflags += [ "/call-graph-profile-sort:no" ]
|
||||
} else if (!is_apple) {
|
||||
# TODO(thakis): Once LLD's Mach-O port basically works, implement call
|
||||
# graph profile sorting for it, add an opt-out flag, and pass it here.
|
||||
} else {
|
||||
ldflags += [ "-Wl,--no-call-graph-profile-sort" ]
|
||||
}
|
||||
}
|
||||
|
@ -1546,10 +1535,22 @@ config("default_warnings") {
|
|||
# TODO(thakis): Only for no_chromium_code? http://crbug.com/912662
|
||||
"-Wno-ignored-pragma-optimize",
|
||||
]
|
||||
|
||||
|
||||
if (!is_nacl) {
|
||||
# TODO(https://crbug.com/1300731) Clean up and enable.
|
||||
cflags += [ "-Wno-unqualified-std-cast-call" ]
|
||||
|
||||
# Do not set the below flags if it's nacl as nacl-clang doesn't have the
|
||||
# patches that require these flags.
|
||||
if (llvm_force_head_revision) {
|
||||
cflags += [
|
||||
# TODO(crbug.com/1343303) Evaluate and possibly enable.
|
||||
"-Wno-array-parameter",
|
||||
|
||||
# TODO(crbug.com/1343975) Evaluate and possibly enable.
|
||||
"-Wno-deprecated-builtins",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_fuchsia) {
|
||||
|
|
Loading…
Reference in a new issue