|
1 |
| -load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") |
| 1 | +load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "is_xplat", "runtime") |
2 | 2 | load("@fbsource//xplat/executorch/build:selects.bzl", "selects")
|
3 | 3 |
|
4 | 4 | def op_target(name, deps = [], android_deps = [], _allow_third_party_deps = False, _aten_mode_deps = []):
|
@@ -122,7 +122,17 @@ def define_op_library(name, deps, android_deps, aten_target, _allow_third_party_
|
122 | 122 | fbandroid_platform_deps = android_deps,
|
123 | 123 | # kernels often have helpers with no prototypes just disabling the warning here as the headers
|
124 | 124 | # are codegend and linked in later
|
125 |
| - compiler_flags = ["-Wno-missing-prototypes"], |
| 125 | + compiler_flags = ["-Wno-missing-prototypes"] + ( |
| 126 | + # For shared library build, we don't want to expose symbols of |
| 127 | + # kernel implementation (ex torch::executor::native::tanh_out) |
| 128 | + # to library users. They should use kernels through registry only. |
| 129 | + # With visibility=hidden, linker won't expose kernel impl symbols |
| 130 | + # so it can prune unregistered kernels. |
| 131 | + # Currently fbcode linkes all dependent libraries through shared |
| 132 | + # library, and it blocks users like unit tests to use kernel |
| 133 | + # implementation directly. So we enable this for xplat only. |
| 134 | + ["-fvisibility=hidden"] if is_xplat() else [] |
| 135 | + ), |
126 | 136 | deps = [
|
127 | 137 | "//executorch/runtime/kernel:kernel_includes" + aten_suffix,
|
128 | 138 | ] + deps,
|
|
0 commit comments