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/clang/clang.gni") | 6 import("//build/config/clang/clang.gni") |
7 import("//build/config/nacl/config.gni") | 7 import("//build/config/nacl/config.gni") |
8 import("//build/config/sanitizers/sanitizers.gni") | 8 import("//build/config/sanitizers/sanitizers.gni") |
9 import("//build/config/v8_target_cpu.gni") | 9 import("//build/config/v8_target_cpu.gni") |
10 import("//build/toolchain/cc_wrapper.gni") | 10 import("//build/toolchain/cc_wrapper.gni") |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 whitelist_flag = " " | 310 whitelist_flag = " " |
311 if (enable_resource_whitelist_generation) { | 311 if (enable_resource_whitelist_generation) { |
312 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\"" | 312 whitelist_flag = " --resource-whitelist=\"{{output}}.whitelist\"" |
313 } | 313 } |
314 | 314 |
315 # This needs a Python script to avoid using simple sh features in this | 315 # This needs a Python script to avoid using simple sh features in this |
316 # command, in case the host does not use a POSIX shell (e.g. compiling | 316 # command, in case the host does not use a POSIX shell (e.g. compiling |
317 # POSIX-like toolchains such as NaCl on Windows). | 317 # POSIX-like toolchains such as NaCl on Windows). |
318 ar_wrapper = | 318 ar_wrapper = |
319 rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir) | 319 rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir) |
320 command = "$python_path \"$ar_wrapper\"$whitelist_flag --output={{output}}
--ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\"" | 320 if (current_os == "aix") { |
| 321 # We use slightly different arflags for AIX. |
| 322 extra_arflags = "rcsT" |
| 323 } else { |
| 324 extra_arflags = "rcsD" |
| 325 } |
| 326 command = "$python_path \"$ar_wrapper\"$whitelist_flag --output={{output}}
--ar=\"$ar\" {{arflags}} $extra_arflags @\"$rspfile\"" |
321 description = "AR {{output}}" | 327 description = "AR {{output}}" |
322 rspfile_content = "{{inputs}}" | 328 rspfile_content = "{{inputs}}" |
323 outputs = [ | 329 outputs = [ |
324 "{{output_dir}}/{{target_output_name}}{{output_extension}}", | 330 "{{output_dir}}/{{target_output_name}}{{output_extension}}", |
325 ] | 331 ] |
326 | 332 |
327 # Shared libraries go in the target out directory by default so we can | 333 # Shared libraries go in the target out directory by default so we can |
328 # generate different targets with the same name and not have them collide. | 334 # generate different targets with the same name and not have them collide. |
329 default_output_dir = "{{target_out_dir}}" | 335 default_output_dir = "{{target_out_dir}}" |
330 default_output_extension = ".a" | 336 default_output_extension = ".a" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 | 490 |
485 # Generate a map file to be used for binary size analysis. | 491 # Generate a map file to be used for binary size analysis. |
486 # Map file adds ~10% to the link time on a z620. | 492 # Map file adds ~10% to the link time on a z620. |
487 # With target_os="android", libchrome.so.map.gz is ~20MB. | 493 # With target_os="android", libchrome.so.map.gz is ~20MB. |
488 map_switch = "" | 494 map_switch = "" |
489 if (enable_linker_map && is_official_build) { | 495 if (enable_linker_map && is_official_build) { |
490 map_file = "$unstripped_outfile.map.gz" | 496 map_file = "$unstripped_outfile.map.gz" |
491 map_switch = " --map-file \"$map_file\"" | 497 map_switch = " --map-file \"$map_file\"" |
492 } | 498 } |
493 | 499 |
494 link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\"
-Wl,--start-group @\"$rspfile\" {{solibs}} -Wl,--end-group $libs_section_prefix
{{libs}} $libs_section_postfix" | 500 start_group_flag = "" |
| 501 end_group_flag = "" |
| 502 if (current_os != "aix") { |
| 503 # the "--start-group .. --end-group" feature isn't available on the aix
ld. |
| 504 start_group_flag = "-Wl,--start-group" |
| 505 end_group_flag = "-Wl,--end-group " |
| 506 } |
| 507 link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\"
$start_group_flag @\"$rspfile\" {{solibs}} $end_group_flag $libs_section_prefix
{{libs}} $libs_section_postfix" |
495 | 508 |
496 strip_switch = "" | 509 strip_switch = "" |
| 510 |
497 if (defined(invoker.strip)) { | 511 if (defined(invoker.strip)) { |
498 strip_switch = " --strip=\"${invoker.strip}\" --unstripped-file=\"$unstr
ipped_outfile\"" | 512 strip_switch = " --strip=\"${invoker.strip}\" --unstripped-file=\"$unstr
ipped_outfile\"" |
499 } | 513 } |
500 | 514 |
501 link_wrapper = | 515 link_wrapper = |
502 rebase_path("//build/toolchain/gcc_link_wrapper.py", root_build_dir) | 516 rebase_path("//build/toolchain/gcc_link_wrapper.py", root_build_dir) |
503 command = "$python_path \"$link_wrapper\" --output=\"$outfile\"$strip_swit
ch$map_switch -- $link_command" | 517 command = "$python_path \"$link_wrapper\" --output=\"$outfile\"$strip_swit
ch$map_switch -- $link_command" |
504 description = "LINK $outfile" | 518 description = "LINK $outfile" |
505 rspfile_content = "{{inputs}}" | 519 rspfile_content = "{{inputs}}" |
506 outputs = [ | 520 outputs = [ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 ]) | 578 ]) |
565 | 579 |
566 toolchain_args = { | 580 toolchain_args = { |
567 if (defined(invoker.toolchain_args)) { | 581 if (defined(invoker.toolchain_args)) { |
568 forward_variables_from(invoker.toolchain_args, "*") | 582 forward_variables_from(invoker.toolchain_args, "*") |
569 } | 583 } |
570 is_clang = true | 584 is_clang = true |
571 } | 585 } |
572 } | 586 } |
573 } | 587 } |
OLD | NEW |