[ Forwarded from http://bugs.debian.org/490173 ] Mike Hommey <mh@glandium.org> reported the following bug to Debian: GCC doesn't hide (visibility-wise) vtables and VTTs on ARM (EABI). The problem can be seen on the following code: -----8<--------- class A { public: int a; virtual int v(); }; int A::v() { return 2; } class B : public A { public: int b; }; extern "C" __attribute__((visibility("default"))) int test(void) { B *b = new B; return b->v(); } -------->8------- Build with: g++ -fvisibility=hidden -o test.o -c test.cpp Take a look at symbols with objdump -x test.o Relevant part: 00000000 g O .rodata 0000000c _ZTV1A 00000000 w O .rodata._ZTV1B 0000000c _ZTV1B These should be marked .hidden. Resulting shared library (g++ -shared -fvisibility=hidden -o test.so test.cpp) exports both _ZTV1A and _ZTV1B symbols as a result of this, which is unexpected. Proper result is obtained on other architectures (x86 below): 00000000 w O .rodata._ZTV1A 0000000c .hidden _ZTV1A 00000000 w O .rodata._ZTV1B 0000000c .hidden _ZTV1B Note this may be related to the fact that apparently, ARM doesn't have vtables in .rodata. This happens with gcc 4.2, 4.3 and trunk.
Forgot to say that this only happens with ARM EABI, not with ARM old ABI.
Confirmed on 4.3.2-1 Debian gnueabi But it looks like it's fixed on trunk rev 142808 00000000 g O .rodata 0000000c .hidden _ZTV1A 00000000 w O .rodata._ZTV1B 0000000c .hidden _ZTV1B
You're right that it works with trunk. I was wrong when I said it still shows up with trunk. However, it's not fixed with 4.3 from SVN, so this bug should be left open.
Doesn't work on 4.3 branch rev. 147478 .Works fine on trunk.
Fixed in 4.4.0.