1 /* Linux/i386 definitions of functions used by static libc main startup.
2    Copyright (C) 2017-2021 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #if BUILD_PIE_DEFAULT
20 /* Can't use "call *%gs:SYSINFO_OFFSET" during statup in static PIE.  */
21 # define I386_USE_SYSENTER 0
22 
23 # include <sysdep.h>
24 # include <abort-instr.h>
25 
26 __attribute__ ((__noreturn__))
27 static inline void
_startup_fatal(const char * message)28 _startup_fatal (const char *message __attribute__ ((unused)))
29 {
30   /* This is only called very early during startup in static PIE.
31      FIXME: How can it be improved?  */
32   ABORT_INSTRUCTION;
33   __builtin_unreachable ();
34 }
35 
36 static inline uid_t
startup_getuid(void)37 startup_getuid (void)
38 {
39   return (uid_t) INTERNAL_SYSCALL_CALL (getuid32);
40 }
41 
42 static inline uid_t
startup_geteuid(void)43 startup_geteuid (void)
44 {
45   return (uid_t) INTERNAL_SYSCALL_CALL (geteuid32);
46 }
47 
48 static inline gid_t
startup_getgid(void)49 startup_getgid (void)
50 {
51   return (gid_t) INTERNAL_SYSCALL_CALL (getgid32);
52 }
53 
54 static inline gid_t
startup_getegid(void)55 startup_getegid (void)
56 {
57   return (gid_t) INTERNAL_SYSCALL_CALL (getegid32);
58 }
59 #else
60 # include_next <startup.h>
61 #endif
62