| 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 if (current_cpu == "arm") { | 6 if (current_cpu == "arm") { |
| 7 import("//build/config/arm.gni") | 7 import("//build/config/arm.gni") |
| 8 } | 8 } |
| 9 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 9 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
| 10 import("//build/config/mips.gni") | 10 import("//build/config/mips.gni") |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 } else { | 109 } else { |
| 110 # Common GCC compiler flags setup. | 110 # Common GCC compiler flags setup. |
| 111 # -------------------------------- | 111 # -------------------------------- |
| 112 common_flags = [ | 112 common_flags = [ |
| 113 # Not exporting C++ inline functions can generally be applied anywhere | 113 # Not exporting C++ inline functions can generally be applied anywhere |
| 114 # so we do so here. Normal function visibility is controlled by | 114 # so we do so here. Normal function visibility is controlled by |
| 115 # //build/config/gcc:symbol_visibility_hidden. | 115 # //build/config/gcc:symbol_visibility_hidden. |
| 116 "-fvisibility-inlines-hidden", | 116 "-fvisibility-inlines-hidden", |
| 117 |
| 118 # We need the frame pointer for CPU and heap profiling. |
| 119 "-fno-omit-frame-pointer", |
| 117 ] | 120 ] |
| 118 cflags_cc += common_flags | 121 cflags_cc += common_flags |
| 119 cflags_objcc += common_flags | 122 cflags_objcc += common_flags |
| 120 | 123 |
| 121 # Linker warnings. | 124 # Linker warnings. |
| 122 if ((current_cpu != "arm") && !is_mac) { | 125 if ((current_cpu != "arm") && !is_mac) { |
| 123 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 | 126 # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
| 124 ldflags += [ "-Wl,--fatal-warnings" ] | 127 ldflags += [ "-Wl,--fatal-warnings" ] |
| 125 } | 128 } |
| 126 | 129 |
| 127 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and | 130 # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and |
| 128 # MemorySanitizer | 131 # MemorySanitizer |
| 129 if (using_sanitizer) { | 132 if (using_sanitizer) { |
| 130 cflags += [ | 133 cflags += [ |
| 131 "-fno-omit-frame-pointer", | |
| 132 "-gline-tables-only", | 134 "-gline-tables-only", |
| 133 ] | 135 ] |
| 134 } | 136 } |
| 135 if (is_asan) { | 137 if (is_asan) { |
| 136 asan_blacklist_path = | 138 asan_blacklist_path = |
| 137 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) | 139 rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) |
| 138 cflags += [ | 140 cflags += [ |
| 139 "-fsanitize=address", | 141 "-fsanitize=address", |
| 140 "-fsanitize-blacklist=$asan_blacklist_path", | 142 "-fsanitize-blacklist=$asan_blacklist_path", |
| 141 ] | 143 ] |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 defines += | 197 defines += |
| 196 [ "CR_CLANG_REVISION=" + exec_script("//tools/clang/scripts/update.py", | 198 [ "CR_CLANG_REVISION=" + exec_script("//tools/clang/scripts/update.py", |
| 197 [ "--print-revision" ], | 199 [ "--print-revision" ], |
| 198 "trim string") ] | 200 "trim string") ] |
| 199 } | 201 } |
| 200 | 202 |
| 201 # Mac-specific compiler flags setup. | 203 # Mac-specific compiler flags setup. |
| 202 # ---------------------------------- | 204 # ---------------------------------- |
| 203 if (is_mac) { | 205 if (is_mac) { |
| 204 # These flags are shared between the C compiler and linker. | 206 # These flags are shared between the C compiler and linker. |
| 205 common_mac_flags = [] | 207 common_mac_flags = [ "-fno-exceptions" ] |
| 206 | 208 |
| 207 # CPU architecture. | 209 # CPU architecture. |
| 208 if (current_cpu == "x64") { | 210 if (current_cpu == "x64") { |
| 209 common_mac_flags += [ | 211 common_mac_flags += [ |
| 210 "-arch", | 212 "-arch", |
| 211 "x86_64", | 213 "x86_64", |
| 212 ] | 214 ] |
| 213 } else if (current_cpu == "x86") { | 215 } else if (current_cpu == "x86") { |
| 214 common_mac_flags += [ | 216 common_mac_flags += [ |
| 215 "-arch", | 217 "-arch", |
| (...skipping 20 matching lines...) Expand all Loading... |
| 236 cflags_c += [ "-std=c99" ] | 238 cflags_c += [ "-std=c99" ] |
| 237 | 239 |
| 238 ldflags += common_mac_flags | 240 ldflags += common_mac_flags |
| 239 } else if (is_posix) { | 241 } else if (is_posix) { |
| 240 # CPU architecture. We may or may not be doing a cross compile now, so for | 242 # CPU architecture. We may or may not be doing a cross compile now, so for |
| 241 # simplicity we always explicitly set the architecture. | 243 # simplicity we always explicitly set the architecture. |
| 242 if (current_cpu == "x64") { | 244 if (current_cpu == "x64") { |
| 243 cflags += [ | 245 cflags += [ |
| 244 "-m64", | 246 "-m64", |
| 245 "-march=x86-64", | 247 "-march=x86-64", |
| 248 "-msse2", |
| 246 ] | 249 ] |
| 247 ldflags += [ "-m64" ] | 250 ldflags += [ "-m64" ] |
| 248 } else if (current_cpu == "x86") { | 251 } else if (current_cpu == "x86") { |
| 249 cflags += [ "-m32" ] | 252 cflags += [ |
| 253 "-m32", |
| 254 "-msse2", |
| 255 "-mfpmath=sse", |
| 256 ] |
| 250 ldflags += [ "-m32" ] | 257 ldflags += [ "-m32" ] |
| 251 if (is_clang) { | 258 if (is_clang) { |
| 252 cflags += [ | 259 cflags += [ |
| 253 # Else building libyuv gives clang's register allocator issues, | 260 # Else building libyuv gives clang's register allocator issues, |
| 254 # see llvm.org/PR15798 / crbug.com/233709 | 261 # see llvm.org/PR15798 / crbug.com/233709 |
| 255 "-momit-leaf-frame-pointer", | 262 "-mno-omit-leaf-frame-pointer", |
| 256 | 263 |
| 257 # Align the stack on 16-byte boundaries, http://crbug.com/418554. | 264 # Align the stack on 16-byte boundaries, http://crbug.com/418554. |
| 258 "-mstack-alignment=16", | 265 "-mstack-alignment=16", |
| 259 "-mstackrealign", | 266 "-mstackrealign", |
| 260 ] | 267 ] |
| 261 } | 268 } |
| 262 } else if (current_cpu == "arm") { | 269 } else if (current_cpu == "arm") { |
| 263 | 270 |
| 264 cflags += [ | 271 cflags += [ |
| 265 "-march=$arm_arch", | 272 "-march=$arm_arch", |
| (...skipping 17 matching lines...) Expand all Loading... |
| 283 # compiler (r5-r7). This can be verified using | 290 # compiler (r5-r7). This can be verified using |
| 284 # webkit_unit_tests' WTF.Checked_int8_t test. | 291 # webkit_unit_tests' WTF.Checked_int8_t test. |
| 285 "-fno-tree-sra", | 292 "-fno-tree-sra", |
| 286 | 293 |
| 287 # The following option is disabled to improve binary | 294 # The following option is disabled to improve binary |
| 288 # size and performance in gcc 4.9. | 295 # size and performance in gcc 4.9. |
| 289 "-fno-caller-saves", | 296 "-fno-caller-saves", |
| 290 ] | 297 ] |
| 291 } | 298 } |
| 292 } else if (current_cpu == "mipsel") { | 299 } else if (current_cpu == "mipsel") { |
| 300 # We have to explicitly request exceptions to get good heap profiles from |
| 301 # tcmalloc. |
| 302 if (is_debug || is_release) { |
| 303 cflags += [ |
| 304 "-fexceptions", |
| 305 "-funwind-tables" |
| 306 ] |
| 307 } |
| 308 |
| 293 if (mips_arch_variant == "r6") { | 309 if (mips_arch_variant == "r6") { |
| 294 cflags += [ | 310 cflags += [ |
| 295 "-mips32r6", | 311 "-mips32r6", |
| 296 "-Wa,-mips32r6", | 312 "-Wa,-mips32r6", |
| 297 ] | 313 ] |
| 298 if (is_android) { | 314 if (is_android) { |
| 299 ldflags += [ | 315 ldflags += [ |
| 300 "-mips32r6", | 316 "-mips32r6", |
| 301 "-Wl,-melf32ltsmip", | 317 "-Wl,-melf32ltsmip", |
| 302 ] | 318 ] |
| (...skipping 29 matching lines...) Expand all Loading... |
| 332 ldflags += [ "-mips64r6" ] | 348 ldflags += [ "-mips64r6" ] |
| 333 } else if (mips_arch_variant == "r2") { | 349 } else if (mips_arch_variant == "r2") { |
| 334 cflags += [ | 350 cflags += [ |
| 335 "-mips64r2", | 351 "-mips64r2", |
| 336 "-Wa,-mips64r2", | 352 "-Wa,-mips64r2", |
| 337 ] | 353 ] |
| 338 ldflags += [ "-mips64r2" ] | 354 ldflags += [ "-mips64r2" ] |
| 339 } | 355 } |
| 340 } | 356 } |
| 341 | 357 |
| 342 cflags += [ "-funwind-tables" ] | 358 if (current_cpu != "mipsel") { |
| 359 cflags += [ "-fno-exceptions" ] |
| 360 } |
| 343 } | 361 } |
| 344 | 362 |
| 345 # Linux/Android common flags setup. | 363 # Linux/Android common flags setup. |
| 346 # --------------------------------- | 364 # --------------------------------- |
| 347 if (is_linux || is_android) { | 365 if (is_linux || is_android) { |
| 348 cflags += [ | 366 cflags += [ |
| 349 "-fPIC", | 367 "-fPIC", |
| 350 ] | 368 ] |
| 351 | 369 |
| 352 ldflags += [ | 370 ldflags += [ |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 } else if (is_android) { | 908 } else if (is_android) { |
| 891 # On Android we kind of optimize some things that don't affect debugging | 909 # On Android we kind of optimize some things that don't affect debugging |
| 892 # much even when optimization is disabled to get the binary size down. | 910 # much even when optimization is disabled to get the binary size down. |
| 893 cflags = [ | 911 cflags = [ |
| 894 "-Os", | 912 "-Os", |
| 895 "-fdata-sections", | 913 "-fdata-sections", |
| 896 "-ffunction-sections", | 914 "-ffunction-sections", |
| 897 ] | 915 ] |
| 898 ldflags = common_optimize_on_ldflags | 916 ldflags = common_optimize_on_ldflags |
| 899 } else { | 917 } else { |
| 900 cflags = [ "-O1" ] | 918 cflags = [ |
| 919 "-O1", |
| 920 "-fdata-sections", |
| 921 "-ffunction-sections", |
| 922 ] |
| 901 } | 923 } |
| 902 } | 924 } |
| 903 | 925 |
| 904 # Symbols ---------------------------------------------------------------------- | 926 # Symbols ---------------------------------------------------------------------- |
| 905 | 927 |
| 906 config("symbols") { | 928 config("symbols") { |
| 907 if (is_win) { | 929 if (is_win) { |
| 908 import("//build/toolchain/goma.gni") | 930 import("//build/toolchain/goma.gni") |
| 909 if (use_goma) { | 931 if (use_goma) { |
| 910 cflags = [ "/Z7" ] # No PDB file | 932 cflags = [ "/Z7" ] # No PDB file |
| 911 } else { | 933 } else { |
| 912 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. | 934 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. |
| 913 } | 935 } |
| 914 ldflags = [ "/DEBUG" ] | 936 ldflags = [ "/DEBUG" ] |
| 915 } else { | 937 } else { |
| 916 cflags = [ | 938 cflags = [ |
| 917 "-g3", | 939 "-g3", |
| 918 "-ggdb3", | 940 "-ggdb3", |
| 919 ] | 941 ] |
| 920 } | 942 } |
| 921 } | 943 } |
| OLD | NEW |