version.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* Copyright (C) 1992-2019 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #include "version.h"
  15. #include <tls.h>
  16. #include <libc-abis.h>
  17. #include <gnu/libc-version.h>
  18. static const char __libc_release[] = RELEASE;
  19. static const char __libc_version[] = VERSION;
  20. static const char banner[] =
  21. "GNU C Library "PKGVERSION RELEASE" release version "VERSION".\n\
  22. Copyright (C) 2019 Free Software Foundation, Inc.\n\
  23. This is free software; see the source for copying conditions.\n\
  24. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
  25. PARTICULAR PURPOSE.\n\
  26. Compiled by GNU CC version "__VERSION__".\n"
  27. #ifdef LIBC_ABIS_STRING
  28. LIBC_ABIS_STRING
  29. #endif
  30. "For bug reporting instructions, please see:\n\
  31. "REPORT_BUGS_TO".\n";
  32. #include <unistd.h>
  33. extern void __libc_print_version (void) attribute_hidden;
  34. void
  35. __libc_print_version (void)
  36. {
  37. __write (STDOUT_FILENO, banner, sizeof banner - 1);
  38. }
  39. extern const char *__gnu_get_libc_release (void);
  40. const char *
  41. __gnu_get_libc_release (void)
  42. {
  43. return __libc_release;
  44. }
  45. weak_alias (__gnu_get_libc_release, gnu_get_libc_release)
  46. extern const char *__gnu_get_libc_version (void);
  47. const char *
  48. __gnu_get_libc_version (void)
  49. {
  50. return __libc_version;
  51. }
  52. weak_alias (__gnu_get_libc_version, gnu_get_libc_version)
  53. /* This function is the entry point for the shared object.
  54. Running the library as a program will get here. */
  55. extern void __libc_main (void) __attribute__ ((noreturn));
  56. void
  57. __libc_main (void)
  58. {
  59. __libc_print_version ();
  60. _exit (0);
  61. }