ld script fails to hide symbols

Ronghua Zhang ronghuazhang@gmail.com
Fri Feb 15 19:33:00 GMT 2019


I have a .so library that uses boost and google protobuf. I don't want
symbols from boost and goole protobuf library to be exposed, so I used the
following ldscript:

{
    global:
        extern "C++" {
            mynamespace::*;
        };
    local: *;
};

>From the output of nm, almost all symbols from boost and google protobuf
disappeared, but a few symbols are left:

nm -D -C <mylib.so>

0000000000000108 b
boost::asio::detail::keyword_tss_ptr<boost::asio::detail::call_stack<boost::asio::detail::task_io_service,
boost::asio::detail::task_io_service_thread_info>::context>::value_
0000000000000000 d google::protobuf::internal::ArenaImpl::thread_cache_
00000000000000d8 b grpc_core::ExecCtx::exec_ctx_

I also noticed that although most are marked  T as expected, a few
functions in the library as marked weak symbols (W). Why is that?

00000000002b5ae0 W mynamespace::ServiceImpl::data_collection() const

The function is impleme



More information about the Binutils mailing list