<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/70172>70172</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Use multiarch layout with multilibs for libc++ headers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:driver
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
petrhosek
</td>
</tr>
</table>
<pre>
For the following `multilib.yaml` file:
```
---
MultilibVersion: 1.0
Variants:
- Dir: testdir1
Flags: [--target=thumbv7m-none-unknown-eabi]
- Dir: testdir2
Flags: [--target=thumbv7em-none-unknown-eabi]
Mappings:
- Match: --target=thumbv7em-none-unknown-eabi
Flags: [--target=thumbv7m-none-unknown-eabi]
```
We'll end up with the following include directories:
```
-internal-isystem [[SYSROOT]]/bin/../lib/clang-runtimes/testdir1/include/c++/v1"
-internal-isystem [[SYSROOT]]/bin/../lib/clang-runtimes/testdir2/include/c++/v1"
```
This is suboptimal. libc++ headers are designed to be target agnostic with the exception of `__config_site` to avoid having to distribute multiple copies of headers, one for each target or multilib.
Ideally, what we should end up with is something like this:
```
-internal-isystem [[SYSROOT]]/bin/../include/thumbv7m-none-unknown-eabi/testdir1/include/c++/v1
-internal-isystem [[SYSROOT]]/bin/../include/thumbv7m-none-unknown-eabi/testdir2/include/c++/v1
-internal-isystem [[SYSROOT]]/bin/../include/c++/v1
```
Where `[[SYSROOT]]/bin/../include/thumbv7m-none-unknown-eabi/testdir1/include/c++/v1` and `[[SYSROOT]]/bin/../include/thumbv7m-none-unknown-eabi/testdir2/include/c++/v1` should only contain `__config_site`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VVtv2zgT_TX0y0CCREV2_KCH5DMEfA9BgW23i30KKHEszoYiBXJkr__9grJzaZtNA3RbQKAvGJ65nHNGKkYaHGIj6ltR71ZqZuNDMyEH4yM-rDqvT03rA7BB2Htr_ZHcAGJdjLNlstTlJzVasS5gTxZFdSOKnShuxLq4PMvPLMvOX-4utz5jiOSdqG6gzC9B5_OzCqQcxyeoDHYUUiBjZE2hPP8N0Fo1pDAQ9W2WsQoDsqh2bOaxO2zGzHmH2ewenD-6DFVHot69zPQ1sHwfMH4f-U5NE7nhZQ93inuTMN8J-OM9fsnA-fwDhdxYC-g0zBMcic1XzJLr7awRNAXs2QfC-K-kkmMMTtmM4ikyjrCo6Pbjnx9_-_DhU6qk3gnZduSEbPNcyNZSJ2TbW-WGLMyOacQoZPvErGwv-VOUkLfL0x5KIeVPyim_n_PVSX4yFIEixLnzE9OobA6WugsAGFQaQwQVEDQuJtPAHjqEM4mgBucjU_9MAv7d48TkHfh9ctj9fe_dnob7SIzJYexBHTxpMOqQuGIPmiIH6mZGWAw5WYTeT4QxgVyqEPJ_4F1iOQCq3jyW4AM8ufhlb__XqKw9pWtHoxiOCNH42eovdJOa9yOySaVYekBgQ_-lWJ5peUPu7xHPryngDSX9eAHfwr3ub4MBk3Z-3XDXBSinf0LON-a5Lh4F6Z09Qe8dK3KveSZf6abS22qrVtiU6-21LLeVvFqZZi2xr9VWad1db9Vaboq6lEVfXlfbTirZr6iRhazKQtbFpqrL61yr_VVdrzf1vus3WPXiqsBRkc2tPYy5D8OKYpyx2RTlRq6s6tDG5cUq5bJ9RHWjAx0wpM1S71ahSRezbh6iuCosRY7PUExssfk9XnytQm_AqpOf-ey-R-PGxdXfbp7VHGxjmKfFkbIVsh2IzdzlvR_TVrSHx49sCv4v7DnNOzWQtuPSwz8BAAD__3fjhZ8">