This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++: unrecognized option `-symbolic'
"Martin v. Loewis" wrote:
> > I need to keep overloaded new and delete operators local to a particular
> > shared library (I don't want to export them). How do I do this?
>
> You can use symbol versioning for that; see the linker documentation
> for details.
I tried including the following in my library:
__asm__("local:.symver __builtin_new_1,__builtin_new@");
__asm__("local:.symver __builtin_vec_new_1,__builtin_vec_new@");
__asm__("local:.symver __builtin_delete_1,__builtin_delete@");
I was trying to stay away from the versioning. I'm really only interested in
the "local:" directive. After linking and doing an nm on the library I get:
T __builtin_delete
U __builtin_delete@
T __builtin_new
U __builtin_new@
T __builtin_vec_new
U __builtin_vec_new@
This didn't fix my problem, because the new and delete symbols are still
exported. I tried specifying a version, but that resulted in a link failer
saying "__builtin_delete@VERS_1.0" is undefined when I tried to link the
library that I'm trying to keep new and delete from being exported from (the
library with the __asm__ lines in it).
Am I doing something wrong? Or can I not do what I want with this?