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