[clang] Add option -fstdlib-hardening= (PR #78763)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 29 08:30:39 PST 2024


ldionne wrote:

> I am on the fence whether a driver option is really needed. It is a very shallow layer of extra abstraction that a curious reader has to look through. I guess I'll not object to this, if people really want to add it.

Setting macros that are reserved names is really unappealing for people. We want to provide a well integrated experience for library hardening and that includes providing a friendly option at the compiler level. Other sanity checking in the driver like erroring out when libc++ isn't in use is also good, since it calls out user mistakes early and clearly (otherwise the user might think they are getting hardening when they are not). Finally, in the future this flag could potentially include more than just the macro. For example, it could potentially include a few additional warnings.

Overall, my opinion is that this flag is required to properly "productize" library hardening and give it a user-friendly "frontend".

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


More information about the cfe-commits mailing list