[llvm-bugs] [Bug 30391] New: GCC produces ABI-incompatible libc++ dylibs

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 14 17:01:14 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30391

            Bug ID: 30391
           Summary: GCC produces ABI-incompatible libc++ dylibs
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at efcs.ca
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

GCC handles _LIBCPP_INLINE_VISIBILITY differently than Clang. In particular
when the attributes are applied to symbols which are externally instantiated.

For example in the reproducer below Clang will emit both 'foo' and 'bar' with
default visibility while GCC only emits a non-hidden 'foo'.  

// RUN: g++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out
// RUN: clang++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out
template <class T>
struct Foo {
  void foo();
  void bar();
};

template <class T>
void Foo<T>::foo() {}

template <class T>
inline __attribute__((visibility("hidden"), always_inline))
void Foo<T>::bar() {}

template struct Foo<int>;


One way to fix this would be to add _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
which is defined as __attribute__((visibility("default"), always_inline)).

-- 
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/20160915/2eadfa96/attachment.html>


More information about the llvm-bugs mailing list