[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 07:09:08 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:

I think this is a compiler property, clang should probably be declaring this macro for C++ mode, but we cannot decide for clang, we can decide for Hexagon

we do need this macro for baremetal as well, the libcxx built for baremetal will also need this macro, I don't think this is an OS property

https://github.com/llvm/llvm-project/pull/201599


More information about the cfe-commits mailing list