[LLVMbugs] [Bug 22254] New: #pragma visibility (GCC generates default, Clang hidden) if class forward declaration inserted into visibility push(hidden) section

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jan 17 12:25:59 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22254

            Bug ID: 22254
           Summary: #pragma visibility (GCC generates default, Clang
                    hidden) if class forward declaration inserted into
                    visibility push(hidden) section
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.abdurachmanov at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

GCC and Clang behaves differently if class forward declaration ends up in
visibility push(hidden) pragma section.

This was causing a linking errors in our software.

Quick discussion in #gcc suggests that this should be Clang issue:

[9:01pm] pinskia: davidlt, mainly because this is a GCC pragma that clang
implements 
[9:01pm] davidlt: pinskia: I see
[9:03pm] pinskia: davidlt, and I think the reasoning is that the class B was
default first and then in the declared in the hidden section so the first one
overrides the second
[9:03pm] pinskia: davidlt, like doing:
[9:03pm] pinskia: #pragma GCC visibility push(hidden)
[9:03pm] pinskia: int v;
[9:03pm] pinskia: #pragma GCC visibility pop
[9:04pm] pinskia: int v;
[9:04pm] iains: davidlt: espindola is prob a good person to talk to about this
on #llvm (or here)

Tested with 3.7.0 (trunk, r226371).

class B {
 virtual int tangentPlane();
public:
 B();
};
class C : B {
public:
 C() : B() {}
};
#pragma GCC visibility push(hidden)
class B;
void fn1() {
 new C();
}

// GCC
//
// $ readelf --syms -W test_final.o | grep tangentPlane
//     31: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND
_ZN1B12tangentPlaneEv
//
// Clang
//
// $ readelf --syms -W test_final.o | grep tangentPlane
//     25: 0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND
_ZN1B12tangentPlaneEv

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150117/3c1c3e94/attachment.html>


More information about the llvm-bugs mailing list