================
@@ -813,6 +815,13 @@ void HexagonToolChain::addClangTargetOptions(const ArgList 
&DriverArgs,
     CC1Args.push_back("-mllvm");
     CC1Args.push_back("-hexagon-autohvx");
   }
+
+  // picolibc guards GNU-extension functions (e.g. strtold_l) with 
__GNU_VISIBLE
+  // which requires _GNU_SOURCE. Define it automatically for C++ compilations
+  // so that building libcxx against picolibc works without -D_GNU_SOURCE.
+  if (GetCStdlibType(DriverArgs) == ToolChain::CST_Picolibc &&
+      getDriver().CCCIsCXX())
+    CC1Args.push_back("-D_GNU_SOURCE");
 }
----------------
quic-k wrote:

ideally yes
I was trying to define this macro for only Picolibc so we don't break anything 
for default libc but the driver cstdlib flag is not available in OSTargetInfo, 
so I added it in driver
do you think it makes sense to define this macro for Hexagon, and not depend of 
what libc we have?

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