[PATCH] D89915: [compiler-rt] Don't explicitly include the libc++ headers in MSAN

Louis Dionne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 12:46:24 PDT 2020


ldionne added a subscriber: eugenis.
ldionne added a comment.

In D89915#2346251 <https://reviews.llvm.org/D89915#2346251>, @vitalybuka wrote:

> In D89915#2346067 <https://reviews.llvm.org/D89915#2346067>, @ldionne wrote:
>
>> You're using libstdc++.
>
> I guess that was the point of -nostdinc++

No, I think the point of `-nostdinc++` was specifically to use libc++, since it was combined with `-isystem <path-to-libcxx>/include`. Note that this always has been incorrect, cause you wouldn't get the `__config_site` header of libc++, which means you could have configuration differences betwen the libc++ you're actually using and the one you think you're using. Some of these have serious impacts (e.g. on ABI). This started being noticeable with my commit because I basically made the headers in `libcxx/include` not usable as-is -- you need to go through an installation step for them to work. That's an unintended consequence of my change, however it is a good one, since it caught misuses like this.

In D89915#2346513 <https://reviews.llvm.org/D89915#2346513>, @Hahnfeld wrote:

> In D89915#2346071 <https://reviews.llvm.org/D89915#2346071>, @ldionne wrote:
>
>> @Hahnfeld Can you advise on the proper way to fix this? From `git blame`, it seems like you might know.
>
> So it's been a while, but I can try to write up what I remember about the situation: For using (and in this case testing) the sanitizers with C++ code, we need custom variants of `libc++` where the shared library is instrumented. They're compiled via `add_custom_libcxx` (see `lib/tsan/CMakeLists.txt` and `lib/msan/tests/CMakeLists.txt`). As to why this is done at different levels, I can't give a definitive answer, but maybe it's because `test/tsan/` also needs `libcxx_tsan`?

Ok, thanks for the context. However, whatever they were doing here, they were not trying to use the custom libc++ they built (or if they were, they were doing that wrong), because they were using the includes directly from `libcxx/include`, not the ones that should be installed in `add_custom_libcxx`. Using the headers installed by that target would be the correct way of solving this problem if I understand the intent correctly.

I'm not really sure where to go from there. Who owns this code? @eugenis  do you have any insights?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89915/new/

https://reviews.llvm.org/D89915



More information about the llvm-commits mailing list