Skip to content

Commit 9260a0d

Browse files
committed
Include <picolibc.h> to detect _NEWLIB_VERSION
1 parent 1d66f2d commit 9260a0d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

libcxx/include/__configuration/platform.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@
4242
# endif
4343
#endif
4444

45+
// This is required in order for _NEWLIB_VERSION to be defined in places where we use it.
46+
// TODO: We shouldn't be including arbitrarily-named headers from libc++ since this can break valid
47+
// user code. Move code paths that need _NEWLIB_VERSION to another customization mechanism.
48+
#if __has_include(<picolibc.h>)
49+
# include <picolibc.h>
50+
#endif
51+
4552
#ifndef __BYTE_ORDER__
4653
# error \
4754
"Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform"

libcxx/test/configs/armv7m-picolibc-libc++.cfg.in

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ config.substitutions.append(('%{compile_flags}',
1111
# "large atomic operation may incur significant performance penalty; the
1212
# access size (4 bytes) exceeds the max lock-free size (0 bytes)"
1313
' -Wno-atomic-alignment'
14-
15-
# Various libc++ headers check for the definition of _NEWLIB_VERSION
16-
# which for picolibc is defined in picolibc.h.
17-
' -include picolibc.h'
1814
))
1915
config.substitutions.append(('%{link_flags}',
2016
'-nostdlib -nostdlib++ -L %{lib-dir} -lc++ -lc++abi'

0 commit comments

Comments
 (0)