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