]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Compile _dl_debug_state separately (bug 33224)
authorFlorian Weimer <fweimer@redhat.com>
Mon, 28 Jul 2025 12:16:52 +0000 (14:16 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 28 Jul 2025 14:06:54 +0000 (16:06 +0200)
This ensures that the compiler will not inline it, so that
debuggers which do not use the Systemtap probes can reliably
set a breakpoint on it.

Reviewed-by: Andreas K. Huettel <dilfridge@gentoo.org>
Tested-by: Andreas K. Huettel <dilfridge@gentoo.org>
elf/Makefile
elf/dl-debug.c
elf/dl-debug_state.c [new file with mode: 0644]

index 44b9f192f22be6d03e3cffda21d21816ce92b6e1..48aa0b57e5b3fb488bd4135e799678e94b568e22 100644 (file)
@@ -57,6 +57,7 @@ dl-routines = \
   dl-close \
   dl-debug \
   dl-debug-symbols \
+  dl-debug_state \
   dl-deps \
   dl-exception \
   dl-execstack \
index 38a5b9a718fd5dd2a5538aceb3608f1840baf937..7052f4a3c171634828b9eb7a95388c107ac3cb54 100644 (file)
@@ -167,14 +167,3 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns)
 
   return &r->base;
 }
-
-
-/* This function exists solely to have a breakpoint set on it by the
-   debugger.  The debugger is supposed to find this function's address by
-   examining the r_brk member of struct r_debug, but GDB 4.15 in fact looks
-   for this particular symbol name in the PT_INTERP file.  */
-void
-_dl_debug_state (void)
-{
-}
-rtld_hidden_def (_dl_debug_state)
diff --git a/elf/dl-debug_state.c b/elf/dl-debug_state.c
new file mode 100644 (file)
index 0000000..40c134a
--- /dev/null
@@ -0,0 +1,30 @@
+/* Debugger hook called after dynamic linker updates.
+   Copyright (C) 1996-2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <ldsodefs.h>
+
+/* This function exists solely to have a breakpoint set on it by the
+   debugger.  The debugger is supposed to find this function's address by
+   examining the r_brk member of struct r_debug, but GDB 4.15 in fact looks
+   for this particular symbol name in the PT_INTERP file.  Therefore,
+   this function must not be inlined.  */
+void
+_dl_debug_state (void)
+{
+}
+rtld_hidden_def (_dl_debug_state)