================
@@ -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");
}
----------------
MaskRay wrote:
Such macro definitions should be moved to clang/lib/Basic/Targets/OSTargets.h
from clangDriver. g++ defines `_GNU_SOURCE` for C++ mode.
Defining different macros depending on `GetCStdlibType` is not a good idea...
https://github.com/llvm/llvm-project/pull/201599
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits