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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to