llvm-mingw icon indicating copy to clipboard operation
llvm-mingw copied to clipboard

libc++ with debug checks

Open longnguyen2004 opened this issue 2 years ago • 3 comments

Is it possible to include both a normal version of libc++ and a version with extra debug checks in the same package, similar to how MS-STL is shipped, or would that blow up the package size too much?

longnguyen2004 avatar Dec 28 '22 06:12 longnguyen2004

There are some ABI issues with debug builds mentioned here https://github.com/llvm/llvm-project/blob/main/libcxx/docs/DesignDocs/DebugMode.rst

Biswa96 avatar Dec 28 '22 06:12 Biswa96

Is it possible to include both a normal version of libc++ and a version with extra debug checks in the same package, similar to how MS-STL is shipped, or would that blow up the package size too much?

It probably wouldn't affect the total package size much at all (the libc++ is a quite miniscule part of the whole toolchain, size wise). Right now it probably would be quite clunky to use though. (It's maybe possible that it could be autoselected based on some compiler flag if we'd switch to the newer "per-target runtime directory" layout mechanism - if the libc++ debug mode can be switched with a compiler flag and if that translates to a selection criterion among in the runtime directory selection logic. I guess it would be sanest to only use it statically linked in that form, since the ABI is defined to be unstable.)

mstorsjo avatar Dec 28 '22 22:12 mstorsjo

libc++ has switched to a different mechanism for enabling debug checks, called Hardening Modes, which will not affect the ABI. Now, it's only a question of whether there's a benefit in building libc++ with _LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG, since the probability of misusing the prebuilt components is rather small (who's going to misuse iostream?), but maybe I'm being too optimistic.

longnguyen2004 avatar Mar 07 '24 07:03 longnguyen2004