[all-commits] [llvm/llvm-project] 14c4de: [compiler-rt] Use -nostdinc++ in clang_rt.profile ...

Louis Dionne via All-commits all-commits at lists.llvm.org
Tue Jul 21 06:15:02 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 14c4de13e920c497c5275f81f74c453da2b3c957
      https://github.com/llvm/llvm-project/commit/14c4de13e920c497c5275f81f74c453da2b3c957
  Author: Louis Dionne <ldionne at apple.com>
  Date:   2020-07-21 (Tue, 21 Jul 2020)

  Changed paths:
    M compiler-rt/cmake/config-ix.cmake
    M compiler-rt/lib/profile/CMakeLists.txt

  Log Message:
  -----------
  [compiler-rt] Use -nostdinc++ in clang_rt.profile to avoid including C++ headers

Most of the code in compiler_rt is C code. However, clang_rt.profile
contains the InstrProfilingRuntime.cpp file, which builds as C++. This
means that including e.g. <stdint.h> will actually include libc++'s
<stdint.h> and then #include_next the system's <stdint.h>. However, if
the target we're building compiler-rt for isn't supported by libc++,
this will lead to a failure since libc++'s <stdint.h> includes <__config>,
which performs various checks.

Since the goal seems to *not* be including any header from the C++ Standard
Library in clang_rt.profile, using -nostdinc++ to ensure that doesn't
happen unknowingly seems to make sense.

rdar://65852694

Differential Revision: https://reviews.llvm.org/D84205




More information about the All-commits mailing list