<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 - Link error with aligned_allocation on macOS <= 10.13, C++03"
href="https://bugs.llvm.org/show_bug.cgi?id=39435">39435</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Link error with aligned_allocation on macOS <= 10.13, C++03
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>ldionne@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>The following program produces a link error:
// t.cpp
#include <memory>
int main() { std::get_temporary_buffer<int>(10); }
When compiled like this on macOS 10.13 or older:
$ clang++ -x c++ -c t.cpp -mmacosx-version-min=10.13 -std=c++03 -nostdinc++ -I
libcxx/include -isysroot $(xcrun --sdk macosx10.13 --show-sdk-path) -o t.o
$ clang++ -o t.exe t.o -mmacosx-version-min=10.13 -L
<path-to-10.13-libc++-dylib> -Wl,-rpath,<path-to-10.13-libc++-dylib>
-nodefaultlibs -lc++ -lSystem
The result is:
Undefined symbols for architecture x86_64:
"operator new(unsigned long, std::align_val_t, std::nothrow_t const&)",
referenced from:
std::__1::pair<int*, long> std::__1::get_temporary_buffer<int>(long) in
t.o
ld: symbol(s) not found for architecture x86_64
This has been bisected to be caused by 1d97e2ba2 (in the monorepo), aka r344207
in SVN:
--------------------------------------------------------------------------------
r344207 | ericwf | 2018-10-10 20:17:24 -0400 (Wed, 10 Oct 2018) | 17 lines
Distinguish between library and language support for aligned allocation.
There are two cases:
1. The library has all it needs to provide align_val_t and the
new/delete overloads needed to support aligned allocation.
2. The compiler has actually turned the language feature on.
There are times where libc++ needs to distinguish between the two.
This patch adds the additional macro
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION which denotes when case (1)
does not hold. _LIBCPP_HAS_NO_ALIGNED_ALLOCATION is defined whenever
_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION is defined, or when the
compiler has not enabled the language feature.
Additionally this patch cleans up a number of other macros related
to detection of aligned allocation machinery.
--------------------------------------------------------------------------------</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>