OLD | NEW |
---|---|
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
7 if (current_cpu == "arm") { | 7 if (current_cpu == "arm") { |
8 import("//build/config/arm.gni") | 8 import("//build/config/arm.gni") |
9 } | 9 } |
10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 } | 90 } |
91 | 91 |
92 # compiler --------------------------------------------------------------------- | 92 # compiler --------------------------------------------------------------------- |
93 # | 93 # |
94 # Base compiler configuration. | 94 # Base compiler configuration. |
95 # | 95 # |
96 # See also "runtime_library" below for related stuff and a discussion about | 96 # See also "runtime_library" below for related stuff and a discussion about |
97 # where stuff should go. Put warning related stuff in the "warnings" config. | 97 # where stuff should go. Put warning related stuff in the "warnings" config. |
98 | 98 |
99 config("compiler") { | 99 config("compiler") { |
100 arflags = [] | |
100 cflags = [] | 101 cflags = [] |
101 cflags_c = [] | 102 cflags_c = [] |
102 cflags_cc = [] | 103 cflags_cc = [] |
103 cflags_objc = [] | 104 cflags_objc = [] |
104 cflags_objcc = [] | 105 cflags_objcc = [] |
105 ldflags = [] | 106 ldflags = [] |
106 defines = [] | 107 defines = [] |
107 | 108 |
108 # In general, Windows is totally different, but all the other builds share | 109 # In general, Windows is totally different, but all the other builds share |
109 # some common GCC configuration. This section sets up Windows and the common | 110 # some common GCC configuration. This section sets up Windows and the common |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 cflags += [ "-fstack-protector" ] | 193 cflags += [ "-fstack-protector" ] |
193 } | 194 } |
194 } | 195 } |
195 | 196 |
196 # Linker warnings. | 197 # Linker warnings. |
197 if (!(is_chromeos && current_cpu == "arm") && !is_mac && !is_ios) { | 198 if (!(is_chromeos && current_cpu == "arm") && !is_mac && !is_ios) { |
198 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 | 199 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
199 ldflags += [ "-Wl,--fatal-warnings" ] | 200 ldflags += [ "-Wl,--fatal-warnings" ] |
200 } | 201 } |
201 | 202 |
202 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and | 203 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer, |
203 # MemorySanitizer | 204 # MemorySanitizer and non-official CFI builds. |
204 if (using_sanitizer) { | 205 if (using_sanitizer || (is_cfi && !is_official_build)) { |
205 cflags += [ | 206 cflags += [ |
206 "-fno-omit-frame-pointer", | 207 "-fno-omit-frame-pointer", |
207 "-gline-tables-only", | 208 "-gline-tables-only", |
208 ] | 209 ] |
209 } | 210 } |
210 if (is_asan) { | 211 if (is_asan) { |
211 asan_blacklist_path = | 212 asan_blacklist_path = |
212 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) | 213 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) |
213 cflags += [ | 214 cflags += [ |
214 "-fsanitize=address", | 215 "-fsanitize=address", |
(...skipping 17 matching lines...) Expand all Loading... | |
232 } | 233 } |
233 if (is_msan) { | 234 if (is_msan) { |
234 msan_blacklist_path = | 235 msan_blacklist_path = |
235 rebase_path("//tools/msan/blacklist.txt", root_build_dir) | 236 rebase_path("//tools/msan/blacklist.txt", root_build_dir) |
236 cflags += [ | 237 cflags += [ |
237 "-fsanitize=memory", | 238 "-fsanitize=memory", |
238 "-fsanitize-memory-track-origins=$msan_track_origins", | 239 "-fsanitize-memory-track-origins=$msan_track_origins", |
239 "-fsanitize-blacklist=$msan_blacklist_path", | 240 "-fsanitize-blacklist=$msan_blacklist_path", |
240 ] | 241 ] |
241 } | 242 } |
243 if (is_cfi && !is_nacl) { | |
244 cfi_blacklist_path = | |
245 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) | |
246 cflags += [ | |
247 "-flto", | |
248 "-fsanitize=cfi-vcall", | |
249 "-fsanitize=cfi-derived-cast", | |
250 "-fsanitize=cfi-unrelated-cast", | |
251 "-fsanitize-blacklist=$cfi_blacklist_path", | |
252 ] | |
253 ldflags += [ "-flto" ] | |
254 | |
255 gold_plugin_path = rebase_path( | |
256 "//third_party/llvm-build/Release+Asserts/lib/LLVMgold.so", | |
257 root_build_dir) | |
258 arflags += [ | |
brettw
2015/09/03 04:41:20
My initial reaction is "I don't want this" but if
pcc1
2015/09/04 21:56:59
Archive files contain a symbol table for each obje
| |
259 "--plugin", | |
260 gold_plugin_path, | |
261 ] | |
262 | |
263 # Apply a lower LTO optimization level in non-official builds. | |
264 if (!is_official_build) { | |
265 if (is_linux) { | |
266 ldflags += [ "-Wl,-plugin-opt,O1" ] | |
267 } else if (is_mac) { | |
268 ldflags += [ "-Wl,-mllvm,-O1" ] | |
269 } | |
270 } | |
271 | |
272 # Work-around for http://openradar.appspot.com/20356002 | |
273 if (is_mac) { | |
274 ldflags += [ "-Wl,-all_load" ] | |
275 } | |
276 | |
277 # Without this flag, LTO produces a .text section that is larger | |
278 # than the maximum call displacement, preventing the linker from | |
279 # relocating calls (http://llvm.org/PR22999). | |
280 if (current_cpu == "arm") { | |
281 ldflags += [ "-Wl,-plugin-opt,-function-sections" ] | |
282 } | |
283 | |
284 if (use_cfi_diag) { | |
285 cflags += [ | |
286 "-fno-sanitize-trap=cfi", | |
287 "-fsanitize-recover=cfi", | |
288 ] | |
289 } else { | |
290 defines += [ "CFI_ENFORCEMENT" ] | |
291 } | |
292 } | |
242 | 293 |
243 if (use_custom_libcxx) { | 294 if (use_custom_libcxx) { |
244 cflags_cc += [ "-nostdinc++" ] | 295 cflags_cc += [ "-nostdinc++" ] |
245 include_dirs = [ | 296 include_dirs = [ |
246 "//buildtools/third_party/libc++/trunk/include", | 297 "//buildtools/third_party/libc++/trunk/include", |
247 "//buildtools/third_party/libc++abi/trunk/include", | 298 "//buildtools/third_party/libc++abi/trunk/include", |
248 ] | 299 ] |
249 } | 300 } |
250 } | 301 } |
251 | 302 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 "-fPIC", | 510 "-fPIC", |
460 "-pipe", # Use pipes for communicating between sub-processes. Faster. | 511 "-pipe", # Use pipes for communicating between sub-processes. Faster. |
461 ] | 512 ] |
462 | 513 |
463 ldflags += [ | 514 ldflags += [ |
464 "-fPIC", | 515 "-fPIC", |
465 "-Wl,-z,noexecstack", | 516 "-Wl,-z,noexecstack", |
466 "-Wl,-z,now", | 517 "-Wl,-z,now", |
467 "-Wl,-z,relro", | 518 "-Wl,-z,relro", |
468 ] | 519 ] |
469 if (!using_sanitizer) { | 520 if (!using_sanitizer && !use_cfi_diag) { |
470 ldflags += [ "-Wl,-z,defs" ] | 521 ldflags += [ "-Wl,-z,defs" ] |
471 } | 522 } |
472 } | 523 } |
473 | 524 |
474 # Linux-specific compiler flags setup. | 525 # Linux-specific compiler flags setup. |
475 # ------------------------------------ | 526 # ------------------------------------ |
476 if (is_linux) { | 527 if (is_linux) { |
477 cflags += [ "-pthread" ] | 528 cflags += [ "-pthread" ] |
478 ldflags += [ "-pthread" ] | 529 ldflags += [ "-pthread" ] |
479 } | 530 } |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1092 # rtti ------------------------------------------------------------------------ | 1143 # rtti ------------------------------------------------------------------------ |
1093 # | 1144 # |
1094 # Allows turning Run-Time Type Identification on or off. | 1145 # Allows turning Run-Time Type Identification on or off. |
1095 | 1146 |
1096 config("rtti") { | 1147 config("rtti") { |
1097 if (is_win) { | 1148 if (is_win) { |
1098 cflags_cc = [ "/GR" ] | 1149 cflags_cc = [ "/GR" ] |
1099 } | 1150 } |
1100 } | 1151 } |
1101 config("no_rtti") { | 1152 config("no_rtti") { |
1102 if (is_win) { | 1153 # CFI diagnostics require RTTI. |
1103 cflags_cc = [ "/GR-" ] | 1154 if (!use_cfi_diag) { |
1104 } else { | 1155 if (is_win) { |
1105 cflags_cc = [ "-fno-rtti" ] | 1156 cflags_cc = [ "/GR-" ] |
1106 cflags_objcc = cflags_cc | 1157 } else { |
1158 cflags_cc = [ "-fno-rtti" ] | |
1159 cflags_objcc = cflags_cc | |
1160 } | |
1107 } | 1161 } |
1108 } | 1162 } |
1109 | 1163 |
1110 # Warnings --------------------------------------------------------------------- | 1164 # Warnings --------------------------------------------------------------------- |
1111 | 1165 |
1112 # This will generate warnings when using Clang if code generates exit-time | 1166 # This will generate warnings when using Clang if code generates exit-time |
1113 # destructors, which will slow down closing the program. | 1167 # destructors, which will slow down closing the program. |
1114 # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600 | 1168 # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600 |
1115 config("wexit_time_destructors") { | 1169 config("wexit_time_destructors") { |
1116 # TODO: Enable on Windows too, http://crbug.com/404525 | 1170 # TODO: Enable on Windows too, http://crbug.com/404525 |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1342 cflags += [ "-gsplit-dwarf" ] | 1396 cflags += [ "-gsplit-dwarf" ] |
1343 } | 1397 } |
1344 } | 1398 } |
1345 } | 1399 } |
1346 | 1400 |
1347 config("no_symbols") { | 1401 config("no_symbols") { |
1348 if (!is_win) { | 1402 if (!is_win) { |
1349 cflags = [ "-g0" ] | 1403 cflags = [ "-g0" ] |
1350 } | 1404 } |
1351 } | 1405 } |
OLD | NEW |