Hide other symbols in libray_api.so only keep ray* (#26069)

This commit is contained in:
Larry 2022-07-01 11:51:40 +08:00 committed by GitHub
parent ab44133fba
commit c8a90e00ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 0 deletions

View file

@ -6,11 +6,24 @@ load("//bazel:ray.bzl", "COPTS")
cc_binary(
name = "libray_api.so",
copts = COPTS,
linkopts = select({
"@bazel_tools//src/conditions:darwin": [
"-Wl,-exported_symbols_list,$(location :symbols/ray_api_exported_symbols_mac.lds)",
],
"@bazel_tools//src/conditions:windows": [
#TODO(larry): Hide the symbols when we make it work on Windows.
],
"//conditions:default": [
"-Wl,--version-script,$(location :symbols/ray_api_exported_symbols_linux.lds)",
],
}),
linkshared = 1,
linkstatic = 1,
visibility = ["//visibility:public"],
deps = [
":ray_api",
":symbols/ray_api_exported_symbols_linux.lds",
":symbols/ray_api_exported_symbols_mac.lds",
],
)

View file

@ -0,0 +1,15 @@
# This file defines the C++ symbols that need to be exported (aka ABI, application binary interface).
# These symbols will be used by other libraries.
# Note: This file is used for linux only, and should be kept in sync with `ray_api_exported_symbols.lds`.
# Ray ABI is not finalized, the exact set of exported (C/C++) APIs is subject to change.
VERSION_1.0 {
global:
# common
*[0-9]ray[0-9]*;
TaskExecutionHandler;
GetFunctionManager;
GetRemoteFunctions;
InitRayRuntime;
local:
*;
};

View file

@ -0,0 +1,10 @@
# This file defines the C++ symbols that need to be exported (aka ABI, application binary interface).
# These symbols will be used by other libraries.
# Note: This file is used for macOS only, and should be kept in sync with `ray_api_version_script.lds`.
# Ray ABI is not finalized, the exact set of exported (C/C++) APIs is subject to change.
# common
*[0-9]ray[0-9]*;
TaskExecutionHandler;
GetFunctionManager;
GetRemoteFunctions;
InitRayRuntime;