[libcxx-commits] [libcxx] [libc++][test] fix redefinition of _LIBCPP_HARDENING_MODE (PR #109330)
Jannik Glückert via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 25 11:08:05 PDT 2024
Jannik2099 wrote:
> How does that work? I am not familiar with these kinds of files. Is there a mechanism to tweak the default Clang flags using files like that?
It just contains a string of arguments that get added to each clang invocation, with some rudimentary selection logic (e.g. `clang --target=x86_64...` will load x86_64....cfg). It's how we apply things like default-PIE, stack protector and whatnot.
The equivalent in gcc would be spec files, which are much more powerful in their conditional logic.
> the correct way of doing that is to set -DLIBCXX_HARDENING_MODE=<mode> when configuring the library with CMake
I'm trying to find an answer to why we didn't do that. In general the sentiment around setting default behaviour has been "don't submit it as a new cmake toggle if a config file would do the job", perhaps `-DLIBCXX_HARDENING_MODE` predates this or has been added later.
I've pinged the people that configured this back then in Gentoo, either they have a good reason that's still valid today, or we'll just switch to the cmake toggle.
https://github.com/llvm/llvm-project/pull/109330
More information about the libcxx-commits
mailing list