[ Forwarded from http://bugs.debian.org/490173 ]

Mike Hommey <m...@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.


-- 
           Summary: Doesn't hide (visibility-wise) vtables and VTTs on ARM
                    EABI
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tbm at cyrius dot com
GCC target triplet: arm-linux-gnueabi


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

Reply via email to