aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-usage.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-10-08 15:33:00 +0200
committerFlorian Weimer <fweimer@redhat.com>2020-10-08 15:33:00 +0200
commit542923d949e8b2480e48bd85fea13cf5d00d30b7 (patch)
tree1b53929678625fd6e434b414b3680b65a845740c /elf/dl-usage.c
parentaddff78f1f6729408a88d7452b16b8f5ee7e6878 (diff)
downloadglibc-542923d949e8b2480e48bd85fea13cf5d00d30b7.zip
glibc-542923d949e8b2480e48bd85fea13cf5d00d30b7.tar.gz
glibc-542923d949e8b2480e48bd85fea13cf5d00d30b7.tar.bz2
elf: Implement ld.so --version
This prints out version information for the dynamic loader and exits immediately, without further command line processing (which seems to match what some GNU tools do). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/dl-usage.c')
-rw-r--r--elf/dl-usage.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/elf/dl-usage.c b/elf/dl-usage.c
index c1820dc..f3c5ac7 100644
--- a/elf/dl-usage.c
+++ b/elf/dl-usage.c
@@ -20,6 +20,7 @@
#include <dl-main.h>
#include <ldsodefs.h>
#include <unistd.h>
+#include "version.h"
void
_dl_usage (const char *argv0, const char *wrong_option)
@@ -33,6 +34,19 @@ _dl_usage (const char *argv0, const char *wrong_option)
}
void
+_dl_version (void)
+{
+ _dl_printf ("\
+ld.so " PKGVERSION RELEASE " release version " VERSION ".\n\
+Copyright (C) 2020 Free Software Foundation, Inc.\n\
+This is free software; see the source for copying conditions.\n\
+There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
+PARTICULAR PURPOSE.\n\
+");
+ _exit (EXIT_SUCCESS);
+}
+
+void
_dl_help (const char *argv0, struct dl_main_state *state)
{
_dl_printf ("\
@@ -61,6 +75,7 @@ of this helper program; chances are you did not intend to run this program.\n\
--preload LIST preload objects named in LIST\n\
--argv0 STRING set argv[0] to STRING before running\n\
--help display this help and exit\n\
+ --version output version information and exit\n\
",
argv0);
_exit (EXIT_SUCCESS);