328f1f
commit 0fda2a41baf7e978d07322aa278e964f4dce8802
328f1f
Author: Florian Weimer <fweimer@redhat.com>
328f1f
Date:   Thu Jul 20 18:31:48 2023 +0200
328f1f
328f1f
    debug: Mark libSegFault.so as NODELETE
328f1f
    
328f1f
    The signal handler installed in the ELF constructor cannot easily
328f1f
    be removed again (because the program may have changed handlers
328f1f
    in the meantime).  Mark the object as NODELETE so that the registered
328f1f
    handler function is never unloaded.
328f1f
    
328f1f
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
328f1f
    (cherry picked from commit 23ee92deea4c99d0e6a5f48fa7b942909b123ec5)
328f1f
328f1f
diff --git a/debug/Makefile b/debug/Makefile
328f1f
index b0f0b7beb6d5cef5..8bce89ddcd0a61ed 100644
328f1f
--- a/debug/Makefile
328f1f
+++ b/debug/Makefile
328f1f
@@ -213,6 +213,8 @@ extra-libs-others = $(extra-libs)
328f1f
 
328f1f
 libSegFault-routines = segfault
328f1f
 libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
328f1f
+# libSegFault.so installs a signal handler in its ELF constructor.
328f1f
+LDFLAGS-SegFault.so = -Wl,--enable-new-dtags,-z,nodelete
328f1f
 
328f1f
 libpcprofile-routines = pcprofile
328f1f
 libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))