Description
WebAssembly's emscripten toolchain (https://github.com/emscripten-core/emscripten) has been using _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT
not to pay for the increased code size of __libcpp_verbose_abort
so far. But after #71002, that macro does not exist. We don't provide our own vendor annotation, and defining _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT
as 0 is overridden by this line:
llvm-project/libcxx/include/__availability
Line 138 in 38f5596
I read the discussions in that PR that it is recommended to create our own availability markup like Apple:
llvm-project/libcxx/include/__availability
Line 163 in 38f5596
But to do that it looks we have to copy the whole list of macros here
llvm-project/libcxx/include/__availability
Lines 86 to 161 in 38f5596
and copy-paste them to our section in order to just change the one line (
_LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT
). Is this the recommended way of changing one setting? Is there a way we can control this elsewhere?
This doesn't necessarily have to be about _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT
, but it can be more general question about what is the recommended way of toggling one setting without copy-pasting dozens of settings to add another ifdef (__SOMEPLATFORM__)
in __availability
.
A similar concern was posted in #71002 (comment) by @wang-bin.
Activity
Disable __libcpp_verbose_abort directly in code
ldionne commentedon Apr 2, 2024
These settings are not intended to be "customizable" in the general sense. Specifically, these settings represent features that are only disabled when the deployment target is too old to support them, such as trying to use
<filesystem>
on an old OS where the required support had not landed in the shared library yet. In a case like that, it's not a matter of taste or preference: these settings basically prevent the ABI from being broken.These settings are inherently temporal: whenever we don't support any platform that requires the old behavior, we remove the setting and unconditionally use the new behavior. Hence, we don't want to start allowing for individual settings to be toggled based on preference, since that's not their goal. Many other settings are toggle-able individually and we document them at https://libcxx.llvm.org/UsingLibcxx.html#libc-configuration-macros, but something like
_LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT
doesn't fall in that category.If you want
__libcpp_verbose_abort
to be toggle-able individually for code-size reason, I believe what you actually want is something slightly different that gives you a "minimal code size" version of the library. I believe this could make sense, but we'd want to include a lot more than just removing__libcpp_verbose_abort
in such a mode. If you want us to investigate this idea, please detail your code size requirements and what kind of things are problematic in libc++ in an issue so we can think about it. This could make sense as part of freestanding support or on its own. For example, we'd definitely want to disable some of the recent vectorization optimizations in algorithms which increase performance but result in more code. That's just one example.Update libcxx and libcxxabi to LLVM 18.1.2 (#21638)
aheejin commentedon Apr 9, 2024
Thanks for the reply. We don't have a concrete requirement for now, but will post an issue later if we get to work on it.
Update libcxx and libcxxabi to LLVM 18.1.2 (emscripten-core#21638)