Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: build/toolchain/gcc_toolchain.gni

Issue 2209763002: Revert of Enable whitelist generation for all builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/toolchain/gcc_solink_wrapper.py ('k') | build/toolchain/wrapper_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/clang/clang.gni") 5 import("//build/config/clang/clang.gni")
6 import("//build/config/nacl/config.gni") 6 import("//build/config/nacl/config.gni")
7 import("//build/config/sanitizers/sanitizers.gni") 7 import("//build/config/sanitizers/sanitizers.gni")
8 import("//build/config/v8_target_cpu.gni") 8 import("//build/config/v8_target_cpu.gni")
9 import("//build/toolchain/cc_wrapper.gni") 9 import("//build/toolchain/cc_wrapper.gni")
10 import("//build/toolchain/goma.gni") 10 import("//build/toolchain/goma.gni")
11 import("//build/toolchain/toolchain.gni") 11 import("//build/toolchain/toolchain.gni")
12 import("//build/toolchain/concurrent_links.gni") 12 import("//build/toolchain/concurrent_links.gni")
13 import("//tools/grit/grit_rule.gni")
14 13
15 # This template defines a toolchain for something that works like gcc 14 # This template defines a toolchain for something that works like gcc
16 # (including clang). 15 # (including clang).
17 # 16 #
18 # It requires the following variables specifying the executables to run: 17 # It requires the following variables specifying the executables to run:
19 # - ar 18 # - ar
20 # - cc 19 # - cc
21 # - cxx 20 # - cxx
22 # - ld 21 # - ld
23 # and the following which is used in the toolchain_args 22 # and the following which is used in the toolchain_args
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 216 }
218 217
219 # These library switches can apply to all tools below. 218 # These library switches can apply to all tools below.
220 lib_switch = "-l" 219 lib_switch = "-l"
221 lib_dir_switch = "-L" 220 lib_dir_switch = "-L"
222 221
223 # Object files go in this directory. 222 # Object files go in this directory.
224 object_subdir = "{{target_out_dir}}/{{label_name}}" 223 object_subdir = "{{target_out_dir}}/{{label_name}}"
225 224
226 tool("cc") { 225 tool("cc") {
227 whitelist_flag = " "
228 if (enable_resource_whitelist_generation) {
229 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\""
230 }
231 depfile = "{{output}}.d" 226 depfile = "{{output}}.d"
232 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di rs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{ output}}" 227 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di rs}} {{cflags}} {{cflags_c}}${extra_cppflags}${extra_cflags} -c {{source}} -o {{ output}}"
233 depsformat = "gcc" 228 depsformat = "gcc"
234 description = "CC {{output}}" 229 description = "CC {{output}}"
235 outputs = [ 230 outputs = [
236 # The whitelist file is also an output, but ninja does not
237 # currently support multiple outputs for tool("cc").
238 "$object_subdir/{{source_name_part}}.o", 231 "$object_subdir/{{source_name_part}}.o",
239 ] 232 ]
240 compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py",
241 root_build_dir)
242 command = "$python_path \"$compile_wrapper\"$whitelist_flag $command"
243 } 233 }
244 234
245 tool("cxx") { 235 tool("cxx") {
246 whitelist_flag = " "
247 if (enable_resource_whitelist_generation) {
248 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\""
249 }
250 depfile = "{{output}}.d" 236 depfile = "{{output}}.d"
251 command = "$cxx -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_d irs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} - o {{output}}" 237 command = "$cxx -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_d irs}} {{cflags}} {{cflags_cc}}${extra_cppflags}${extra_cxxflags} -c {{source}} - o {{output}}"
252 depsformat = "gcc" 238 depsformat = "gcc"
253 description = "CXX {{output}}" 239 description = "CXX {{output}}"
254 outputs = [ 240 outputs = [
255 # The whitelist file is also an output, but ninja does not
256 # currently support multiple outputs for tool("cxx").
257 "$object_subdir/{{source_name_part}}.o", 241 "$object_subdir/{{source_name_part}}.o",
258 ] 242 ]
259 compile_wrapper = rebase_path("//build/toolchain/gcc_compile_wrapper.py",
260 root_build_dir)
261 command = "$python_path \"$compile_wrapper\"$whitelist_flag $command"
262 } 243 }
263 244
264 tool("asm") { 245 tool("asm") {
265 # For GCC we can just use the C compiler to compile assembly. 246 # For GCC we can just use the C compiler to compile assembly.
266 depfile = "{{output}}.d" 247 depfile = "{{output}}.d"
267 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di rs}} {{asmflags}} -c {{source}} -o {{output}}" 248 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di rs}} {{asmflags}} -c {{source}} -o {{output}}"
268 depsformat = "gcc" 249 depsformat = "gcc"
269 description = "ASM {{output}}" 250 description = "ASM {{output}}"
270 outputs = [ 251 outputs = [
271 "$object_subdir/{{source_name_part}}.o", 252 "$object_subdir/{{source_name_part}}.o",
272 ] 253 ]
273 } 254 }
274 255
275 tool("alink") { 256 tool("alink") {
276 rspfile = "{{output}}.rsp" 257 rspfile = "{{output}}.rsp"
277 whitelist_flag = " "
278 if (enable_resource_whitelist_generation) {
279 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\""
280 }
281 258
282 # This needs a Python script to avoid using simple sh features in this 259 # This needs a Python script to avoid using simple sh features in this
283 # command, in case the host does not use a POSIX shell (e.g. compiling 260 # command, in case the host does not use a POSIX shell (e.g. compiling
284 # POSIX-like toolchains such as NaCl on Windows). 261 # POSIX-like toolchains such as NaCl on Windows).
285 ar_wrapper = 262 ar_wrapper =
286 rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir) 263 rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir)
287 command = "$python_path \"$ar_wrapper\"$whitelist_flag --output={{output}} --ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\"" 264 command = "$python_path \"$ar_wrapper\" --output={{output}} --ar=\"$ar\" { {arflags}} rcsD @\"$rspfile\""
288 description = "AR {{output}}" 265 description = "AR {{output}}"
289 rspfile_content = "{{inputs}}" 266 rspfile_content = "{{inputs}}"
290 outputs = [ 267 outputs = [
291 "{{output_dir}}/{{target_output_name}}{{output_extension}}", 268 "{{output_dir}}/{{target_output_name}}{{output_extension}}",
292 ] 269 ]
293 270
294 # Shared libraries go in the target out directory by default so we can 271 # Shared libraries go in the target out directory by default so we can
295 # generate different targets with the same name and not have them collide. 272 # generate different targets with the same name and not have them collide.
296 default_output_dir = "{{target_out_dir}}" 273 default_output_dir = "{{target_out_dir}}"
297 default_output_extension = ".a" 274 default_output_extension = ".a"
298 output_prefix = "lib" 275 output_prefix = "lib"
299 } 276 }
300 277
301 tool("solink") { 278 tool("solink") {
302 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". 279 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
303 sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir. 280 sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir.
304 rspfile = sofile + ".rsp" 281 rspfile = sofile + ".rsp"
305 whitelist_flag = " "
306 if (enable_resource_whitelist_generation) {
307 whitelist_file = "$sofile.whitelist"
308 whitelist_flag = " --resource-whitelist=\"$whitelist_file\""
309 }
310 282
311 if (defined(invoker.strip)) { 283 if (defined(invoker.strip)) {
312 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" 284 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname"
313 } else { 285 } else {
314 unstripped_sofile = sofile 286 unstripped_sofile = sofile
315 } 287 }
316 288
317 # These variables are not built into GN but are helpers that 289 # These variables are not built into GN but are helpers that
318 # implement (1) linking to produce a .so, (2) extracting the symbols 290 # implement (1) linking to produce a .so, (2) extracting the symbols
319 # from that file (3) if the extracted list differs from the existing 291 # from that file (3) if the extracted list differs from the existing
320 # .TOC file, overwrite it, otherwise, don't change it. 292 # .TOC file, overwrite it, otherwise, don't change it.
321 tocfile = sofile + ".TOC" 293 tocfile = sofile + ".TOC"
322 294
323 link_command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_s ofile\" -Wl,-soname=\"$soname\" @\"$rspfile\"" 295 link_command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_s ofile\" -Wl,-soname=\"$soname\" @\"$rspfile\""
324 296
325 assert(defined(readelf), "to solink you must have a readelf") 297 assert(defined(readelf), "to solink you must have a readelf")
326 assert(defined(nm), "to solink you must have an nm") 298 assert(defined(nm), "to solink you must have an nm")
327 strip_switch = "" 299 strip_switch = ""
328 if (defined(invoker.strip)) { 300 if (defined(invoker.strip)) {
329 strip_switch = "--strip=${invoker.strip}" 301 strip_switch = "--strip=${invoker.strip}"
330 } 302 }
331 303
332 # This needs a Python script to avoid using a complex shell command 304 # This needs a Python script to avoid using a complex shell command
333 # requiring sh control structures, pipelines, and POSIX utilities. 305 # requiring sh control structures, pipelines, and POSIX utilities.
334 # The host might not have a POSIX shell and utilities (e.g. Windows). 306 # The host might not have a POSIX shell and utilities (e.g. Windows).
335 solink_wrapper = rebase_path("//build/toolchain/gcc_solink_wrapper.py") 307 solink_wrapper = rebase_path("//build/toolchain/gcc_solink_wrapper.py")
336 command = "$python_path \"$solink_wrapper\" --readelf=\"$readelf\" --nm=\" $nm\" $strip_switch --sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\" --out put=\"$sofile\"$whitelist_flag -- $link_command" 308 command = "$python_path \"$solink_wrapper\" --readelf=\"$readelf\" --nm=\" $nm\" $strip_switch --sofile=\"$unstripped_sofile\" --tocfile=\"$tocfile\" --out put=\"$sofile\" -- $link_command"
337 309
338 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whol e-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix" 310 rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whol e-archive $solink_libs_section_prefix {{libs}} $solink_libs_section_postfix"
339 311
340 description = "SOLINK $sofile" 312 description = "SOLINK $sofile"
341 313
342 # Use this for {{output_extension}} expansions unless a target manually 314 # Use this for {{output_extension}} expansions unless a target manually
343 # overrides it (in which case {{output_extension}} will be what the target 315 # overrides it (in which case {{output_extension}} will be what the target
344 # specifies). 316 # specifies).
345 default_output_extension = default_shlib_extension 317 default_output_extension = default_shlib_extension
346 318
347 default_output_dir = "{{root_out_dir}}" 319 default_output_dir = "{{root_out_dir}}"
348 if (shlib_subdir != ".") { 320 if (shlib_subdir != ".") {
349 default_output_dir += "/$shlib_subdir" 321 default_output_dir += "/$shlib_subdir"
350 } 322 }
351 323
352 output_prefix = "lib" 324 output_prefix = "lib"
353 325
354 # Since the above commands only updates the .TOC file when it changes, ask 326 # Since the above commands only updates the .TOC file when it changes, ask
355 # Ninja to check if the timestamp actually changed to know if downstream 327 # Ninja to check if the timestamp actually changed to know if downstream
356 # dependencies should be recompiled. 328 # dependencies should be recompiled.
357 restat = true 329 restat = true
358 330
359 # Tell GN about the output files. It will link to the sofile but use the 331 # Tell GN about the output files. It will link to the sofile but use the
360 # tocfile for dependency management. 332 # tocfile for dependency management.
361 outputs = [ 333 outputs = [
362 sofile, 334 sofile,
363 tocfile, 335 tocfile,
364 ] 336 ]
365 if (enable_resource_whitelist_generation) {
366 outputs += [ whitelist_file ]
367 }
368 if (sofile != unstripped_sofile) { 337 if (sofile != unstripped_sofile) {
369 outputs += [ unstripped_sofile ] 338 outputs += [ unstripped_sofile ]
370 } 339 }
371 link_output = sofile 340 link_output = sofile
372 depend_output = tocfile 341 depend_output = tocfile
373 } 342 }
374 343
375 tool("solink_module") { 344 tool("solink_module") {
376 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". 345 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
377 sofile = "{{output_dir}}/$soname" 346 sofile = "{{output_dir}}/$soname"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 "toolchain_os", 538 "toolchain_os",
570 "use_gold", 539 "use_gold",
571 "v8_toolchain_cpu", 540 "v8_toolchain_cpu",
572 ]) 541 ])
573 542
574 if (defined(invoker.use_debug_fission)) { 543 if (defined(invoker.use_debug_fission)) {
575 use_debug_fission = invoker.use_debug_fission 544 use_debug_fission = invoker.use_debug_fission
576 } 545 }
577 } 546 }
578 } 547 }
OLDNEW
« no previous file with comments | « build/toolchain/gcc_solink_wrapper.py ('k') | build/toolchain/wrapper_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698