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 (cpu_arch == "arm") { | 6 if (cpu_arch == "arm") { |
7 import("//build/config/arm.gni") | 7 import("//build/config/arm.gni") |
8 } | 8 } |
9 if (is_posix) { | 9 if (is_posix) { |
10 import("//build/config/gcc/gcc_version.gni") | 10 import("//build/config/gcc/gcc_version.gni") |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 # CPU architecture. We may or may not be doing a cross compile now, so for | 163 # CPU architecture. We may or may not be doing a cross compile now, so for |
164 # simplicity we always explicitly set the architecture. | 164 # simplicity we always explicitly set the architecture. |
165 if (cpu_arch == "x64") { | 165 if (cpu_arch == "x64") { |
166 cflags += [ "-m64", "-march=x86-64", ] | 166 cflags += [ "-m64", "-march=x86-64", ] |
167 ldflags += [ "-m64" ] | 167 ldflags += [ "-m64" ] |
168 } else if (cpu_arch == "x86") { | 168 } else if (cpu_arch == "x86") { |
169 cflags += [ "-m32" ] | 169 cflags += [ "-m32" ] |
170 ldflags += [ "-m32" ] | 170 ldflags += [ "-m32" ] |
| 171 if (is_clang) { |
| 172 cflags += [ |
| 173 # Else building libyuv gives clang's register allocator issues, |
| 174 # see llvm.org/PR15798 / crbug.com/233709 |
| 175 "-momit-leaf-frame-pointer", |
| 176 # Align the stack on 16-byte boundaries, http://crbug.com/418554. |
| 177 "-mstack-alignment=16", |
| 178 "-mstackrealign", |
| 179 ] |
| 180 } |
171 } else if (cpu_arch == "arm") { | 181 } else if (cpu_arch == "arm") { |
172 # Don't set the compiler flags for the WebView build. These will come | 182 # Don't set the compiler flags for the WebView build. These will come |
173 # from the Android build system. | 183 # from the Android build system. |
174 if (!is_android_webview_build) { | 184 if (!is_android_webview_build) { |
175 cflags += [ | 185 cflags += [ |
176 "-march=$arm_arch", | 186 "-march=$arm_arch", |
177 "-mfloat-abi=$arm_float_abi", | 187 "-mfloat-abi=$arm_float_abi", |
178 ] | 188 ] |
179 if (arm_tune != "") { | 189 if (arm_tune != "") { |
180 cflags += [ "-mtune=$arm_tune" ] | 190 cflags += [ "-mtune=$arm_tune" ] |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", | 256 gold_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", |
247 root_build_dir) | 257 root_build_dir) |
248 ldflags += [ | 258 ldflags += [ |
249 "-B$gold_path", | 259 "-B$gold_path", |
250 | 260 |
251 # Newer gccs and clangs support -fuse-ld, use the flag to force gold | 261 # Newer gccs and clangs support -fuse-ld, use the flag to force gold |
252 # selection. | 262 # selection. |
253 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html | 263 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html |
254 "-fuse-ld=gold", | 264 "-fuse-ld=gold", |
255 | 265 |
256 # There seems to be a conflict of --icf and -pie in gold which can | |
257 # generate crashy binaries. As a security measure, -pie takes | |
258 # precedence for now. | |
259 # TODO(brettw) common.gypi has this only for target toolset. | 266 # TODO(brettw) common.gypi has this only for target toolset. |
260 #"-Wl,--icf=safe", | 267 "-Wl,--icf=safe", |
261 "-Wl,--icf=none", | |
262 | 268 |
263 # Experimentation found that using four linking threads | 269 # Experimentation found that using four linking threads |
264 # saved ~20% of link time. | 270 # saved ~20% of link time. |
265 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_threa
d/thread/281527606915bb36 | 271 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_threa
d/thread/281527606915bb36 |
266 # Only apply this to the target linker, since the host | 272 # Only apply this to the target linker, since the host |
267 # linker might not be gold, but isn't used much anyway. | 273 # linker might not be gold, but isn't used much anyway. |
268 # TODO(raymes): Disable threading because gold is frequently | 274 # TODO(raymes): Disable threading because gold is frequently |
269 # crashing on the bots: crbug.com/161942. | 275 # crashing on the bots: crbug.com/161942. |
270 #"-Wl,--threads", | 276 #"-Wl,--threads", |
271 #"-Wl,--thread-count=4", | 277 #"-Wl,--thread-count=4", |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 cflags += [ "-gsplit-dwarf" ] | 943 cflags += [ "-gsplit-dwarf" ] |
938 } | 944 } |
939 } | 945 } |
940 } | 946 } |
941 | 947 |
942 config("no_symbols") { | 948 config("no_symbols") { |
943 if (!is_win) { | 949 if (!is_win) { |
944 cflags = [ "-g0" ] | 950 cflags = [ "-g0" ] |
945 } | 951 } |
946 } | 952 } |
OLD | NEW |