Bug 38643 - [4.3 only] Doesn't hide (visibility-wise) vtables and VTTs on ARM EABI
Summary: [4.3 only] Doesn't hide (visibility-wise) vtables and VTTs on ARM EABI
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2008-12-27 17:14 UTC by Martin Michlmayr
Modified: 2011-06-27 12:18 UTC (History)
3 users (show)

See Also:
Target: arm-linux-gnueabi
Known to work: 4.4.0
Known to fail: 4.3.2
Last reconfirmed: 2009-05-15 06:28:38


Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2008-12-27 17:14:29 UTC
[ 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:
class A {
  int a;
  virtual int v();

int A::v() {
  return 2;

class B : public A {
  int b;

extern "C" __attribute__((visibility("default"))) int test(void) {
  B *b = new B;
  return b->v();

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

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.
Comment 1 Martin Michlmayr 2008-12-27 17:15:55 UTC
Forgot to say that this only happens with ARM EABI, not with ARM old ABI.
Comment 2 Laurent GUERBY 2009-01-02 12:13:08 UTC
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
Comment 3 Martin Michlmayr 2009-01-03 14:13:57 UTC
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.
Comment 4 Ramana Radhakrishnan 2009-05-15 06:28:38 UTC
Doesn't work on 4.3 branch rev. 147478 .Works fine on trunk.
Comment 5 Richard Biener 2011-06-27 12:18:43 UTC
Fixed in 4.4.0.