================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to