From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 584 invoked by alias); 24 Nov 2006 13:43:43 -0000 Received: (qmail 547 invoked by uid 48); 24 Nov 2006 13:43:32 -0000 Date: Fri, 24 Nov 2006 13:43:00 -0000 Subject: [Bug other/29971] New: anonymous namespace vs deprecated static keyword (different linkage). X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pluto at agmk dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-11/txt/msg02107.txt.bz2 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