This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: problem about generating data section in g++ 4.2
- From: Brian Dessent <brian at dessent dot net>
- To: Ling-hua Tseng <uranus at it dot muds dot net>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 19 Jul 2007 05:14:35 -0700
- Subject: Re: problem about generating data section in g++ 4.2
- References: <000301c7c9f8$2640ecd0$0201a8c0@uranus>
- Reply-to: gcc at gcc dot gnu dot org
Ling-hua Tseng wrote:
> If I compile this file with g++ 4.2 by the following command:
> g++ -c test.cxx
> and then use this command to check symbol:
> nm test.o
> I cannot find the global varible `test' in symbol table:
This was an intentional change as part of the overhaul of C++ visibility
semantics in 4.2. The motivation for this aspect of the change comes
about from the realization that anonymous namespaces are implemented by
adding a randomly-generated string to the mangled name so that they're
guaranteed to be unique to their translation unit. So it would be
impossible or at least extremely cumbersome to actually refer to such a
symbol from another module, and thus giving them hidden visibility just
cuts down on useless indirection and overhead.
http://gcc.gnu.org/gcc-4.2/changes.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21581
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01511.html
http://gcc.gnu.org/ml/gcc-patches/2006-03/msg01322.html
Brian