Skip to content

Conversation

saturn691
Copy link
Contributor

@saturn691 saturn691 commented Sep 1, 2025

Currently on embedded platforms, <features.h> is not being included. We need at least one of the LLVM-libc headers to be included, to have access to the define __LLVM_LIBC__. Therefore, as a temporary solution until #147956 is merged, we include a check for the LLVM-libc common header library.

Corresponding PR in LLVM-libc is here: #156330.

@saturn691 saturn691 requested a review from a team as a code owner September 1, 2025 14:08
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 1, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 1, 2025

@llvm/pr-subscribers-libcxx

Author: William Huynh (saturn691)

Changes

Currently on embedded platforms, &lt;features.h&gt; is not being included. We need at least one of the LLVM-libc headers to be included, to have access to the define __LLVM_LIBC__. Therefore, as a temporary solution until #147956 is merged, we include a check for the LLVM-libc common header library.


Full diff: https://github.com/llvm/llvm-project/pull/156331.diff

1 Files Affected:

  • (modified) libcxx/include/__configuration/platform.h (+5)
diff --git a/libcxx/include/__configuration/platform.h b/libcxx/include/__configuration/platform.h
index f3c199dee172b..cf7d9d965cf30 100644
--- a/libcxx/include/__configuration/platform.h
+++ b/libcxx/include/__configuration/platform.h
@@ -49,6 +49,11 @@
 #  include <picolibc.h>
 #endif
 
+// TODO: we should remove this once (#147956) is merged, for the same reason as listed above.
+#if __has_include(<__llvm-libc-common.h>)
+#  include <__llvm-libc-common.h>
+#endif
+
 #ifndef __BYTE_ORDER__
 #  error                                                                                                               \
       "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform"

saturn691 added a commit to saturn691/arm-toolchain that referenced this pull request Sep 1, 2025
This is required for std::cout. This patch relies on the following:
llvm/llvm-project#156330
llvm/llvm-project#156331
saturn691 added a commit to saturn691/arm-toolchain that referenced this pull request Sep 1, 2025
This is required for std::cout. This patch relies on the following:
llvm/llvm-project#156330
llvm/llvm-project#156331
@saturn691 saturn691 changed the title [libcxx] Include __llvm-libc-common.h if applicable [libc++] Include __llvm-libc-common.h if applicable Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants