1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
--- build/config/compiler/BUILD.gn.orig 2017-03-09 20:04:27 UTC
+++ build/config/compiler/BUILD.gn
@@ -155,7 +155,7 @@ config("compiler") {
configs += [ "//build/config/win:compiler" ]
} else if (is_android) {
configs += [ "//build/config/android:compiler" ]
- } else if (is_linux) {
+ } else if (is_linux || is_bsd) {
configs += [ "//build/config/linux:compiler" ]
} else if (is_nacl) {
configs += [ "//build/config/nacl:compiler" ]
@@ -282,7 +282,7 @@ config("compiler") {
# Linux/Android common flags setup.
# ---------------------------------
- if (is_linux || is_android) {
+ if (is_linux || is_bsd || is_android) {
cflags += [
"-fPIC",
"-pipe", # Use pipes for communicating between sub-processes. Faster.
@@ -409,14 +409,14 @@ config("compiler") {
# clang-cl (used if is_win) doesn't expose this flag.
# Currently disabled for nacl since its toolchain lacks this flag (too old).
# TODO(zforman): Once nacl's toolchain is updated, remove check.
- if (is_clang && is_linux) {
+ if (is_clang && (is_linux || is_bsd)) {
absolute_path = rebase_path("//.")
cflags += [ "-fdebug-prefix-map=$absolute_path=." ]
}
# C++11 compiler flags setup.
# ---------------------------
- if (is_linux || is_android || (is_nacl && is_clang)) {
+ if (is_linux || is_bsd || is_android || (is_nacl && is_clang)) {
# gnu++11 instead of c++11 is needed because some code uses typeof() (a
# GNU extension).
# TODO(thakis): Eventually switch this to c++11 instead,
@@ -469,7 +469,7 @@ config("compiler") {
]
# Apply a lower LTO optimization level as the default is too slow.
- if (is_linux) {
+ if (is_linux || is_bsd) {
if (use_lld) {
ldflags += [ "-Wl,--lto-O1" ]
} else {
@@ -489,7 +489,7 @@ config("compiler") {
# targeting ARM, without this flag, LTO produces a .text section that is
# larger than the maximum call displacement, preventing the linker from
# relocating calls (http://llvm.org/PR22999).
- if (is_linux) {
+ if (is_linux || is_bsd) {
ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
}
}
@@ -757,7 +757,7 @@ config("compiler_codegen") {
# configs -= [ "//build/config/compiler:clang_stackrealign" ]
# See https://crbug.com/556393 for details of where it must be avoided.
config("clang_stackrealign") {
- if (is_clang && current_cpu == "x86" && is_linux) {
+ if (is_clang && current_cpu == "x86" && (is_linux || is_bsd)) {
cflags = [
# Align the stack on 16-byte boundaries, http://crbug.com/418554.
"-mstack-alignment=16",
@@ -811,7 +811,7 @@ config("runtime_library") {
# smaller.
if (is_win) {
configs += [ "//build/config/win:runtime_library" ]
- } else if (is_linux) {
+ } else if (is_linux || is_bsd) {
configs += [ "//build/config/linux:runtime_library" ]
} else if (is_ios) {
configs += [ "//build/config/ios:runtime_library" ]
@@ -1076,7 +1076,7 @@ config("default_warnings") {
"-Wno-nonportable-include-path",
# TODO(hans): https://crbug.com/637306
- "-Wno-address-of-packed-member",
+ # "-Wno-address-of-packed-member",
]
if (llvm_force_head_revision) {
cflags += [
@@ -1119,7 +1119,7 @@ config("chromium_code") {
]
if (!is_debug && !using_sanitizer &&
- (!is_linux || !is_clang || is_official_build)) {
+ (!is_linux || !is_bsd || !is_clang || is_official_build)) {
# _FORTIFY_SOURCE isn't really supported by Clang now, see
# http://llvm.org/bugs/show_bug.cgi?id=16821.
# It seems to work fine with Ubuntu 12 headers though, so use it in
@@ -1178,7 +1178,7 @@ config("no_chromium_code") {
]
}
- if (is_linux || is_android) {
+ if (is_linux || is_bsd || is_android) {
cflags_cc += [
# Don't warn about hash_map in third-party code.
"-Wno-deprecated",
|