diff --git a/templates/cxx/cxx.gni b/templates/cxx/cxx.gni index 44459125a7cac3a8294cace38872242c7e8637c1..34cfddf7c20a3d827d1727e25f7c9925455db5a4 100755 --- a/templates/cxx/cxx.gni +++ b/templates/cxx/cxx.gni @@ -762,7 +762,10 @@ template("ohos_shared_library") { # Hide symbols for all sa libraries if not specified by version_script if (defined(invoker.shlib_type) && invoker.shlib_type == "sa") { if (!defined(invoker.version_script)) { - configs += [ "//build/config/gcc:symbol_visibility_hidden" ] + _version_script = + rebase_path("//build/templates/cxx/singleton.versionscript") + inputs += [ _version_script ] + ldflags += [ "-Wl,--version-script=${_version_script}" ] } } diff --git a/templates/cxx/singleton.versionscript b/templates/cxx/singleton.versionscript new file mode 100755 index 0000000000000000000000000000000000000000..476de02defe537ad51f4f9e192a2c332f10ac965 --- /dev/null +++ b/templates/cxx/singleton.versionscript @@ -0,0 +1,25 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# 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. + +1.0 { + global: + _init; + _fini; + + *delegator_E; + *instance_E; + *mutex_E; + + local: + *; +};