This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
private (class)function symbol pruning
- From: Karl Vogel <karl dot vogel at seagha dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 18 Jul 2004 14:38:33 +0200
- Subject: private (class)function symbol pruning
I was wondering why G++ exports private class functions in shared libraries
and also how to prevent G++ from doing this, without having to add
__attribute__((visibility ("hidden"))) to every private function?!
ie.
=========== dummy.cpp
class Dummy {
int value;
int getpriv() const;
public:
int getpub() const;
};
int Dummy::getpriv() const { return value; };
int Dummy::getpub() const { return value; };
===========
Compiled with G++ V3.4.0 like:
$ g++34 -shared -o dummy.so dummy.cpp
Shows that Dummy::getpriv() is also exported:
$ objdump -CT dummy.so|grep getpriv
00000504 g DF .text 0000000a Base Dummy::getpriv() const
Using the following declaration:
int getpriv() const __attribute__((visibility ("hidden")));
prevents this from happening, but this seems like the wrong way of achieving
this :)
Any hints, tips?