https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65886
--- Comment #8 from Thiago Macieira <thiago at kde dot org> --- (In reply to H.J. Lu from comment #6) > (In reply to H.J. Lu from comment #5) > > > > BTW, you should add -fsymbolic to -fPIC if the shared library will be > > created by -Bsymbolic. It will improve shared library performance. Will do. > /export/build/gnu/gcc-5/build-x86_64-linux/gcc/xgcc > -B/export/build/gnu/gcc-5/build-x86_64-linux/gcc/ -flto -Wl,-Bsymbolic -g > -O2 -fsymbolic -shared -o libb.so b.o a.o Will the LTO be required here? Or will it work without LTO too? > Dump of assembler code for function bar: > 0x00000000000005e0 <+0>: movl $0x1e,0x2002be(%rip) # 0x2008a8 > <a> > 0x00000000000005ea <+10>: retq > End of assembler dump. I've been accomplishing the same with protected visibility, but I keep running into linker bugs, so I haven't been able to enable it by default. Looks like the option here will be the proper solution.