diff --git a/tensorflow/tf_exported_symbols.lds b/tensorflow/tf_exported_symbols.lds index 8bbd4199f82..fce70c12c51 100644 --- a/tensorflow/tf_exported_symbols.lds +++ b/tensorflow/tf_exported_symbols.lds @@ -8,3 +8,12 @@ *nsync_* *stream_executor* *xla* +# Though it may seem unsafe to export grpc, any .so files that rely on gRPC +# MUST do it through tensorflow's version, because gRPC uses link-time +# object registration, and if they hard link their own gRPC dependencies +# then at load time you get a segfault due to registration collissions. +# As a result, any dynamic libraries relying on gRPC must build with gRPC +# deps in header-only mode, and rely on tensorflow's symbol exports at +# link-time. +*grpc* + diff --git a/tensorflow/tf_version_script.lds b/tensorflow/tf_version_script.lds index a96ef055eea..9f636edebd9 100644 --- a/tensorflow/tf_version_script.lds +++ b/tensorflow/tf_version_script.lds @@ -9,6 +9,14 @@ tensorflow { *nsync_*; *stream_executor*; *xla*; + # Though it may seem unsafe to export grpc, any .so files that rely on gRPC + # MUST do it through tensorflow's version, because gRPC uses link-time + # object registration, and if they hard link their own gRPC dependencies + # then at load time you get a segfault due to registration collissions. + # As a result, any dynamic libraries relying on gRPC must build with gRPC + # deps in header-only mode, and rely on tensorflow's symbol exports at + # link-time. + *grpc*; local: *; }; diff --git a/tensorflow/tools/def_file_filter/def_file_filter.py.tpl b/tensorflow/tools/def_file_filter/def_file_filter.py.tpl index f894c000ddc..62b9ea3f7ef 100644 --- a/tensorflow/tools/def_file_filter/def_file_filter.py.tpl +++ b/tensorflow/tools/def_file_filter/def_file_filter.py.tpl @@ -71,7 +71,8 @@ INCLUDE_RE = re.compile(r"^(TF_\w*)$|" r"tensorflow::|" r"toco::|" r"functor::|" - r"perftools::gputools") + r"perftools::gputools|" + r"grpc::") # We want to identify data members explicitly in the DEF file, so that no one # can implicitly link against the DLL if they use one of the variables exported