This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH: roland/dl_fatal] nix local dl_local function
- From: Roland McGrath <roland at hack dot frob dot com>
- To: libc-alpha at sourceware dot org
- Date: Fri, 11 May 2012 13:48:17 -0700 (PDT)
- Subject: [PATCH: roland/dl_fatal] nix local dl_local function
[This change is on the branch roland/dl_fatal. I again encourage
everybody sending a patch for review always to push a private git
branch in addition to posting the patch. It's by far the simplest
way for someone else to test your code. I think the shorthand I
used in the subject of this message is a good way to succinctly say
what you've done without spending extra verbiage in the message.]
This -Wformat warning has been bugging me for a while, and I finally
decided to do something about it. When I did, I noticed that we have
a) generic code referring to a private function defined in an OS-specific
file and b) a private function doing almost exactly what an existing
general-purpose function does.
The only material difference is that _dl_fatal_printf exits with 127
rather than 1, which IMHO seems like an improvement for this case.
No regressions on x86_64-linux-gnu.
Thanks,
Roland
2012-05-11 Roland McGrath <roland@hack.frob.com>
* sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Function removed.
* elf/rtld.c (dl_main) [DL_SYSDEP_OSCHECK]:
Use _dl_fatal_printf instead.
diff --git a/elf/rtld.c b/elf/rtld.c
index 88a340d..a5b0ab9 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1432,7 +1432,7 @@ of this helper program; chances are you did not intend to run this program.\n\
#endif
#ifdef DL_SYSDEP_OSCHECK
- DL_SYSDEP_OSCHECK (dl_fatal);
+ DL_SYSDEP_OSCHECK (_dl_fatal_printf);
#endif
/* Initialize the data structures for the search paths for shared
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
index d0f41a7..82d6e22 100644
--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
+++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
@@ -1,5 +1,5 @@
/* Operating system specific code for generic dynamic loader functions. Linux.
- Copyright (C) 2000-2002,2004-2009,2011 Free Software Foundation, Inc.
+ Copyright (C) 2000-2012 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
@@ -27,18 +27,6 @@
# define MIN(a,b) (((a)<(b))?(a):(b))
#endif
-#ifdef SHARED
-/* This is the function used in the dynamic linker to print the fatal error
- message. */
-static void
-__attribute__ ((__noreturn__))
-dl_fatal (const char *str)
-{
- _dl_dprintf (2, str);
- _exit (1);
-}
-#endif
-
#define DL_SYSDEP_OSCHECK(FATAL) \
do { \
/* Test whether the kernel is new enough. This test is only performed \