[clang] [Clang][Hexagon] Define _GNU_SOURCE when using picolibc in C++ mode (PR #201599)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 10 10:46:44 PDT 2026
================
@@ -116,6 +116,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
+
+ if (Opts.CPlusPlus)
+ Builder.defineMacro("_GNU_SOURCE");
----------------
quic-k wrote:
> Are you sure about that? Building libc++ for a baremetal target will not be easy, it has dependencies that are usually satisfied w/pthreads. Maybe you mean QuRT or H2?
yes, we can build libc++ without threads but iostream doesn't work
> The reason I describe it as an OS property and not an architectural one is that it's not related to the ISA in any way, right? Whereas everything else in this file is related to the ISA.
> And all the other architectures make OS based decisions on enabling their definitions of _GNU_SOURCE so why should the Hexagon architecture be any different in this regard? Nothing about the ISA specification would drive us to define this here. So let's just define it for all of the OSs ported to Hexagon that expect it to be defined. If that includes baremetal -- so be it.
yeah makes sense, I will push a fix
https://github.com/llvm/llvm-project/pull/201599
More information about the cfe-commits
mailing list