summary refs log tree commit diff
path: root/elf/dl-misc.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-05-25 18:17:27 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-05-25 18:17:27 +0200
commitde42613540de8d3d70b5f14a14923cab7bd694d0 (patch)
treea40b9d1870dc99f5c989e903bc71a06ccaa7b3f4 /elf/dl-misc.c
parent76d5b2f002a1243ddba06bd646249553353f4322 (diff)
downloadglibc-de42613540de8d3d70b5f14a14923cab7bd694d0.tar.gz
glibc-de42613540de8d3d70b5f14a14923cab7bd694d0.tar.xz
glibc-de42613540de8d3d70b5f14a14923cab7bd694d0.zip
elf: Turn _dl_printf, _dl_error_printf, _dl_fatal_printf into functions
This change makes it easier to set a breakpoint on these calls.

This also addresses the issue that including <ldsodefs.h> without
<unistd.h> does not result usable _dl_*printf macros because of the
use of the STD*_FILENO macros there.

(The private symbol for _dl_fatal_printf will go away again
once the exception handling implementation is unified between
libc and ld.so.)

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/dl-misc.c')
-rw-r--r--elf/dl-misc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/elf/dl-misc.c b/elf/dl-misc.c
index e6cf247b46..ab70481fda 100644
--- a/elf/dl-misc.c
+++ b/elf/dl-misc.c
@@ -275,6 +275,37 @@ _dl_dprintf (int fd, const char *fmt, ...)
   va_end (arg);
 }
 
+void
+_dl_printf (const char *fmt, ...)
+{
+  va_list arg;
+
+  va_start (arg, fmt);
+  _dl_debug_vdprintf (STDOUT_FILENO, 0, fmt, arg);
+  va_end (arg);
+}
+
+void
+_dl_error_printf (const char *fmt, ...)
+{
+  va_list arg;
+
+  va_start (arg, fmt);
+  _dl_debug_vdprintf (STDERR_FILENO, 0, fmt, arg);
+  va_end (arg);
+}
+
+void
+_dl_fatal_printf (const char *fmt, ...)
+{
+  va_list arg;
+
+  va_start (arg, fmt);
+  _dl_debug_vdprintf (STDERR_FILENO, 0, fmt, arg);
+  va_end (arg);
+  _exit (127);
+}
+rtld_hidden_def (_dl_fatal_printf)
 
 /* Test whether given NAME matches any of the names of the given object.  */
 int