| 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/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") | |
| 13 | 12 |
| 14 # This template defines a toolchain for something that works like gcc | 13 # This template defines a toolchain for something that works like gcc |
| 15 # (including clang). | 14 # (including clang). |
| 16 # | 15 # |
| 17 # It requires the following variables specifying the executables to run: | 16 # It requires the following variables specifying the executables to run: |
| 18 # - ar | 17 # - ar |
| 19 # - cc | 18 # - cc |
| 20 # - cxx | 19 # - cxx |
| 21 # - ld | 20 # - ld |
| 22 # and the following which is used in the toolchain_args | 21 # and the following which is used in the toolchain_args |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 toolchain(target_name) { | 106 toolchain(target_name) { |
| 108 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 107 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
| 109 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 108 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
| 110 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 109 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
| 111 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 110 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
| 112 assert(defined(invoker.toolchain_cpu), | 111 assert(defined(invoker.toolchain_cpu), |
| 113 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 112 "gcc_toolchain() must specify a \"toolchain_cpu\"") |
| 114 assert(defined(invoker.toolchain_os), | 113 assert(defined(invoker.toolchain_os), |
| 115 "gcc_toolchain() must specify a \"toolchain_os\"") | 114 "gcc_toolchain() must specify a \"toolchain_os\"") |
| 116 | 115 |
| 117 # concurrent_links is picked up from the declare_arg(). | |
| 118 | |
| 119 if (defined(invoker.cc_wrapper)) { | 116 if (defined(invoker.cc_wrapper)) { |
| 120 cc_wrapper = invoker.cc_wrapper | 117 cc_wrapper = invoker.cc_wrapper |
| 121 } | 118 } |
| 122 if (defined(invoker.use_goma)) { | 119 if (defined(invoker.use_goma)) { |
| 123 use_goma = invoker.use_goma | 120 use_goma = invoker.use_goma |
| 124 } | 121 } |
| 125 if (use_goma) { | 122 if (use_goma) { |
| 126 assert(cc_wrapper == "", "Goma and cc_wrapper can't be used together.") | 123 assert(cc_wrapper == "", "Goma and cc_wrapper can't be used together.") |
| 127 compiler_prefix = "$goma_dir/gomacc " | 124 compiler_prefix = "$goma_dir/gomacc " |
| 128 } else if (cc_wrapper != "") { | 125 } else if (cc_wrapper != "") { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 # generate different targets with the same name and not have them collide. | 269 # generate different targets with the same name and not have them collide. |
| 273 default_output_dir = "{{target_out_dir}}" | 270 default_output_dir = "{{target_out_dir}}" |
| 274 default_output_extension = ".a" | 271 default_output_extension = ".a" |
| 275 output_prefix = "lib" | 272 output_prefix = "lib" |
| 276 } | 273 } |
| 277 | 274 |
| 278 tool("solink") { | 275 tool("solink") { |
| 279 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". | 276 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". |
| 280 sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir. | 277 sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir. |
| 281 rspfile = sofile + ".rsp" | 278 rspfile = sofile + ".rsp" |
| 279 pool = "//build/toolchain:link_pool($default_toolchain)" |
| 282 | 280 |
| 283 if (defined(invoker.strip)) { | 281 if (defined(invoker.strip)) { |
| 284 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" | 282 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" |
| 285 } else { | 283 } else { |
| 286 unstripped_sofile = sofile | 284 unstripped_sofile = sofile |
| 287 } | 285 } |
| 288 | 286 |
| 289 # These variables are not built into GN but are helpers that | 287 # These variables are not built into GN but are helpers that |
| 290 # implement (1) linking to produce a .so, (2) extracting the symbols | 288 # implement (1) linking to produce a .so, (2) extracting the symbols |
| 291 # from that file (3) if the extracted list differs from the existing | 289 # from that file (3) if the extracted list differs from the existing |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 outputs += [ unstripped_sofile ] | 336 outputs += [ unstripped_sofile ] |
| 339 } | 337 } |
| 340 link_output = sofile | 338 link_output = sofile |
| 341 depend_output = tocfile | 339 depend_output = tocfile |
| 342 } | 340 } |
| 343 | 341 |
| 344 tool("solink_module") { | 342 tool("solink_module") { |
| 345 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". | 343 soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". |
| 346 sofile = "{{output_dir}}/$soname" | 344 sofile = "{{output_dir}}/$soname" |
| 347 rspfile = sofile + ".rsp" | 345 rspfile = sofile + ".rsp" |
| 346 pool = "//build/toolchain:link_pool($default_toolchain)" |
| 348 | 347 |
| 349 if (defined(invoker.strip)) { | 348 if (defined(invoker.strip)) { |
| 350 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" | 349 unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" |
| 351 } else { | 350 } else { |
| 352 unstripped_sofile = sofile | 351 unstripped_sofile = sofile |
| 353 } | 352 } |
| 354 | 353 |
| 355 command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile
\" -Wl,-soname=\"$soname\" @\"$rspfile\"" | 354 command = "$ld -shared {{ldflags}}${extra_ldflags} -o \"$unstripped_sofile
\" -Wl,-soname=\"$soname\" @\"$rspfile\"" |
| 356 | 355 |
| 357 if (defined(invoker.strip)) { | 356 if (defined(invoker.strip)) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 384 if (sofile != unstripped_sofile) { | 383 if (sofile != unstripped_sofile) { |
| 385 outputs += [ unstripped_sofile ] | 384 outputs += [ unstripped_sofile ] |
| 386 } | 385 } |
| 387 } | 386 } |
| 388 | 387 |
| 389 tool("link") { | 388 tool("link") { |
| 390 exename = "{{target_output_name}}{{output_extension}}" | 389 exename = "{{target_output_name}}{{output_extension}}" |
| 391 outfile = "{{output_dir}}/$exename" | 390 outfile = "{{output_dir}}/$exename" |
| 392 rspfile = "$outfile.rsp" | 391 rspfile = "$outfile.rsp" |
| 393 unstripped_outfile = outfile | 392 unstripped_outfile = outfile |
| 393 pool = "//build/toolchain:link_pool($default_toolchain)" |
| 394 | 394 |
| 395 # Use this for {{output_extension}} expansions unless a target manually | 395 # Use this for {{output_extension}} expansions unless a target manually |
| 396 # overrides it (in which case {{output_extension}} will be what the target | 396 # overrides it (in which case {{output_extension}} will be what the target |
| 397 # specifies). | 397 # specifies). |
| 398 default_output_extension = default_executable_extension | 398 default_output_extension = default_executable_extension |
| 399 | 399 |
| 400 default_output_dir = "{{root_out_dir}}" | 400 default_output_dir = "{{root_out_dir}}" |
| 401 | 401 |
| 402 if (defined(invoker.strip)) { | 402 if (defined(invoker.strip)) { |
| 403 unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename" | 403 unstripped_outfile = "{{root_out_dir}}/exe.unstripped/$exename" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 "toolchain_os", | 538 "toolchain_os", |
| 539 "use_gold", | 539 "use_gold", |
| 540 "v8_toolchain_cpu", | 540 "v8_toolchain_cpu", |
| 541 ]) | 541 ]) |
| 542 | 542 |
| 543 if (defined(invoker.use_debug_fission)) { | 543 if (defined(invoker.use_debug_fission)) { |
| 544 use_debug_fission = invoker.use_debug_fission | 544 use_debug_fission = invoker.use_debug_fission |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 } | 547 } |
| OLD | NEW |