[libcxxabi] [llvm] [libc++abi] Avoid raw calls to assert() in libc++abi (PR #71121)

Andrew Kelley via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 13:59:30 PDT 2024


andrewrk wrote:

Hello @ldionne,

Downstream, this patch caused a problem for the Zig project, because it changes the behavior to embed the result of `__FILE__` in the binary regardless of whether `NDEBUG` is defined. This caused one of our tests to regress that ensured reproducible builds.

To resolve this, we ended up patching libcxxabi like this: https://github.com/ziglang/zig/commit/98a30acad6f28825cd93a9d478f6f2b84333bcb6

There are two issues here being addressed:

1. We want to toggle whether assertions are enabled or not. That toggle is supposed to be `NDEBUG`, but this code removed that toggle-ability.
2. Even for assertions-on builds, `__FILE__` should be stored into the data of the executable. It causes bloat, reproducibility problems, and arguably is less hardened than when the data is missing.

Perhaps there is a way to resolve this in a way that does not require a downstream patch?

Thanks for your help,
Andrew

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


More information about the llvm-commits mailing list