<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - libcxx tests fail when built with gcc (symbol visibility problem) std::__1::__vector_base_common<true>::__throw_length_error() const'"
href="https://bugs.llvm.org/show_bug.cgi?id=43140">43140</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>libcxx tests fail when built with gcc (symbol visibility problem) std::__1::__vector_base_common<true>::__throw_length_error() const'
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>peter.smith@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>One of our libcxx buildbots
<a href="http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/builds/1102">http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/builds/1102</a>
is failing.
As a side effect of moving some buildbots around, this builder ended up
building libcxx, libcxxabi and libunwind with GCC 7.4.0. With this
configuration 437 tests fail due to link errors of the form:
more undefined references to
`std::__1::__vector_base_common<true>::__throw_length_error() const' follow
This is reproducible on x86_64 with or without -fno-exceptions and it looks
like it is related to symbol visibility differences.
The bits of code where the problem are:
File vector:
template <bool>
class __vector_base_common
{
protected:
_LIBCPP_INLINE_VISIBILITY __vector_base_common() {}
_LIBCPP_NORETURN void __throw_length_error() const;
_LIBCPP_NORETURN void __throw_out_of_range() const;
};
template <bool __b>
void
__vector_base_common<__b>::__throw_length_error() const
{
_VSTD::__throw_length_error("vector");
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
__vector_base_common<true>)
File stdexcept
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_length_error(const char*__msg)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw length_error(__msg);
#else
((void)__msg);
_VSTD::abort();
#endif
}
When compiled with clang:
00000000 w F
.text._ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv 00000018
std::__1::__vector_base_common<true>::__throw_length_error() const
00000000 w F .text._ZNSt3__120__throw_length_errorEPKc 00000010
.hidden std::__1::__throw_length_error(char const*)
When compiled with gcc:
00000000 w F
.text._ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv 00000018
.hidden std::__1::__vector_base_common<true>::__throw_length_error() const
Note that std::__1::__vector_base_common<true>::__throw_length_error() const
has hidden visibility when compiled with GCC. This is the root cause of the
link errors.
This looks to be caused by the expansion of the macros in:
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
__vector_base_common<true>)
With GCC this expands to:
extern template class __vector_base_common<true>;
With clang this expands to:
extern template class __attribute__ ((__visibility__("default"))) __vector_bas\
e_common<true>;
With the compilation options -fvisibility=hidden and
-fvisibility-inlines-hidden the end result is hidden visibilty when compiled
with GCC.
Depending on whether libc++ supports gcc, this is probably a bug.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>