diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/BUILD | 2 | ||||
-rw-r--r-- | tools/cpp/CROSSTOOL.tpl | 39 | ||||
-rw-r--r-- | tools/def_parser/BUILD | 18 | ||||
-rw-r--r-- | tools/def_parser/BUILD.tools | 13 | ||||
-rw-r--r-- | tools/def_parser/no_op.bat | 17 |
5 files changed, 85 insertions, 4 deletions
diff --git a/tools/BUILD b/tools/BUILD index 3270fcba77..a6d6ac37ee 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -19,6 +19,7 @@ filegroup( "//tools/coverage:srcs", "//tools/jdk:srcs", "//tools/launcher:srcs", + "//tools/def_parser:srcs", "//tools/platforms:srcs", "//tools/genrule:srcs", "//tools/cpp:srcs", @@ -50,6 +51,7 @@ filegroup( "//tools/jdk:package-srcs", "//tools/jdk:srcs", "//tools/launcher:srcs", + "//tools/def_parser:srcs", "//tools/platforms:srcs", "//tools/objc:srcs", "//tools/python:srcs", diff --git a/tools/cpp/CROSSTOOL.tpl b/tools/cpp/CROSSTOOL.tpl index 08a3d8004e..2b220f76f2 100644 --- a/tools/cpp/CROSSTOOL.tpl +++ b/tools/cpp/CROSSTOOL.tpl @@ -166,7 +166,7 @@ toolchain { } supports_gold_linker: false supports_start_end_lib: false - supports_interface_shared_objects: false + supports_interface_shared_objects: true supports_incremental_linker: false supports_normalizing_ar: true needsPic: false @@ -238,11 +238,21 @@ toolchain { } } + feature { + name: 'has_configured_linker_path' + } + # This feature indicates strip is not supported, building stripped binary will just result a copy of orignial binary feature { name: 'no_stripping' } + # This feature indicates this is a toolchain targeting Windows. + feature { + name: 'targets_windows' + enabled: true + } + action_config { config_name: 'c-compile' action_name: 'c-compile' @@ -358,6 +368,7 @@ toolchain { implies: 'msvc_env' implies: 'use_linker' implies: 'no_stripping' + implies: 'has_configured_linker_path' } action_config { @@ -618,12 +629,11 @@ toolchain { feature { name: 'input_param_flags' flag_set { - expand_if_all_available: 'library_search_directories' + expand_if_all_available: 'interface_library_output_path' action: 'c++-link-executable' action: 'c++-link-dynamic-library' flag_group { - iterate_over: 'library_search_directories' - flag: "-L%{library_search_directories}" + flag: "/IMPLIB:%{interface_library_output_path}" } } flag_set { @@ -933,6 +943,27 @@ toolchain { } } + feature { + name: 'windows_export_all_symbols' + flag_set { + expand_if_all_available: 'def_file_path' + action: 'c++-link-executable' + action: 'c++-link-dynamic-library' + flag_group { + flag: "/DEF:%{def_file_path}" + # We can specify a different DLL name in DEF file, /ignore:4070 suppresses + # the warning message about DLL name doesn't match the default one. + # See https://msdn.microsoft.com/en-us/library/sfkk2fz7.aspx + flag: "/ignore:4070" + } + } + } + + feature { + name: 'no_windows_export_all_symbols' + } + + linking_mode_flags { mode: DYNAMIC } %{compilation_mode_content} diff --git a/tools/def_parser/BUILD b/tools/def_parser/BUILD new file mode 100644 index 0000000000..7070bebf00 --- /dev/null +++ b/tools/def_parser/BUILD @@ -0,0 +1,18 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "srcs", + srcs = glob(["**"]), +) + +# cc_toolchain now implicitly depends on @bazel_tools//tools/def_parser:def_parser +# We need to make sure @bazel_tools//tools/def_parser:def_parser is not +# a cc_binary, because otherwise, we'll introduce a cycle in dependency graph: +# .-> @bazel_tools//tools/def_parser:def_parser (cc_binary) +# | cc_toolchain +# `-- @bazel_tools//tools/def_parser:def_parser (cc_binary) + +filegroup( + name = "def_parser", + srcs = ["no_op.bat"], +) diff --git a/tools/def_parser/BUILD.tools b/tools/def_parser/BUILD.tools new file mode 100644 index 0000000000..bd1b891fa8 --- /dev/null +++ b/tools/def_parser/BUILD.tools @@ -0,0 +1,13 @@ +package(default_visibility = ["//visibility:public"]) + +filegroup( + name = "def_parser", + srcs = select({ + "//src:host_windows": ["def_parser.exe"], + "//src:host_windows_msvc": ["def_parser.exe"], + "//src:host_windows_msys": ["def_parser.exe"], + "//conditions:default": [ + "no_op.bat", + ], + }), +) diff --git a/tools/def_parser/no_op.bat b/tools/def_parser/no_op.bat new file mode 100644 index 0000000000..b422585831 --- /dev/null +++ b/tools/def_parser/no_op.bat @@ -0,0 +1,17 @@ +:: Copyright 2016 The Bazel Authors. All rights reserved. +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + +:: Invoke the python script under pydir with the same basename +@echo OFF +echo IGNORING: %0 %* |