github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/third_party/toolchains/preconfig/centos6/gcc7-nvcc-cuda10.0/CROSSTOOL (about) 1 major_version: "local" 2 minor_version: "" 3 default_target_cpu: "same_as_host" 4 5 toolchain { 6 abi_version: "local" 7 abi_libc_version: "local" 8 compiler: "compiler" 9 host_system_name: "local" 10 needsPic: true 11 target_libc: "local" 12 target_cpu: "local" 13 target_system_name: "local" 14 toolchain_identifier: "local_linux" 15 16 feature { 17 name: "c++11" 18 flag_set { 19 action: "c++-compile" 20 flag_group { 21 flag: "-std=c++11" 22 } 23 } 24 } 25 26 feature { 27 name: "stdlib" 28 flag_set { 29 action: "c++-link-executable" 30 action: "c++-link-dynamic-library" 31 action: "c++-link-nodeps-dynamic-library" 32 flag_group { 33 flag: "-lstdc++" 34 } 35 } 36 } 37 38 feature { 39 name: "determinism" 40 flag_set { 41 action: "c-compile" 42 action: "c++-compile" 43 flag_group { 44 # Make C++ compilation deterministic. Use linkstamping instead of these 45 # compiler symbols. 46 flag: "-Wno-builtin-macro-redefined" 47 flag: "-D__DATE__=\"redacted\"" 48 flag: "-D__TIMESTAMP__=\"redacted\"" 49 flag: "-D__TIME__=\"redacted\"" 50 } 51 } 52 } 53 54 feature { 55 name: "alwayslink" 56 flag_set { 57 action: "c++-link-dynamic-library" 58 action: "c++-link-nodeps-dynamic-library" 59 action: "c++-link-executable" 60 flag_group { 61 flag: "-Wl,-no-as-needed" 62 } 63 } 64 } 65 66 # This feature will be enabled for builds that support pic by bazel. 67 feature { 68 name: "pic" 69 flag_set { 70 action: "c-compile" 71 action: "c++-compile" 72 flag_group { 73 expand_if_all_available: "pic" 74 flag: "-fPIC" 75 } 76 flag_group { 77 expand_if_none_available: "pic" 78 flag: "-fPIE" 79 } 80 } 81 } 82 83 # Security hardening on by default. 84 feature { 85 name: "hardening" 86 flag_set { 87 action: "c-compile" 88 action: "c++-compile" 89 flag_group { 90 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. 91 # We need to undef it before redefining it as some distributions now 92 # have it enabled by default. 93 flag: "-U_FORTIFY_SOURCE" 94 flag: "-D_FORTIFY_SOURCE=1" 95 flag: "-fstack-protector" 96 } 97 } 98 flag_set { 99 action: "c++-link-dynamic-library" 100 action: "c++-link-nodeps-dynamic-library" 101 flag_group { 102 flag: "-Wl,-z,relro,-z,now" 103 } 104 } 105 flag_set { 106 action: "c++-link-executable" 107 flag_group { 108 flag: "-pie" 109 flag: "-Wl,-z,relro,-z,now" 110 } 111 } 112 } 113 114 feature { 115 name: "warnings" 116 flag_set { 117 action: "c-compile" 118 action: "c++-compile" 119 flag_group { 120 # All warnings are enabled. Maybe enable -Werror as well? 121 flag: "-Wall" 122 123 } 124 } 125 } 126 127 # Keep stack frames for debugging, even in opt mode. 128 feature { 129 name: "frame-pointer" 130 flag_set { 131 action: "c-compile" 132 action: "c++-compile" 133 flag_group { 134 flag: "-fno-omit-frame-pointer" 135 } 136 } 137 } 138 139 feature { 140 name: "build-id" 141 flag_set { 142 action: "c++-link-executable" 143 action: "c++-link-dynamic-library" 144 action: "c++-link-nodeps-dynamic-library" 145 flag_group { 146 # Stamp the binary with a unique identifier. 147 flag: "-Wl,--build-id=md5" 148 flag: "-Wl,--hash-style=gnu" 149 } 150 } 151 } 152 153 feature { 154 name: "no-canonical-prefixes" 155 flag_set { 156 action: "c-compile" 157 action: "c++-compile" 158 action: "c++-link-executable" 159 action: "c++-link-dynamic-library" 160 action: "c++-link-nodeps-dynamic-library" 161 flag_group { 162 flag: "-no-canonical-prefixes" 163 flag: "-fno-canonical-system-headers" 164 } 165 } 166 } 167 168 feature { 169 name: "disable-assertions" 170 flag_set { 171 action: "c-compile" 172 action: "c++-compile" 173 flag_group { 174 flag: "-DNDEBUG" 175 } 176 } 177 } 178 179 feature { 180 name: "linker-bin-path" 181 182 flag_set { 183 action: "c++-link-executable" 184 action: "c++-link-dynamic-library" 185 action: "c++-link-nodeps-dynamic-library" 186 flag_group { 187 flag: "-B/opt/rh/devtoolset-7/root/usr/bin" 188 } 189 } 190 } 191 192 feature { 193 name: "common" 194 implies: "stdlib" 195 implies: "c++11" 196 implies: "determinism" 197 implies: "alwayslink" 198 implies: "hardening" 199 implies: "warnings" 200 implies: "frame-pointer" 201 implies: "build-id" 202 implies: "no-canonical-prefixes" 203 implies: "linker-bin-path" 204 } 205 206 feature { 207 name: "opt" 208 implies: "common" 209 implies: "disable-assertions" 210 211 flag_set { 212 action: "c-compile" 213 action: "c++-compile" 214 flag_group { 215 # No debug symbols. 216 # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt 217 # or even generally? However, that can't happen here, as it requires 218 # special handling in Bazel. 219 flag: "-g0" 220 221 # Conservative choice for -O 222 # -O3 can increase binary size and even slow down the resulting binaries. 223 # Profile first and / or use FDO if you need better performance than this. 224 flag: "-O2" 225 226 # Removal of unused code and data at link time (can this increase binary size in some cases?). 227 flag: "-ffunction-sections" 228 flag: "-fdata-sections" 229 } 230 } 231 flag_set { 232 action: "c++-link-dynamic-library" 233 action: "c++-link-nodeps-dynamic-library" 234 action: "c++-link-executable" 235 flag_group { 236 flag: "-Wl,--gc-sections" 237 } 238 } 239 } 240 241 feature { 242 name: "fastbuild" 243 implies: "common" 244 } 245 246 feature { 247 name: "dbg" 248 implies: "common" 249 flag_set { 250 action: "c-compile" 251 action: "c++-compile" 252 flag_group { 253 flag: "-g" 254 } 255 } 256 } 257 258 # Set clang as a C/C++ compiler. 259 tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" } 260 261 # Use the default system toolchain for everything else. 262 tool_path { name: "ar" path: "/opt/rh/devtoolset-7/root/usr/bin/ar" } 263 tool_path { name: "compat-ld" path: "/opt/rh/devtoolset-7/root/usr/bin/ld" } 264 tool_path { name: "cpp" path: "/opt/rh/devtoolset-7/root/usr/bin/cpp" } 265 tool_path { name: "dwp" path: "/opt/rh/devtoolset-7/root/usr/bin/dwp" } 266 tool_path { name: "gcov" path: "/opt/rh/devtoolset-7/root/usr/bin/gcov" } 267 tool_path { name: "ld" path: "/opt/rh/devtoolset-7/root/usr/bin/ld" } 268 tool_path { name: "nm" path: "/opt/rh/devtoolset-7/root/usr/bin/nm" } 269 tool_path { name: "objcopy" path: "/opt/rh/devtoolset-7/root/usr/bin/objcopy" } 270 tool_path { name: "objdump" path: "/opt/rh/devtoolset-7/root/usr/bin/objdump" } 271 tool_path { name: "strip" path: "/opt/rh/devtoolset-7/root/usr/bin/strip" } 272 273 # Enabled dynamic linking. 274 linking_mode_flags { mode: DYNAMIC } 275 276 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include/c++/7" 277 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux" 278 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include/c++/7/backward" 279 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include" 280 cxx_builtin_include_directory: "/usr/local/include" 281 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include" 282 cxx_builtin_include_directory: "/usr/include" 283 cxx_builtin_include_directory: "/usr/local/cuda-10.0/targets/x86_64-linux/include" 284 cxx_builtin_include_directory: "/usr/local/cuda-10.0/include" 285 cxx_builtin_include_directory: "/usr/local/cuda-10.0/extras/CUPTI/include" 286 cxx_builtin_include_directory: "/usr/local/cuda-10.0/include" 287 } 288 289 toolchain { 290 abi_version: "local" 291 abi_libc_version: "local" 292 compiler: "compiler" 293 host_system_name: "local" 294 needsPic: true 295 target_libc: "macosx" 296 target_cpu: "darwin" 297 target_system_name: "local" 298 toolchain_identifier: "local_darwin" 299 feature { 300 name: "c++11" 301 flag_set { 302 action: "c++-compile" 303 flag_group { 304 flag: "-std=c++11" 305 } 306 } 307 } 308 309 feature { 310 name: "stdlib" 311 flag_set { 312 action: "c++-link-executable" 313 action: "c++-link-dynamic-library" 314 action: "c++-link-nodeps-dynamic-library" 315 flag_group { 316 flag: "-lc++" 317 } 318 } 319 } 320 321 feature { 322 name: "determinism" 323 flag_set { 324 action: "c-compile" 325 action: "c++-compile" 326 flag_group { 327 # Make C++ compilation deterministic. Use linkstamping instead of these 328 # compiler symbols. 329 flag: "-Wno-builtin-macro-redefined" 330 flag: "-D__DATE__=\"redacted\"" 331 flag: "-D__TIMESTAMP__=\"redacted\"" 332 flag: "-D__TIME__=\"redacted\"" 333 } 334 } 335 } 336 337 # This feature will be enabled for builds that support pic by bazel. 338 feature { 339 name: "pic" 340 flag_set { 341 action: "c-compile" 342 action: "c++-compile" 343 flag_group { 344 expand_if_all_available: "pic" 345 flag: "-fPIC" 346 } 347 flag_group { 348 expand_if_none_available: "pic" 349 flag: "-fPIE" 350 } 351 } 352 } 353 354 # Security hardening on by default. 355 feature { 356 name: "hardening" 357 flag_set { 358 action: "c-compile" 359 action: "c++-compile" 360 flag_group { 361 # Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases. 362 # We need to undef it before redefining it as some distributions now 363 # have it enabled by default. 364 flag: "-U_FORTIFY_SOURCE" 365 flag: "-D_FORTIFY_SOURCE=1" 366 flag: "-fstack-protector" 367 } 368 } 369 flag_set { 370 action: "c++-link-executable" 371 flag_group { 372 flag: "-pie" 373 } 374 } 375 } 376 377 feature { 378 name: "warnings" 379 flag_set { 380 action: "c-compile" 381 action: "c++-compile" 382 flag_group { 383 # All warnings are enabled. Maybe enable -Werror as well? 384 flag: "-Wall" 385 386 } 387 } 388 } 389 390 # Keep stack frames for debugging, even in opt mode. 391 feature { 392 name: "frame-pointer" 393 flag_set { 394 action: "c-compile" 395 action: "c++-compile" 396 flag_group { 397 flag: "-fno-omit-frame-pointer" 398 } 399 } 400 } 401 402 feature { 403 name: "no-canonical-prefixes" 404 flag_set { 405 action: "c-compile" 406 action: "c++-compile" 407 action: "c++-link-executable" 408 action: "c++-link-dynamic-library" 409 action: "c++-link-nodeps-dynamic-library" 410 flag_group { 411 flag:"-no-canonical-prefixes" 412 } 413 } 414 } 415 416 feature { 417 name: "disable-assertions" 418 flag_set { 419 action: "c-compile" 420 action: "c++-compile" 421 flag_group { 422 flag: "-DNDEBUG" 423 } 424 } 425 } 426 427 feature { 428 name: "linker-bin-path" 429 430 flag_set { 431 action: "c++-link-executable" 432 action: "c++-link-dynamic-library" 433 action: "c++-link-nodeps-dynamic-library" 434 flag_group { 435 flag: "-B/opt/rh/devtoolset-7/root/usr/bin" 436 } 437 } 438 } 439 440 feature { 441 name: "undefined-dynamic" 442 flag_set { 443 action: "c++-link-dynamic-library" 444 action: "c++-link-nodeps-dynamic-library" 445 action: "c++-link-executable" 446 flag_group { 447 flag: "-undefined" 448 flag: "dynamic_lookup" 449 } 450 } 451 } 452 453 feature { 454 name: "common" 455 implies: "stdlib" 456 implies: "c++11" 457 implies: "determinism" 458 implies: "hardening" 459 implies: "warnings" 460 implies: "frame-pointer" 461 implies: "no-canonical-prefixes" 462 implies: "linker-bin-path" 463 implies: "undefined-dynamic" 464 } 465 466 feature { 467 name: "opt" 468 implies: "common" 469 implies: "disable-assertions" 470 471 flag_set { 472 action: "c-compile" 473 action: "c++-compile" 474 flag_group { 475 # No debug symbols. 476 # Maybe we should enable https://gcc.gnu.org/wiki/DebugFission for opt 477 # or even generally? However, that can't happen here, as it requires 478 # special handling in Bazel. 479 flag: "-g0" 480 481 # Conservative choice for -O 482 # -O3 can increase binary size and even slow down the resulting binaries. 483 # Profile first and / or use FDO if you need better performance than this. 484 flag: "-O2" 485 486 # Removal of unused code and data at link time (can this increase binary size in some cases?). 487 flag: "-ffunction-sections" 488 flag: "-fdata-sections" 489 } 490 } 491 } 492 493 feature { 494 name: "fastbuild" 495 implies: "common" 496 } 497 498 feature { 499 name: "dbg" 500 implies: "common" 501 flag_set { 502 action: "c-compile" 503 action: "c++-compile" 504 flag_group { 505 flag: "-g" 506 } 507 } 508 } 509 510 # Set clang as a C/C++ compiler. 511 tool_path { name: "gcc" path: "clang/bin/crosstool_wrapper_driver_is_not_gcc" } 512 513 # Use the default system toolchain for everything else. 514 tool_path { name: "ar" path: "/usr/bin/libtool" } 515 tool_path { name: "compat-ld" path: "/usr/bin/ld" } 516 tool_path { name: "cpp" path: "/usr/bin/cpp" } 517 tool_path { name: "dwp" path: "/usr/bin/dwp" } 518 tool_path { name: "gcov" path: "/usr/bin/gcov" } 519 tool_path { name: "ld" path: "/usr/bin/ld" } 520 tool_path { name: "nm" path: "/usr/bin/nm" } 521 tool_path { name: "objcopy" path: "/usr/bin/objcopy" } 522 tool_path { name: "objdump" path: "/usr/bin/objdump" } 523 tool_path { name: "strip" path: "/usr/bin/strip" } 524 525 # Enabled dynamic linking. 526 linking_mode_flags { mode: DYNAMIC } 527 528 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include/c++/7" 529 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include/c++/7/x86_64-redhat-linux" 530 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include/c++/7/backward" 531 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/include" 532 cxx_builtin_include_directory: "/usr/local/include" 533 cxx_builtin_include_directory: "/opt/rh/devtoolset-7/root/usr/include" 534 cxx_builtin_include_directory: "/usr/include" 535 cxx_builtin_include_directory: "/usr/local/cuda-10.0/targets/x86_64-linux/include" 536 cxx_builtin_include_directory: "/usr/local/cuda-10.0/include" 537 cxx_builtin_include_directory: "/usr/local/cuda-10.0/extras/CUPTI/include" 538 cxx_builtin_include_directory: "/usr/local/cuda-10.0/include" 539 } 540 541 toolchain { 542 toolchain_identifier: "local_windows" 543 host_system_name: "local" 544 target_system_name: "local" 545 546 abi_version: "local" 547 abi_libc_version: "local" 548 target_cpu: "x64_windows" 549 compiler: "msvc-cl" 550 target_libc: "msvcrt" 551 552 553 554 tool_path { 555 name: "ar" 556 path: "" 557 } 558 tool_path { 559 name: "ml" 560 path: "" 561 } 562 tool_path { 563 name: "cpp" 564 path: "" 565 } 566 tool_path { 567 name: "gcc" 568 path: "" 569 } 570 tool_path { 571 name: "gcov" 572 path: "wrapper/bin/msvc_nop.bat" 573 } 574 tool_path { 575 name: "ld" 576 path: "" 577 } 578 tool_path { 579 name: "nm" 580 path: "wrapper/bin/msvc_nop.bat" 581 } 582 tool_path { 583 name: "objcopy" 584 path: "wrapper/bin/msvc_nop.bat" 585 } 586 tool_path { 587 name: "objdump" 588 path: "wrapper/bin/msvc_nop.bat" 589 } 590 tool_path { 591 name: "strip" 592 path: "wrapper/bin/msvc_nop.bat" 593 } 594 supports_interface_shared_objects: true 595 596 # TODO(pcloudy): Review those flags below, they should be defined by cl.exe 597 compiler_flag: "/DCOMPILER_MSVC" 598 599 # Don't define min/max macros in windows.h. 600 compiler_flag: "/DNOMINMAX" 601 602 # Platform defines. 603 compiler_flag: "/D_WIN32_WINNT=0x0600" 604 # Turn off warning messages. 605 compiler_flag: "/D_CRT_SECURE_NO_DEPRECATE" 606 compiler_flag: "/D_CRT_SECURE_NO_WARNINGS" 607 compiler_flag: "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS" 608 609 # Useful options to have on for compilation. 610 # Increase the capacity of object files to 2^32 sections. 611 compiler_flag: "/bigobj" 612 # Allocate 500MB for precomputed headers. 613 compiler_flag: "/Zm500" 614 # Use unsigned char by default. 615 compiler_flag: "/J" 616 # Use function level linking. 617 compiler_flag: "/Gy" 618 # Use string pooling. 619 compiler_flag: "/GF" 620 # Catch C++ exceptions only and tell the compiler to assume that functions declared 621 # as extern "C" never throw a C++ exception. 622 compiler_flag: "/EHsc" 623 624 # Globally disabled warnings. 625 # Don't warn about elements of array being be default initialized. 626 compiler_flag: "/wd4351" 627 # Don't warn about no matching delete found. 628 compiler_flag: "/wd4291" 629 # Don't warn about diamond inheritance patterns. 630 compiler_flag: "/wd4250" 631 # Don't warn about insecure functions (e.g. non _s functions). 632 compiler_flag: "/wd4996" 633 634 linker_flag: "/MACHINE:X64" 635 636 feature { 637 name: "no_legacy_features" 638 } 639 640 # TODO(klimek): Previously we were using a .bat file to start python to run 641 # the python script that can redirect to nvcc - unfortunately .bat files 642 # have a rather short maximum length for command lines (8k). Instead, we 643 # now use the python binary as the compiler and pass the python script to 644 # it at the start of the command line. Investigate different possibilities 645 # to run the nvcc wrapper, either using pyinstaller --onefile, or writing 646 # a small C++ wrapper to redirect. 647 feature { 648 name: "redirector" 649 enabled: true 650 flag_set { 651 action: "c-compile" 652 action: "c++-compile" 653 action: "c++-module-compile" 654 action: "c++-module-codegen" 655 action: "c++-header-parsing" 656 action: "assemble" 657 action: "preprocess-assemble" 658 flag_group { 659 flag: "-B" 660 flag: "external/local_config_cuda/crosstool/windows/msvc_wrapper_for_nvcc.py" 661 } 662 } 663 } 664 665 # Suppress startup banner. 666 feature { 667 name: "nologo" 668 flag_set { 669 action: "c-compile" 670 action: "c++-compile" 671 action: "c++-module-compile" 672 action: "c++-module-codegen" 673 action: "c++-header-parsing" 674 action: "assemble" 675 action: "preprocess-assemble" 676 action: "c++-link-executable" 677 action: "c++-link-dynamic-library" 678 action: "c++-link-nodeps-dynamic-library" 679 action: "c++-link-static-library" 680 flag_group { 681 flag: "/nologo" 682 } 683 } 684 } 685 686 feature { 687 name: 'has_configured_linker_path' 688 } 689 690 # This feature indicates strip is not supported, building stripped binary will just result a copy of orignial binary 691 feature { 692 name: 'no_stripping' 693 } 694 695 # This feature indicates this is a toolchain targeting Windows. 696 feature { 697 name: 'targets_windows' 698 implies: 'copy_dynamic_libraries_to_binary' 699 enabled: true 700 } 701 702 feature { 703 name: 'copy_dynamic_libraries_to_binary' 704 } 705 706 action_config { 707 config_name: 'assemble' 708 action_name: 'assemble' 709 tool { 710 tool_path: '' 711 } 712 implies: 'compiler_input_flags' 713 implies: 'compiler_output_flags' 714 implies: 'nologo' 715 implies: 'msvc_env' 716 implies: 'sysroot' 717 } 718 719 action_config { 720 config_name: 'preprocess-assemble' 721 action_name: 'preprocess-assemble' 722 tool { 723 tool_path: '' 724 } 725 implies: 'compiler_input_flags' 726 implies: 'compiler_output_flags' 727 implies: 'nologo' 728 implies: 'msvc_env' 729 implies: 'sysroot' 730 } 731 732 action_config { 733 config_name: 'c-compile' 734 action_name: 'c-compile' 735 tool { 736 tool_path: '' 737 } 738 implies: 'compiler_input_flags' 739 implies: 'compiler_output_flags' 740 implies: 'legacy_compile_flags' 741 implies: 'nologo' 742 implies: 'msvc_env' 743 implies: 'parse_showincludes' 744 implies: 'user_compile_flags' 745 implies: 'sysroot' 746 implies: 'unfiltered_compile_flags' 747 } 748 749 action_config { 750 config_name: 'c++-compile' 751 action_name: 'c++-compile' 752 tool { 753 tool_path: '' 754 } 755 implies: 'compiler_input_flags' 756 implies: 'compiler_output_flags' 757 implies: 'legacy_compile_flags' 758 implies: 'nologo' 759 implies: 'msvc_env' 760 implies: 'parse_showincludes' 761 implies: 'user_compile_flags' 762 implies: 'sysroot' 763 implies: 'unfiltered_compile_flags' 764 } 765 766 action_config { 767 config_name: 'c++-link-executable' 768 action_name: 'c++-link-executable' 769 tool { 770 tool_path: '' 771 } 772 implies: 'nologo' 773 implies: 'linkstamps' 774 implies: 'output_execpath_flags' 775 implies: 'input_param_flags' 776 implies: 'user_link_flags' 777 implies: 'legacy_link_flags' 778 implies: 'linker_subsystem_flag' 779 implies: 'linker_param_file' 780 implies: 'msvc_env' 781 implies: 'no_stripping' 782 } 783 784 action_config { 785 config_name: 'c++-link-dynamic-library' 786 action_name: 'c++-link-dynamic-library' 787 tool { 788 tool_path: '' 789 } 790 implies: 'nologo' 791 implies: 'shared_flag' 792 implies: 'linkstamps' 793 implies: 'output_execpath_flags' 794 implies: 'input_param_flags' 795 implies: 'user_link_flags' 796 implies: 'legacy_link_flags' 797 implies: 'linker_subsystem_flag' 798 implies: 'linker_param_file' 799 implies: 'msvc_env' 800 implies: 'no_stripping' 801 implies: 'has_configured_linker_path' 802 implies: 'def_file' 803 } 804 805 action_config { 806 config_name: 'c++-link-nodeps-dynamic-library' 807 action_name: 'c++-link-nodeps-dynamic-library' 808 tool { 809 tool_path: '' 810 } 811 implies: 'nologo' 812 implies: 'shared_flag' 813 implies: 'linkstamps' 814 implies: 'output_execpath_flags' 815 implies: 'input_param_flags' 816 implies: 'user_link_flags' 817 implies: 'legacy_link_flags' 818 implies: 'linker_subsystem_flag' 819 implies: 'linker_param_file' 820 implies: 'msvc_env' 821 implies: 'no_stripping' 822 implies: 'has_configured_linker_path' 823 implies: 'def_file' 824 } 825 826 action_config { 827 config_name: 'c++-link-static-library' 828 action_name: 'c++-link-static-library' 829 tool { 830 tool_path: '' 831 } 832 implies: 'nologo' 833 implies: 'archiver_flags' 834 implies: 'input_param_flags' 835 implies: 'linker_param_file' 836 implies: 'msvc_env' 837 } 838 839 # TODO(b/65151735): Remove legacy_compile_flags feature when legacy fields are 840 # not used in this crosstool 841 feature { 842 name: 'legacy_compile_flags' 843 flag_set { 844 expand_if_all_available: 'legacy_compile_flags' 845 action: 'preprocess-assemble' 846 action: 'c-compile' 847 action: 'c++-compile' 848 action: 'c++-header-parsing' 849 action: 'c++-module-compile' 850 action: 'c++-module-codegen' 851 flag_group { 852 iterate_over: 'legacy_compile_flags' 853 flag: '%{legacy_compile_flags}' 854 } 855 } 856 } 857 858 feature { 859 name: "msvc_env" 860 env_set { 861 action: "c-compile" 862 action: "c++-compile" 863 action: "c++-module-compile" 864 action: "c++-module-codegen" 865 action: "c++-header-parsing" 866 action: "assemble" 867 action: "preprocess-assemble" 868 action: "c++-link-executable" 869 action: "c++-link-dynamic-library" 870 action: "c++-link-nodeps-dynamic-library" 871 action: "c++-link-static-library" 872 env_entry { 873 key: "PATH" 874 value: "" 875 } 876 env_entry { 877 key: "INCLUDE" 878 value: "" 879 } 880 env_entry { 881 key: "LIB" 882 value: "" 883 } 884 env_entry { 885 key: "TMP" 886 value: "" 887 } 888 env_entry { 889 key: "TEMP" 890 value: "" 891 } 892 } 893 } 894 895 feature { 896 name: 'include_paths' 897 flag_set { 898 action: "assemble" 899 action: 'preprocess-assemble' 900 action: 'c-compile' 901 action: 'c++-compile' 902 action: 'c++-header-parsing' 903 action: 'c++-module-compile' 904 flag_group { 905 iterate_over: 'quote_include_paths' 906 flag: '/I%{quote_include_paths}' 907 } 908 flag_group { 909 iterate_over: 'include_paths' 910 flag: '/I%{include_paths}' 911 } 912 flag_group { 913 iterate_over: 'system_include_paths' 914 flag: '/I%{system_include_paths}' 915 } 916 } 917 } 918 919 feature { 920 name: "preprocessor_defines" 921 flag_set { 922 action: "assemble" 923 action: "preprocess-assemble" 924 action: "c-compile" 925 action: "c++-compile" 926 action: "c++-header-parsing" 927 action: "c++-module-compile" 928 flag_group { 929 flag: "/D%{preprocessor_defines}" 930 iterate_over: "preprocessor_defines" 931 } 932 } 933 } 934 935 # Tell Bazel to parse the output of /showIncludes 936 feature { 937 name: 'parse_showincludes' 938 flag_set { 939 action: 'preprocess-assemble' 940 action: 'c-compile' 941 action: 'c++-compile' 942 action: 'c++-module-compile' 943 action: 'c++-header-parsing' 944 flag_group { 945 flag: "/showIncludes" 946 } 947 } 948 } 949 950 951 feature { 952 name: 'generate_pdb_file' 953 requires: { 954 feature: 'dbg' 955 } 956 requires: { 957 feature: 'fastbuild' 958 } 959 } 960 961 feature { 962 name: 'shared_flag' 963 flag_set { 964 action: 'c++-link-dynamic-library' 965 action: "c++-link-nodeps-dynamic-library" 966 flag_group { 967 flag: '/DLL' 968 } 969 } 970 } 971 972 feature { 973 name: 'linkstamps' 974 flag_set { 975 action: 'c++-link-executable' 976 action: 'c++-link-dynamic-library' 977 action: "c++-link-nodeps-dynamic-library" 978 expand_if_all_available: 'linkstamp_paths' 979 flag_group { 980 iterate_over: 'linkstamp_paths' 981 flag: '%{linkstamp_paths}' 982 } 983 } 984 } 985 986 feature { 987 name: 'output_execpath_flags' 988 flag_set { 989 expand_if_all_available: 'output_execpath' 990 action: 'c++-link-executable' 991 action: 'c++-link-dynamic-library' 992 action: "c++-link-nodeps-dynamic-library" 993 flag_group { 994 flag: '/OUT:%{output_execpath}' 995 } 996 } 997 } 998 999 feature { 1000 name: 'archiver_flags' 1001 flag_set { 1002 expand_if_all_available: 'output_execpath' 1003 action: 'c++-link-static-library' 1004 flag_group { 1005 flag: '/OUT:%{output_execpath}' 1006 } 1007 } 1008 } 1009 1010 feature { 1011 name: 'input_param_flags' 1012 flag_set { 1013 expand_if_all_available: 'interface_library_output_path' 1014 action: 'c++-link-dynamic-library' 1015 action: "c++-link-nodeps-dynamic-library" 1016 flag_group { 1017 flag: "/IMPLIB:%{interface_library_output_path}" 1018 } 1019 } 1020 flag_set { 1021 expand_if_all_available: 'libopts' 1022 action: 'c++-link-executable' 1023 action: 'c++-link-dynamic-library' 1024 action: "c++-link-nodeps-dynamic-library" 1025 flag_group { 1026 iterate_over: 'libopts' 1027 flag: '%{libopts}' 1028 } 1029 } 1030 flag_set { 1031 expand_if_all_available: 'libraries_to_link' 1032 action: 'c++-link-executable' 1033 action: 'c++-link-dynamic-library' 1034 action: "c++-link-nodeps-dynamic-library" 1035 action: 'c++-link-static-library' 1036 flag_group { 1037 iterate_over: 'libraries_to_link' 1038 flag_group { 1039 expand_if_equal: { 1040 variable: 'libraries_to_link.type' 1041 value: 'object_file_group' 1042 } 1043 iterate_over: 'libraries_to_link.object_files' 1044 flag_group { 1045 flag: '%{libraries_to_link.object_files}' 1046 } 1047 } 1048 flag_group { 1049 expand_if_equal: { 1050 variable: 'libraries_to_link.type' 1051 value: 'object_file' 1052 } 1053 flag_group { 1054 flag: '%{libraries_to_link.name}' 1055 } 1056 } 1057 flag_group { 1058 expand_if_equal: { 1059 variable: 'libraries_to_link.type' 1060 value: 'interface_library' 1061 } 1062 flag_group { 1063 flag: '%{libraries_to_link.name}' 1064 } 1065 } 1066 flag_group { 1067 expand_if_equal: { 1068 variable: 'libraries_to_link.type' 1069 value: 'static_library' 1070 } 1071 flag_group { 1072 expand_if_false: 'libraries_to_link.is_whole_archive' 1073 flag: '%{libraries_to_link.name}' 1074 } 1075 flag_group { 1076 expand_if_true: 'libraries_to_link.is_whole_archive' 1077 flag: '/WHOLEARCHIVE:%{libraries_to_link.name}' 1078 } 1079 } 1080 } 1081 } 1082 } 1083 1084 # Since this feature is declared earlier in the CROSSTOOL than 1085 # "user_link_flags", this feature will be applied prior to it anwyhere they 1086 # are both implied. And since "user_link_flags" contains the linkopts from 1087 # the build rule, this allows the user to override the /SUBSYSTEM in the BUILD 1088 # file. 1089 feature { 1090 name: 'linker_subsystem_flag' 1091 flag_set { 1092 action: 'c++-link-executable' 1093 action: 'c++-link-dynamic-library' 1094 action: "c++-link-nodeps-dynamic-library" 1095 flag_group { 1096 flag: '/SUBSYSTEM:CONSOLE' 1097 } 1098 } 1099 } 1100 1101 # The "user_link_flags" contains user-defined linkopts (from build rules) 1102 # so it should be defined after features that declare user-overridable flags. 1103 # For example the "linker_subsystem_flag" defines a default "/SUBSYSTEM" flag 1104 # but we want to let the user override it, therefore "link_flag_subsystem" is 1105 # defined earlier in the CROSSTOOL file than "user_link_flags". 1106 feature { 1107 name: 'user_link_flags' 1108 flag_set { 1109 expand_if_all_available: 'user_link_flags' 1110 action: 'c++-link-executable' 1111 action: 'c++-link-dynamic-library' 1112 action: "c++-link-nodeps-dynamic-library" 1113 flag_group { 1114 iterate_over: 'user_link_flags' 1115 flag: '%{user_link_flags}' 1116 } 1117 } 1118 } 1119 feature { 1120 name: 'legacy_link_flags' 1121 flag_set { 1122 expand_if_all_available: 'legacy_link_flags' 1123 action: 'c++-link-executable' 1124 action: 'c++-link-dynamic-library' 1125 action: "c++-link-nodeps-dynamic-library" 1126 flag_group { 1127 iterate_over: 'legacy_link_flags' 1128 flag: '%{legacy_link_flags}' 1129 } 1130 } 1131 } 1132 1133 feature { 1134 name: 'linker_param_file' 1135 flag_set { 1136 expand_if_all_available: 'linker_param_file' 1137 action: 'c++-link-executable' 1138 action: 'c++-link-dynamic-library' 1139 action: "c++-link-nodeps-dynamic-library" 1140 action: 'c++-link-static-library' 1141 flag_group { 1142 flag: '@%{linker_param_file}' 1143 } 1144 } 1145 } 1146 1147 feature { 1148 name: 'static_link_msvcrt' 1149 } 1150 1151 feature { 1152 name: 'static_link_msvcrt_no_debug' 1153 flag_set { 1154 action: 'c-compile' 1155 action: 'c++-compile' 1156 flag_group { 1157 flag: "/MT" 1158 } 1159 } 1160 flag_set { 1161 action: 'c++-link-executable' 1162 action: 'c++-link-dynamic-library' 1163 action: "c++-link-nodeps-dynamic-library" 1164 flag_group { 1165 flag: "/DEFAULTLIB:libcmt.lib" 1166 } 1167 } 1168 requires: { feature: 'fastbuild'} 1169 requires: { feature: 'opt'} 1170 } 1171 1172 feature { 1173 name: 'dynamic_link_msvcrt_no_debug' 1174 flag_set { 1175 action: 'c-compile' 1176 action: 'c++-compile' 1177 flag_group { 1178 flag: "/MD" 1179 } 1180 } 1181 flag_set { 1182 action: 'c++-link-executable' 1183 action: 'c++-link-dynamic-library' 1184 action: "c++-link-nodeps-dynamic-library" 1185 flag_group { 1186 flag: "/DEFAULTLIB:msvcrt.lib" 1187 } 1188 } 1189 requires: { feature: 'fastbuild'} 1190 requires: { feature: 'opt'} 1191 } 1192 1193 feature { 1194 name: 'static_link_msvcrt_debug' 1195 flag_set { 1196 action: 'c-compile' 1197 action: 'c++-compile' 1198 flag_group { 1199 flag: "/MTd" 1200 } 1201 } 1202 flag_set { 1203 action: 'c++-link-executable' 1204 action: 'c++-link-dynamic-library' 1205 action: "c++-link-nodeps-dynamic-library" 1206 flag_group { 1207 flag: "/DEFAULTLIB:libcmtd.lib" 1208 } 1209 } 1210 requires: { feature: 'dbg'} 1211 } 1212 1213 feature { 1214 name: 'dynamic_link_msvcrt_debug' 1215 flag_set { 1216 action: 'c-compile' 1217 action: 'c++-compile' 1218 flag_group { 1219 flag: "/MDd" 1220 } 1221 } 1222 flag_set { 1223 action: 'c++-link-executable' 1224 action: 'c++-link-dynamic-library' 1225 action: "c++-link-nodeps-dynamic-library" 1226 flag_group { 1227 flag: "/DEFAULTLIB:msvcrtd.lib" 1228 } 1229 } 1230 requires: { feature: 'dbg'} 1231 } 1232 1233 feature { 1234 name: 'dbg' 1235 flag_set { 1236 action: 'c-compile' 1237 action: 'c++-compile' 1238 flag_group { 1239 flag: "/Od" 1240 flag: "/Z7" 1241 flag: "/DDEBUG" 1242 } 1243 } 1244 flag_set { 1245 action: 'c++-link-executable' 1246 action: 'c++-link-dynamic-library' 1247 action: "c++-link-nodeps-dynamic-library" 1248 flag_group { 1249 flag: "/DEBUG:FULL" 1250 flag: "/INCREMENTAL:NO" 1251 } 1252 } 1253 implies: 'generate_pdb_file' 1254 } 1255 1256 feature { 1257 name: 'fastbuild' 1258 flag_set { 1259 action: 'c-compile' 1260 action: 'c++-compile' 1261 flag_group { 1262 flag: "/Od" 1263 flag: "/Z7" 1264 flag: "/DDEBUG" 1265 } 1266 } 1267 flag_set { 1268 action: 'c++-link-executable' 1269 action: 'c++-link-dynamic-library' 1270 action: "c++-link-nodeps-dynamic-library" 1271 flag_group { 1272 flag: "/DEBUG:FASTLINK" 1273 flag: "/INCREMENTAL:NO" 1274 } 1275 } 1276 implies: 'generate_pdb_file' 1277 } 1278 1279 feature { 1280 name: 'opt' 1281 flag_set { 1282 action: 'c-compile' 1283 action: 'c++-compile' 1284 flag_group { 1285 flag: "/O2" 1286 flag: "/DNDEBUG" 1287 } 1288 } 1289 } 1290 1291 feature { 1292 name: 'user_compile_flags' 1293 flag_set { 1294 expand_if_all_available: 'user_compile_flags' 1295 action: 'preprocess-assemble' 1296 action: 'c-compile' 1297 action: 'c++-compile' 1298 action: 'c++-header-parsing' 1299 action: 'c++-module-compile' 1300 action: 'c++-module-codegen' 1301 flag_group { 1302 iterate_over: 'user_compile_flags' 1303 flag: '%{user_compile_flags}' 1304 } 1305 } 1306 } 1307 1308 feature { 1309 name: 'sysroot' 1310 flag_set { 1311 expand_if_all_available: 'sysroot' 1312 action: 'assemble' 1313 action: 'preprocess-assemble' 1314 action: 'c-compile' 1315 action: 'c++-compile' 1316 action: 'c++-header-parsing' 1317 action: 'c++-module-compile' 1318 action: 'c++-module-codegen' 1319 action: 'c++-link-executable' 1320 action: 'c++-link-dynamic-library' 1321 action: "c++-link-nodeps-dynamic-library" 1322 flag_group { 1323 iterate_over: 'sysroot' 1324 flag: '--sysroot=%{sysroot}' 1325 } 1326 } 1327 } 1328 1329 feature { 1330 name: 'unfiltered_compile_flags' 1331 flag_set { 1332 expand_if_all_available: 'unfiltered_compile_flags' 1333 action: 'preprocess-assemble' 1334 action: 'c-compile' 1335 action: 'c++-compile' 1336 action: 'c++-header-parsing' 1337 action: 'c++-module-compile' 1338 action: 'c++-module-codegen' 1339 flag_group { 1340 iterate_over: 'unfiltered_compile_flags' 1341 flag: '%{unfiltered_compile_flags}' 1342 } 1343 } 1344 } 1345 1346 feature { 1347 name: 'compiler_output_flags' 1348 flag_set { 1349 action: 'assemble' 1350 flag_group { 1351 expand_if_all_available: 'output_file' 1352 expand_if_none_available: 'output_assembly_file' 1353 expand_if_none_available: 'output_preprocess_file' 1354 flag: '/Fo%{output_file}' 1355 flag: '/Zi' 1356 } 1357 } 1358 flag_set { 1359 action: 'preprocess-assemble' 1360 action: 'c-compile' 1361 action: 'c++-compile' 1362 action: 'c++-header-parsing' 1363 action: 'c++-module-compile' 1364 action: 'c++-module-codegen' 1365 flag_group { 1366 expand_if_all_available: 'output_file' 1367 expand_if_none_available: 'output_assembly_file' 1368 expand_if_none_available: 'output_preprocess_file' 1369 flag: '/Fo%{output_file}' 1370 } 1371 flag_group { 1372 expand_if_all_available: 'output_file' 1373 expand_if_all_available: 'output_assembly_file' 1374 flag: '/Fa%{output_file}' 1375 } 1376 flag_group { 1377 expand_if_all_available: 'output_file' 1378 expand_if_all_available: 'output_preprocess_file' 1379 flag: '/P' 1380 flag: '/Fi%{output_file}' 1381 } 1382 } 1383 } 1384 1385 feature { 1386 name: 'compiler_input_flags' 1387 flag_set { 1388 action: 'assemble' 1389 action: 'preprocess-assemble' 1390 action: 'c-compile' 1391 action: 'c++-compile' 1392 action: 'c++-header-parsing' 1393 action: 'c++-module-compile' 1394 action: 'c++-module-codegen' 1395 flag_group { 1396 expand_if_all_available: 'source_file' 1397 flag: '/c' 1398 flag: '%{source_file}' 1399 } 1400 } 1401 } 1402 1403 feature { 1404 name : 'def_file', 1405 flag_set { 1406 expand_if_all_available: 'def_file_path' 1407 action: 'c++-link-executable' 1408 action: 'c++-link-dynamic-library' 1409 action: "c++-link-nodeps-dynamic-library" 1410 flag_group { 1411 flag: "/DEF:%{def_file_path}" 1412 # We can specify a different DLL name in DEF file, /ignore:4070 suppresses 1413 # the warning message about DLL name doesn't match the default one. 1414 # See https://msdn.microsoft.com/en-us/library/sfkk2fz7.aspx 1415 flag: "/ignore:4070" 1416 } 1417 } 1418 } 1419 1420 feature { 1421 name: 'windows_export_all_symbols' 1422 } 1423 1424 feature { 1425 name: 'no_windows_export_all_symbols' 1426 } 1427 1428 linking_mode_flags { mode: DYNAMIC } 1429 }