0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. From dfda505870f94a7ac8063eb47f622ddc65665ff1 Mon Sep 17 00:00:00 2001
  2. From: James Hilliard <james.hilliard1@gmail.com>
  3. Date: Tue, 14 Jun 2022 19:42:43 -0600
  4. Subject: [PATCH] Revert "Linux: Implement a useful version of _startup_fatal"
  5. Fixes:
  6. csu/libc-tls.c:202: undefined reference to `_startup_fatal_not_constant'
  7. This reverts commit 2d05ba7f8ef979947e910a37ae8115a816eb4d08.
  8. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
  9. ---
  10. sysdeps/unix/sysv/linux/i386/startup.h | 23 ++++++++++++---
  11. sysdeps/unix/sysv/linux/ia64/startup.h | 22 ---------------
  12. sysdeps/unix/sysv/linux/startup.h | 39 --------------------------
  13. 3 files changed, 19 insertions(+), 65 deletions(-)
  14. delete mode 100644 sysdeps/unix/sysv/linux/ia64/startup.h
  15. delete mode 100644 sysdeps/unix/sysv/linux/startup.h
  16. diff --git a/sysdeps/unix/sysv/linux/i386/startup.h b/sysdeps/unix/sysv/linux/i386/startup.h
  17. index 213805d7d2..67c9310f3a 100644
  18. --- a/sysdeps/unix/sysv/linux/i386/startup.h
  19. +++ b/sysdeps/unix/sysv/linux/i386/startup.h
  20. @@ -1,5 +1,5 @@
  21. /* Linux/i386 definitions of functions used by static libc main startup.
  22. - Copyright (C) 2022 Free Software Foundation, Inc.
  23. + Copyright (C) 2017-2022 Free Software Foundation, Inc.
  24. This file is part of the GNU C Library.
  25. The GNU C Library is free software; you can redistribute it and/or
  26. @@ -16,7 +16,22 @@
  27. License along with the GNU C Library; if not, see
  28. <https://www.gnu.org/licenses/>. */
  29. -/* Can't use "call *%gs:SYSINFO_OFFSET" during startup. */
  30. -#define I386_USE_SYSENTER 0
  31. +#if BUILD_PIE_DEFAULT
  32. +/* Can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE. */
  33. +# define I386_USE_SYSENTER 0
  34. -#include_next <startup.h>
  35. +# include <sysdep.h>
  36. +# include <abort-instr.h>
  37. +
  38. +__attribute__ ((__noreturn__))
  39. +static inline void
  40. +_startup_fatal (const char *message __attribute__ ((unused)))
  41. +{
  42. + /* This is only called very early during startup in static PIE.
  43. + FIXME: How can it be improved? */
  44. + ABORT_INSTRUCTION;
  45. + __builtin_unreachable ();
  46. +}
  47. +#else
  48. +# include_next <startup.h>
  49. +#endif
  50. diff --git a/sysdeps/unix/sysv/linux/ia64/startup.h b/sysdeps/unix/sysv/linux/ia64/startup.h
  51. deleted file mode 100644
  52. index 77f29f15a2..0000000000
  53. --- a/sysdeps/unix/sysv/linux/ia64/startup.h
  54. +++ /dev/null
  55. @@ -1,22 +0,0 @@
  56. -/* Linux/ia64 definitions of functions used by static libc main startup.
  57. - Copyright (C) 2022 Free Software Foundation, Inc.
  58. - This file is part of the GNU C Library.
  59. -
  60. - The GNU C Library is free software; you can redistribute it and/or
  61. - modify it under the terms of the GNU Lesser General Public
  62. - License as published by the Free Software Foundation; either
  63. - version 2.1 of the License, or (at your option) any later version.
  64. -
  65. - The GNU C Library is distributed in the hope that it will be useful,
  66. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  67. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  68. - Lesser General Public License for more details.
  69. -
  70. - You should have received a copy of the GNU Lesser General Public
  71. - License along with the GNU C Library; if not, see
  72. - <https://www.gnu.org/licenses/>. */
  73. -
  74. -/* This code is used before the TCB is set up. */
  75. -#define IA64_USE_NEW_STUB 0
  76. -
  77. -#include_next <startup.h>
  78. diff --git a/sysdeps/unix/sysv/linux/startup.h b/sysdeps/unix/sysv/linux/startup.h
  79. deleted file mode 100644
  80. index 39859b404a..0000000000
  81. --- a/sysdeps/unix/sysv/linux/startup.h
  82. +++ /dev/null
  83. @@ -1,39 +0,0 @@
  84. -/* Linux definitions of functions used by static libc main startup.
  85. - Copyright (C) 2017-2022 Free Software Foundation, Inc.
  86. - This file is part of the GNU C Library.
  87. -
  88. - The GNU C Library is free software; you can redistribute it and/or
  89. - modify it under the terms of the GNU Lesser General Public
  90. - License as published by the Free Software Foundation; either
  91. - version 2.1 of the License, or (at your option) any later version.
  92. -
  93. - The GNU C Library is distributed in the hope that it will be useful,
  94. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  95. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  96. - Lesser General Public License for more details.
  97. -
  98. - You should have received a copy of the GNU Lesser General Public
  99. - License along with the GNU C Library; if not, see
  100. - <https://www.gnu.org/licenses/>. */
  101. -
  102. -#ifdef SHARED
  103. -# include_next <startup.h>
  104. -#else
  105. -# include <sysdep.h>
  106. -
  107. -/* Avoid a run-time invocation of strlen. */
  108. -#define _startup_fatal(message) \
  109. - do \
  110. - { \
  111. - size_t __message_length = __builtin_strlen (message); \
  112. - if (! __builtin_constant_p (__message_length)) \
  113. - { \
  114. - extern void _startup_fatal_not_constant (void); \
  115. - _startup_fatal_not_constant (); \
  116. - } \
  117. - INTERNAL_SYSCALL_CALL (write, STDERR_FILENO, (message), \
  118. - __message_length); \
  119. - INTERNAL_SYSCALL_CALL (exit_group, 127); \
  120. - } \
  121. - while (0)
  122. -#endif /* !SHARED */
  123. --
  124. 2.25.1