git: 000856156745 - main - compiler-rt: enable use of .preinit_array after ef758b59a44e

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 10 Oct 2026 22:44:54 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=000856156745f1a9a05705f8a499c0fd84f183ca

commit 000856156745f1a9a05705f8a499c0fd84f183ca
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2026-10-10 21:41:52 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2026-10-10 22:44:17 +0000

    compiler-rt: enable use of .preinit_array after ef758b59a44e
    
    After base ef758b59a44e6b5b2d2dc178b97c01cde1b34570 we can enable usage
    of .preinit_array in compiler-rt's sanitizers. The comment that stated
    "On FreeBSD, .preinit_array functions are called with rtld_bind_lock
    writer lock held. It will lead to dead lock ..." can also be removed.
    
    PR:             298943
    MFC after:      1 week
---
 .../compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h     | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index fff60c96f632..545f6f518b32 100644
--- a/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -102,13 +102,10 @@
 // We can use .preinit_array section on Linux to call sanitizer initialization
 // functions very early in the process startup (unless PIC macro is defined).
 //
-// On FreeBSD, .preinit_array functions are called with rtld_bind_lock writer
-// lock held. It will lead to dead lock if unresolved PLT functions (which helds
-// rtld_bind_lock reader lock) are called inside .preinit_array functions.
-//
 // FIXME: do we have anything like this on Mac?
 #ifndef SANITIZER_CAN_USE_PREINIT_ARRAY
-#if (SANITIZER_LINUX || SANITIZER_FUCHSIA || SANITIZER_NETBSD) && !defined(PIC)
+#if (SANITIZER_LINUX || SANITIZER_FUCHSIA || SANITIZER_NETBSD || \
+    SANITIZER_FREEBSD) && !defined(PIC)
 #define SANITIZER_CAN_USE_PREINIT_ARRAY 1
 // Before Solaris 11.4, .preinit_array is fully supported only with GNU ld.
 // FIXME: Check for those conditions.