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/sysroot.gni") | 6 import("//build/config/sysroot.gni") |
7 if (cpu_arch == "arm") { | 7 if (cpu_arch == "arm") { |
8 import("//build/config/arm.gni") | 8 import("//build/config/arm.gni") |
9 } | 9 } |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 "-fvisibility=hidden", | 46 "-fvisibility=hidden", |
47 ] | 47 ] |
48 cflags_cc += [ | 48 cflags_cc += [ |
49 "-fno-exceptions", | 49 "-fno-exceptions", |
50 "-fno-threadsafe-statics", | 50 "-fno-threadsafe-statics", |
51 "-fvisibility-inlines-hidden", | 51 "-fvisibility-inlines-hidden", |
52 ] | 52 ] |
53 | 53 |
54 # Stack protection. | 54 # Stack protection. |
55 if (is_mac) { | 55 if (is_mac) { |
56 cflags += "-fstack-protector-all" | 56 cflags += [ "-fstack-protector-all" ] |
57 } else if (is_linux) { | 57 } else if (is_linux) { |
58 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] | 58 cflags += [ "-fstack-protector", "--param=ssp-buffer-size=4" ] |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 # Mac-specific compiler flags setup. | 62 # Mac-specific compiler flags setup. |
63 # ---------------------------------- | 63 # ---------------------------------- |
64 if (is_mac) { | 64 if (is_mac) { |
65 # These flags are shared between the C compiler and linker. | 65 # These flags are shared between the C compiler and linker. |
66 common_mac_flags = [ | 66 common_mac_flags = [ |
67 "-isysroot", sysroot, | 67 "-isysroot", sysroot, |
68 "-mmacosx-version-min=10.6", | 68 "-mmacosx-version-min=10.6", |
69 ] | 69 ] |
70 | 70 |
71 # CPU architecture. | 71 # CPU architecture. |
72 if (cpu_arch == "x64") { | 72 if (cpu_arch == "x64") { |
73 common_mac_flags += "-arch x86_64" | 73 common_mac_flags += [ "-arch x86_64" ] |
74 } else if (cpu_arch == "x86") { | 74 } else if (cpu_arch == "x86") { |
75 common_mac_flags += "-arch i386" | 75 common_mac_flags += [ "-arch i386" ] |
76 } | 76 } |
77 | 77 |
78 cflags += common_mac_flags + [ | 78 cflags += common_mac_flags + [ |
79 # Without this, the constructors and destructors of a C++ object inside | 79 # Without this, the constructors and destructors of a C++ object inside |
80 # an Objective C struct won't be called, which is very bad. | 80 # an Objective C struct won't be called, which is very bad. |
81 "-fobjc-call-cxx-cdtors", | 81 "-fobjc-call-cxx-cdtors", |
82 ] | 82 ] |
83 | 83 |
84 cflags_c += [ "-std=c99" ] | 84 cflags_c += [ "-std=c99" ] |
85 cflags_cc += [ "-std=gnu++11" ] | 85 cflags_cc += [ "-std=gnu++11" ] |
86 | 86 |
87 ldflags += common_mac_flags + [ | 87 ldflags += common_mac_flags + [ |
88 "-L.", | 88 "-L.", |
89 | 89 |
90 # TODO(brettW) I don't understand these options. | 90 # TODO(brettW) I don't understand these options. |
91 "-Wl,-rpath,@loader_path/.", | 91 "-Wl,-rpath,@loader_path/.", |
92 "-Wl,-rpath,@loader_path/../../..", | 92 "-Wl,-rpath,@loader_path/../../..", |
93 ] | 93 ] |
94 } else if (is_posix) { | 94 } else if (is_posix) { |
95 # Non-Mac Posix compiler flags setup. | 95 # Non-Mac Posix compiler flags setup. |
96 # ----------------------------------- | 96 # ----------------------------------- |
97 | 97 |
98 # CPU architecture. We may or may not be doing a cross compile now, so for | 98 # CPU architecture. We may or may not be doing a cross compile now, so for |
99 # simplicity we always explicitly set the architecture. | 99 # simplicity we always explicitly set the architecture. |
100 if (cpu_arch == "x64") { | 100 if (cpu_arch == "x64") { |
101 cflags += "-m64" | 101 cflags += [ "-m64" ] |
102 ldflags += "-m64" | 102 ldflags += [ "-m64" ] |
103 } else if (cpu_arch == "x86") { | 103 } else if (cpu_arch == "x86") { |
104 cflags += "-m32" | 104 cflags += [ "-m32" ] |
105 ldflags += "-m32" | 105 ldflags += [ "-m32" ] |
106 } else if (cpu_arch == "arm") { | 106 } else if (cpu_arch == "arm") { |
107 # Don't set the compiler flags for the WebView build. These will come | 107 # Don't set the compiler flags for the WebView build. These will come |
108 # from the Android build system. | 108 # from the Android build system. |
109 if (!is_android_webview_build) { | 109 if (!is_android_webview_build) { |
110 cflags += [ | 110 cflags += [ |
111 "-march=$arm_arch", | 111 "-march=$arm_arch", |
112 "-mfpu=$arm_fpu", | 112 "-mfpu=$arm_fpu", |
113 "-mfloat-abi=$arm_float_abi", | 113 "-mfloat-abi=$arm_float_abi", |
114 ] | 114 ] |
115 if (arm_tune != "") { | 115 if (arm_tune != "") { |
116 cflags += "-mtune=$arm_tune" | 116 cflags += [ "-mtune=$arm_tune" ] |
117 } | 117 } |
118 if (arm_use_thumb) { | 118 if (arm_use_thumb) { |
119 cflags += [ "-mthumb" ] | 119 cflags += [ "-mthumb" ] |
120 if (is_android && !is_clang) { # Clang doesn't support this option. | 120 if (is_android && !is_clang) { # Clang doesn't support this option. |
121 cflags += [ "-mthumb-interwork" ] | 121 cflags += [ "-mthumb-interwork" ] |
122 } | 122 } |
123 } | 123 } |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 # saved ~20% of link time. | 167 # saved ~20% of link time. |
168 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr
ead/thread/281527606915bb36 | 168 # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thr
ead/thread/281527606915bb36 |
169 # Only apply this to the target linker, since the host | 169 # Only apply this to the target linker, since the host |
170 # linker might not be gold, but isn't used much anyway. | 170 # linker might not be gold, but isn't used much anyway. |
171 "-Wl,--threads", | 171 "-Wl,--threads", |
172 "-Wl,--thread-count=4", | 172 "-Wl,--thread-count=4", |
173 ] | 173 ] |
174 } | 174 } |
175 | 175 |
176 if (sysroot != "") { | 176 if (sysroot != "") { |
177 cflags += "--sysroot=" + sysroot | 177 cflags += [ "--sysroot=" + sysroot ] |
178 ldflags += "--sysroot=" + sysroot | 178 ldflags += [ "--sysroot=" + sysroot ] |
179 | 179 |
180 # Need to get some linker flags out of the sysroot. | 180 # Need to get some linker flags out of the sysroot. |
181 ldflags += exec_script("../linux/sysroot_ld_path.py", | 181 ldflags += [ exec_script("../linux/sysroot_ld_path.py", |
182 [rebase_path("../../linux/sysroot_ld_path.sh", ".", root_build_dir), | 182 [rebase_path("../../linux/sysroot_ld_path.sh", ".", root_build_dir), |
183 sysroot], | 183 sysroot], |
184 "value") | 184 "value") ] |
185 } | 185 } |
186 | 186 |
187 ldflags += [ | 187 ldflags += [ |
188 "-fPIC", | 188 "-fPIC", |
189 "-pthread", | 189 "-pthread", |
190 "-Wl,-z,noexecstack", | 190 "-Wl,-z,noexecstack", |
191 "-Wl,-z,now", | 191 "-Wl,-z,now", |
192 "-Wl,-z,relro", | 192 "-Wl,-z,relro", |
193 ] | 193 ] |
194 } | 194 } |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 cflags = [ "-g1" ] | 679 cflags = [ "-g1" ] |
680 } | 680 } |
681 } | 681 } |
682 | 682 |
683 config("no_symbols") { | 683 config("no_symbols") { |
684 if (!is_win) { | 684 if (!is_win) { |
685 cflags = [ "-g0" ] | 685 cflags = [ "-g0" ] |
686 } | 686 } |
687 } | 687 } |
688 | 688 |
OLD | NEW |