about summary refs log tree commit diff
path: root/sysdeps/generic
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 /sysdeps/generic
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 'sysdeps/generic')
-rw-r--r--sysdeps/generic/ldsodefs.h19
1 files changed, 7 insertions, 12 deletions
diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
index 5ff4a2831b..d08b97a5ef 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -751,24 +751,19 @@ _dl_dprintf (int fd, const char *fmt, ...)
 
 /* Write a message on the specified descriptor standard output.  The
    parameters are interpreted as for a `printf' call.  */
-#define _dl_printf(fmt, args...) \
-  _dl_dprintf (STDOUT_FILENO, fmt, ##args)
+void _dl_printf (const char *fmt, ...)
+  attribute_hidden __attribute__ ((__format__ (__printf__, 1, 2)));
 
 /* Write a message on the specified descriptor standard error.  The
    parameters are interpreted as for a `printf' call.  */
-#define _dl_error_printf(fmt, args...) \
-  _dl_dprintf (STDERR_FILENO, fmt, ##args)
+void _dl_error_printf (const char *fmt, ...)
+  attribute_hidden __attribute__ ((__format__ (__printf__, 1, 2)));
 
 /* Write a message on the specified descriptor standard error and exit
    the program.  The parameters are interpreted as for a `printf' call.  */
-#define _dl_fatal_printf(fmt, args...) \
-  do									      \
-    {									      \
-      _dl_dprintf (STDERR_FILENO, fmt, ##args);				      \
-      _exit (127);							      \
-    }									      \
-  while (1)
-
+void _dl_fatal_printf (const char *fmt, ...)
+  __attribute__ ((__format__ (__printf__, 1, 2), __noreturn__));
+rtld_hidden_proto (_dl_fatal_printf)
 
 /* An exception raised by the _dl_signal_error function family and
    caught by _dl_catch_error function family.  Exceptions themselves