I am compiling a shared ELF library with GCC using -Wl,--version-script=version.script
MYLIB_1.0 {
global:
the_only_symbol_i_want;
local:
*;
};
This does as advertised; the_only_symbol_i_want
is exported as a global symbol, but all the other symbols are local.
However I would also like to strip the local symbols. The man page for ld
says you should use -Wl,--discard-all
to do this. It's badly named - the docs say it actually discards all local symbols, not all symbols.
However this doesn't seem to actually do anything when combined with --version-script
.
If I do strip --discard-all mylib.so
then it does work, but I'd like to avoid having to run strip
.
Is there any way to make ld
do what I want? Does the version script not have a discard:
option?