At least when building LibreOffice with Clang (16 trunk) with ASan and UBsan enabled against libstdc++ (with --gcc-toolchain and LD_LIBRARY_PATH to pick up a libstdc++ trunk build including this change at build and run-time), at least one of the LibreOffice tests executed during the build started to fail with

I could not reproduce the issue when building LibreOffice with gcc, but after reading the compiler-rt version of crtbegin.c I think the problem is the destruction order in compiler-rt. It calls __deregister_frame_info_bases after our lookup structure has already been destroyed.

Can you try if the patch below fixes the problem? It keeps the data structures alive at shutdown, though, which will probably make some leak detectors unhappy.

Alternatively we could simply remove the gcc_assert (ob) in line 285 of that file. As far as I can see in crt-begin nothing bad happens if we return nullptr at shutdown.

Best

Thomas


diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c
index 919abfe0664..d427318280c 100644
--- a/libgcc/unwind-dw2-fde.c
+++ b/libgcc/unwind-dw2-fde.c
@@ -49,16 +49,6 @@ typedef __UINTPTR_TYPE__ uintptr_type;

 static struct btree registered_frames;

-static void
-release_registered_frames (void) __attribute__ ((destructor (110)));
-static void
-release_registered_frames (void)
-{
- /* Release the b-tree and all frames. Frame releases that happen later are
-   * silently ignored */
-  btree_destroy (&registered_frames);
-}
-
 static void
 get_pc_range (const struct object *ob, uintptr_type *range);
 static void


Reply via email to