public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/29971]  New: anonymous namespace vs deprecated static keyword (different linkage).
@ 2006-11-24 13:43 pluto at agmk dot net
  2006-11-24 13:44 ` [Bug other/29971] " pluto at agmk dot net
  2006-11-25  1:43 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: pluto at agmk dot net @ 2006-11-24 13:43 UTC (permalink / raw)
  To: gcc-bugs

in theory the anonymous namespace is a `static' keyword superior.
in fact it breaks applications that use dlopen() with RTLD_GLOBAL.
the so called superior emits symbols with different binding.

e.g.:

static keyword:
 00000000 4 OBJECT  LOCAL  DEFAULT  4 N::a_

namespace superior:
 00000000 4 OBJECT  GLOBAL DEFAULT  4 N::(anonymous namespace)::a_


$ make CPPFLAGS=-DSUPERIOR && ./main
i486-gnu-linux-g++ -Wall -O1 -g0 -s -DSUPERIOR *.cpp -c
i486-gnu-linux-g++ -Wall -O1 -g0 -s -DSUPERIOR m1.o A.o -o libm1.so -shared
i486-gnu-linux-g++ -Wall -O1 -g0 -s -DSUPERIOR m2.o A.o -o libm2.so -shared
i486-gnu-linux-g++ -Wall -O1 -g0 -s -DSUPERIOR main.cpp -o main -ldl
i486-gnu-linux-strip --strip-unneeded *.so main
i1 = 0x55b6b4
i2 = 0x55b6b4
Aborted

$ make && ./main
i486-gnu-linux-g++ -Wall -O1 -g0 -s  *.cpp -c
i486-gnu-linux-g++ -Wall -O1 -g0 -s  m1.o A.o -o libm1.so -shared
i486-gnu-linux-g++ -Wall -O1 -g0 -s  m2.o A.o -o libm2.so -shared
i486-gnu-linux-g++ -Wall -O1 -g0 -s  main.cpp -o main -ldl
i486-gnu-linux-strip --strip-unneeded *.so main
i1 = 0x759670
i2 = 0x112670


-- 
           Summary: anonymous namespace vs deprecated static keyword
                    (different linkage).
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: elf-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29971


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug other/29971] anonymous namespace vs deprecated static keyword (different linkage).
  2006-11-24 13:43 [Bug other/29971] New: anonymous namespace vs deprecated static keyword (different linkage) pluto at agmk dot net
@ 2006-11-24 13:44 ` pluto at agmk dot net
  2006-11-25  1:43 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pluto at agmk dot net @ 2006-11-24 13:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pluto at agmk dot net  2006-11-24 13:43 -------
Created an attachment (id=12682)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12682&action=view)
testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29971


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug other/29971] anonymous namespace vs deprecated static keyword (different linkage).
  2006-11-24 13:43 [Bug other/29971] New: anonymous namespace vs deprecated static keyword (different linkage) pluto at agmk dot net
  2006-11-24 13:44 ` [Bug other/29971] " pluto at agmk dot net
@ 2006-11-25  1:43 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-25  1:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-11-25 01:43 -------
Fixed in 4.2.0 by the patch which fixed PR 21581 and PR 25915.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29971


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-25  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-24 13:43 [Bug other/29971] New: anonymous namespace vs deprecated static keyword (different linkage) pluto at agmk dot net
2006-11-24 13:44 ` [Bug other/29971] " pluto at agmk dot net
2006-11-25  1:43 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).