[libcxx-commits] [libcxx] [libc++][hardening] Rework how the assertion handler can be overridden. (PR #77883)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 12 18:17:57 PST 2024


var-const wrote:

> > Thanks for the heads up! This seems very flexible, providing a `__assertion_handler` header should allow us to do whatever we want essentially.
> > @alanzhao1 can you take a look too?
> 
> +1, thanks for the change and the heads up!
> 
> One thing we (Chrome) will need to keep in mind is that we'll need to provide our own implementation of `<__assertion_handler>` since we don't use CMake. I filed https://crbug.com/1517992 to keep track of this on our end.

Thanks for the feedback! One thing I'd like to mention is that based on @mordante's comment, we're thinking to change/simplify things a little bit:
- the custom header will still come from the same CMake variable;
- rather than copying its contents into our internal header, we will copy the custom header file itself into our include directory and include it directly. Copying simplifies things for us by making sure we know all the files (and their paths and names) in our default installation and that we don't have to worry about include search paths since the custom include is always guaranteed to be at an always-available location;
- we will remove the `__assertion_handler.in` file and instead directly include the (copy of the) custom header from `__assert`.

If using CMake, I think this change should be completely invisible. But since you mentioned you don't use CMake, I just wanted to run it by you to make sure it doesn't make things worse for your use case. Thanks!

(I hope to update the patch by end of day to implement the new mechanism outlined above)

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


More information about the libcxx-commits mailing list