[LLVMbugs] [Bug 11697] New: Failure to link with LTO and -fvisibility-inlines-hidden

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 3 11:51:24 PST 2012


             Bug #: 11697
           Summary: Failure to link with LTO and
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    rafael.espindola at gmail.com
    Classification: Unclassified

Given the following files:

#include <cstdio>
class A;
template<typename T> struct LoopBase {
  __attribute((noinline)) int a() { printf("foo\n"); return 0; }

#include <a.h>
template class LoopBase<A>;

#include <a.h>
int main() { LoopBase<A> x; return x.a(); }

clang with "-O4 -fvisibility-inlines-hidden" fails to link with the following
ld: lto: could not merge in
/var/folders/mb/c671t2cn7k385sks9twml1380000gn/T/b-GaJEgX.o because Linking
globals named '_ZN8LoopBaseI1AE1aEv': symbols have different visibilities! for
architecture x86_64

I'm pretty sure the C++ in question is valid; I'm not sure whether clang is
generating bad IR, or the IR linking is incorrectly rejecting the IR generated
by clang.

Rafael said he would take a look.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list