mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-26 19:23:34 +08:00
Reduce the statically linked startup code [BZ #23323]
It turns out the startup code in csu/elf-init.c has a perfect pair of ROP gadgets (see Marco-Gisbert and Ripoll-Ripoll, "return-to-csu: A New Method to Bypass 64-bit Linux ASLR"). These functions are not needed in dynamically-linked binaries because DT_INIT/DT_INIT_ARRAY are already processed by the dynamic linker. However, the dynamic linker skipped the main program for some reason. For maximum backwards compatibility, this is not changed, and instead, the main map is consulted from __libc_start_main if the init function argument is a NULL pointer. For statically linked binaries, the old approach based on linker symbols is still used because there is nothing else available. A new symbol version __libc_start_main@@GLIBC_2.34 is introduced because new binaries running on an old libc would not run their ELF constructors, leading to difficult-to-debug issues.
This commit is contained in:
parent
a79328c745
commit
035c012e32
10
csu/Makefile
10
csu/Makefile
@ -27,10 +27,9 @@ subdir := csu
|
|||||||
include ../Makeconfig
|
include ../Makeconfig
|
||||||
|
|
||||||
routines = init-first libc-start $(libc-init) sysdep version check_fds \
|
routines = init-first libc-start $(libc-init) sysdep version check_fds \
|
||||||
libc-tls elf-init dso_handle
|
libc-tls dso_handle
|
||||||
aux = errno
|
aux = errno
|
||||||
elide-routines.os = libc-tls
|
elide-routines.os = libc-tls
|
||||||
static-only-routines = elf-init
|
|
||||||
csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
|
csu-dummies = $(filter-out $(start-installed-name),crt1.o Mcrt1.o)
|
||||||
extra-objs = start.o \
|
extra-objs = start.o \
|
||||||
$(start-installed-name) g$(start-installed-name) $(csu-dummies) \
|
$(start-installed-name) g$(start-installed-name) $(csu-dummies) \
|
||||||
@ -59,13 +58,6 @@ CFLAGS-.os += $(no-stack-protector)
|
|||||||
# but it does not matter for this source file.
|
# but it does not matter for this source file.
|
||||||
CFLAGS-static-reloc.os += $(stack-protector)
|
CFLAGS-static-reloc.os += $(stack-protector)
|
||||||
|
|
||||||
# This file is not actually part of the startup code in the nonshared
|
|
||||||
# case and statically linked into applications. See
|
|
||||||
# <https://sourceware.org/bugzilla/show_bug.cgi?id=23323>,
|
|
||||||
# <https://sourceware.org/ml/libc-alpha/2018-06/msg00717.html>.
|
|
||||||
# Also see the note above regarding STACK_PROTECTOR_LEVEL.
|
|
||||||
CFLAGS-elf-init.oS += $(stack-protector)
|
|
||||||
|
|
||||||
ifeq (yes,$(build-shared))
|
ifeq (yes,$(build-shared))
|
||||||
extra-objs += S$(start-installed-name) gmon-start.os
|
extra-objs += S$(start-installed-name) gmon-start.os
|
||||||
ifneq ($(start-installed-name),$(static-start-installed-name))
|
ifneq ($(start-installed-name),$(static-start-installed-name))
|
||||||
|
@ -7,6 +7,9 @@ libc {
|
|||||||
# New special glibc functions.
|
# New special glibc functions.
|
||||||
gnu_get_libc_release; gnu_get_libc_version;
|
gnu_get_libc_release; gnu_get_libc_version;
|
||||||
}
|
}
|
||||||
|
GLIBC_2.34 {
|
||||||
|
__libc_start_main;
|
||||||
|
}
|
||||||
GLIBC_PRIVATE {
|
GLIBC_PRIVATE {
|
||||||
errno;
|
errno;
|
||||||
}
|
}
|
||||||
|
107
csu/elf-init.c
107
csu/elf-init.c
@ -1,107 +0,0 @@
|
|||||||
/* Startup support for ELF initializers/finalizers in the main executable.
|
|
||||||
Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
|
||||||
This file is part of the GNU C Library.
|
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
In addition to the permissions in the GNU Lesser General Public
|
|
||||||
License, the Free Software Foundation gives you unlimited
|
|
||||||
permission to link the compiled version of this file with other
|
|
||||||
programs, and to distribute those programs without any restriction
|
|
||||||
coming from the use of this file. (The GNU Lesser General Public
|
|
||||||
License restrictions do apply in other respects; for example, they
|
|
||||||
cover modification of the file, and distribution when not linked
|
|
||||||
into another program.)
|
|
||||||
|
|
||||||
Note that people who make modified versions of this file are not
|
|
||||||
obligated to grant this special exception for their modified
|
|
||||||
versions; it is their choice whether to do so. The GNU Lesser
|
|
||||||
General Public License gives permission to release a modified
|
|
||||||
version without this exception; this exception also makes it
|
|
||||||
possible to release a modified version which carries forward this
|
|
||||||
exception.
|
|
||||||
|
|
||||||
The GNU C Library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with the GNU C Library; if not, see
|
|
||||||
<https://www.gnu.org/licenses/>. */
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <elf-initfini.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* These magic symbols are provided by the linker. */
|
|
||||||
extern void (*__preinit_array_start []) (int, char **, char **)
|
|
||||||
attribute_hidden;
|
|
||||||
extern void (*__preinit_array_end []) (int, char **, char **)
|
|
||||||
attribute_hidden;
|
|
||||||
extern void (*__init_array_start []) (int, char **, char **)
|
|
||||||
attribute_hidden;
|
|
||||||
extern void (*__init_array_end []) (int, char **, char **)
|
|
||||||
attribute_hidden;
|
|
||||||
extern void (*__fini_array_start []) (void) attribute_hidden;
|
|
||||||
extern void (*__fini_array_end []) (void) attribute_hidden;
|
|
||||||
|
|
||||||
|
|
||||||
#if ELF_INITFINI
|
|
||||||
/* These function symbols are provided for the .init/.fini section entry
|
|
||||||
points automagically by the linker. */
|
|
||||||
extern void _init (void);
|
|
||||||
extern void _fini (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* These functions are passed to __libc_start_main by the startup code.
|
|
||||||
These get statically linked into each program. For dynamically linked
|
|
||||||
programs, this module will come from libc_nonshared.a and differs from
|
|
||||||
the libc.a module in that it doesn't call the preinit array. */
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
__libc_csu_init (int argc, char **argv, char **envp)
|
|
||||||
{
|
|
||||||
/* For dynamically linked executables the preinit array is executed by
|
|
||||||
the dynamic linker (before initializing any shared object). */
|
|
||||||
|
|
||||||
#ifndef LIBC_NONSHARED
|
|
||||||
/* For static executables, preinit happens right before init. */
|
|
||||||
{
|
|
||||||
const size_t size = __preinit_array_end - __preinit_array_start;
|
|
||||||
size_t i;
|
|
||||||
for (i = 0; i < size; i++)
|
|
||||||
(*__preinit_array_start [i]) (argc, argv, envp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ELF_INITFINI
|
|
||||||
_init ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const size_t size = __init_array_end - __init_array_start;
|
|
||||||
for (size_t i = 0; i < size; i++)
|
|
||||||
(*__init_array_start [i]) (argc, argv, envp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function should not be used anymore. We run the executable's
|
|
||||||
destructor now just like any other. We cannot remove the function,
|
|
||||||
though. */
|
|
||||||
void
|
|
||||||
__libc_csu_fini (void)
|
|
||||||
{
|
|
||||||
#ifndef LIBC_NONSHARED
|
|
||||||
size_t i = __fini_array_end - __fini_array_start;
|
|
||||||
while (i-- > 0)
|
|
||||||
(*__fini_array_start [i]) ();
|
|
||||||
|
|
||||||
# if ELF_INITFINI
|
|
||||||
_fini ();
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
166
csu/libc-start.c
166
csu/libc-start.c
@ -1,4 +1,5 @@
|
|||||||
/* Copyright (C) 1998-2021 Free Software Foundation, Inc.
|
/* Perform initialization and invoke main.
|
||||||
|
Copyright (C) 1998-2021 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -15,10 +16,15 @@
|
|||||||
License along with the GNU C Library; if not, see
|
License along with the GNU C Library; if not, see
|
||||||
<https://www.gnu.org/licenses/>. */
|
<https://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* Note: This code is only part of the startup code proper for
|
||||||
|
statically linked binaries. For dynamically linked binaries, it
|
||||||
|
resides in libc.so. */
|
||||||
|
|
||||||
/* Mark symbols hidden in static PIE for early self relocation to work. */
|
/* Mark symbols hidden in static PIE for early self relocation to work. */
|
||||||
#if BUILD_PIE_DEFAULT
|
#if BUILD_PIE_DEFAULT
|
||||||
# pragma GCC visibility push(hidden)
|
# pragma GCC visibility push(hidden)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -29,6 +35,8 @@
|
|||||||
#include <libc-internal.h>
|
#include <libc-internal.h>
|
||||||
#include <elf/libc-early-init.h>
|
#include <elf/libc-early-init.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <elf-initfini.h>
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
#include <elf/dl-tunables.h>
|
#include <elf/dl-tunables.h>
|
||||||
|
|
||||||
@ -95,9 +103,11 @@ apply_irel (void)
|
|||||||
# else
|
# else
|
||||||
# define STATIC static inline __attribute__ ((always_inline))
|
# define STATIC static inline __attribute__ ((always_inline))
|
||||||
# endif
|
# endif
|
||||||
|
# define DO_DEFINE_LIBC_START_MAIN_VERSION 0
|
||||||
#else
|
#else
|
||||||
# define STATIC
|
# define STATIC
|
||||||
# define LIBC_START_MAIN __libc_start_main
|
# define LIBC_START_MAIN __libc_start_main_impl
|
||||||
|
# define DO_DEFINE_LIBC_START_MAIN_VERSION 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MAIN_AUXVEC_ARG
|
#ifdef MAIN_AUXVEC_ARG
|
||||||
@ -113,6 +123,92 @@ apply_irel (void)
|
|||||||
# define ARCH_INIT_CPU_FEATURES()
|
# define ARCH_INIT_CPU_FEATURES()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SHARED
|
||||||
|
/* Initialization for dynamic executables. Find the main executable
|
||||||
|
link map and run its init functions. */
|
||||||
|
static void
|
||||||
|
call_init (int argc, char **argv, char **env)
|
||||||
|
{
|
||||||
|
/* Obtain the main map of the executable. */
|
||||||
|
struct link_map *l = GL(dl_ns)[LM_ID_BASE]._ns_loaded;
|
||||||
|
|
||||||
|
/* DT_PREINIT_ARRAY is not processed here. It is already handled in
|
||||||
|
_dl_init in elf/dl-init.c. Also see the call_init function in
|
||||||
|
the same file. */
|
||||||
|
|
||||||
|
if (ELF_INITFINI && l->l_info[DT_INIT] != NULL)
|
||||||
|
DL_CALL_DT_INIT(l, l->l_addr + l->l_info[DT_INIT]->d_un.d_ptr,
|
||||||
|
argc, argv, env);
|
||||||
|
|
||||||
|
ElfW(Dyn) *init_array = l->l_info[DT_INIT_ARRAY];
|
||||||
|
if (init_array != NULL)
|
||||||
|
{
|
||||||
|
unsigned int jm
|
||||||
|
= l->l_info[DT_INIT_ARRAYSZ]->d_un.d_val / sizeof (ElfW(Addr));
|
||||||
|
ElfW(Addr) *addrs = (void *) (init_array->d_un.d_ptr + l->l_addr);
|
||||||
|
for (unsigned int j = 0; j < jm; ++j)
|
||||||
|
((dl_init_t) addrs[j]) (argc, argv, env);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !SHARED */
|
||||||
|
|
||||||
|
/* These magic symbols are provided by the linker. */
|
||||||
|
extern void (*__preinit_array_start []) (int, char **, char **)
|
||||||
|
attribute_hidden;
|
||||||
|
extern void (*__preinit_array_end []) (int, char **, char **)
|
||||||
|
attribute_hidden;
|
||||||
|
extern void (*__init_array_start []) (int, char **, char **)
|
||||||
|
attribute_hidden;
|
||||||
|
extern void (*__init_array_end []) (int, char **, char **)
|
||||||
|
attribute_hidden;
|
||||||
|
extern void (*__fini_array_start []) (void) attribute_hidden;
|
||||||
|
extern void (*__fini_array_end []) (void) attribute_hidden;
|
||||||
|
|
||||||
|
# if ELF_INITFINI
|
||||||
|
/* These function symbols are provided for the .init/.fini section entry
|
||||||
|
points automagically by the linker. */
|
||||||
|
extern void _init (void);
|
||||||
|
extern void _fini (void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Initialization for static executables. There is no dynamic
|
||||||
|
segment, so we access the symbols directly. */
|
||||||
|
static void
|
||||||
|
call_init (int argc, char **argv, char **envp)
|
||||||
|
{
|
||||||
|
/* For static executables, preinit happens right before init. */
|
||||||
|
{
|
||||||
|
const size_t size = __preinit_array_end - __preinit_array_start;
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
(*__preinit_array_start [i]) (argc, argv, envp);
|
||||||
|
}
|
||||||
|
|
||||||
|
# if ELF_INITFINI
|
||||||
|
_init ();
|
||||||
|
# endif
|
||||||
|
|
||||||
|
const size_t size = __init_array_end - __init_array_start;
|
||||||
|
for (size_t i = 0; i < size; i++)
|
||||||
|
(*__init_array_start [i]) (argc, argv, envp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Likewise for the destructor. */
|
||||||
|
static void
|
||||||
|
call_fini (void *unused)
|
||||||
|
{
|
||||||
|
size_t i = __fini_array_end - __fini_array_start;
|
||||||
|
while (i-- > 0)
|
||||||
|
(*__fini_array_start [i]) ();
|
||||||
|
|
||||||
|
# if ELF_INITFINI
|
||||||
|
_fini ();
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* !SHARED */
|
||||||
|
|
||||||
#include <libc-start.h>
|
#include <libc-start.h>
|
||||||
|
|
||||||
STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
|
STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
|
||||||
@ -129,9 +225,16 @@ STATIC int LIBC_START_MAIN (int (*main) (int, char **, char **
|
|||||||
__attribute__ ((noreturn));
|
__attribute__ ((noreturn));
|
||||||
|
|
||||||
|
|
||||||
/* Note: the fini parameter is ignored here for shared library. It
|
/* Note: The init and fini parameters are no longer used. fini is
|
||||||
is registered with __cxa_atexit. This had the disadvantage that
|
completely unused, init is still called if not NULL, but the
|
||||||
finalizers were called in more than one place. */
|
current startup code always passes NULL. (In the future, it would
|
||||||
|
be possible to use fini to pass a version code if init is NULL, to
|
||||||
|
indicate the link-time glibc without introducing a hard
|
||||||
|
incompatibility for new programs with older glibc versions.)
|
||||||
|
|
||||||
|
For dynamically linked executables, the dynamic segment is used to
|
||||||
|
locate constructors and destructors. For statically linked
|
||||||
|
executables, the relevant symbols are access directly. */
|
||||||
STATIC int
|
STATIC int
|
||||||
LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
|
LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
|
||||||
int argc, char **argv,
|
int argc, char **argv,
|
||||||
@ -258,9 +361,8 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
|
|||||||
run the constructors in `_dl_start_user'. */
|
run the constructors in `_dl_start_user'. */
|
||||||
__libc_init_first (argc, argv, __environ);
|
__libc_init_first (argc, argv, __environ);
|
||||||
|
|
||||||
/* Register the destructor of the program, if any. */
|
/* Register the destructor of the statically-linked program. */
|
||||||
if (fini)
|
__cxa_atexit (call_fini, NULL, NULL);
|
||||||
__cxa_atexit ((void (*) (void *)) fini, NULL, NULL);
|
|
||||||
|
|
||||||
/* Some security at this point. Prevent starting a SUID binary where
|
/* Some security at this point. Prevent starting a SUID binary where
|
||||||
the standard file descriptors are not opened. We have to do this
|
the standard file descriptors are not opened. We have to do this
|
||||||
@ -268,15 +370,24 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
|
|||||||
loader did the work already. */
|
loader did the work already. */
|
||||||
if (__builtin_expect (__libc_enable_secure, 0))
|
if (__builtin_expect (__libc_enable_secure, 0))
|
||||||
__libc_check_standard_fds ();
|
__libc_check_standard_fds ();
|
||||||
#endif
|
#endif /* !SHARED */
|
||||||
|
|
||||||
/* Call the initializer of the program, if any. */
|
/* Call the initializer of the program, if any. */
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
|
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_IMPCALLS, 0))
|
||||||
GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
|
GLRO(dl_debug_printf) ("\ninitialize program: %s\n\n", argv[0]);
|
||||||
#endif
|
|
||||||
if (init)
|
if (init != NULL)
|
||||||
|
/* This is a legacy program which supplied its own init
|
||||||
|
routine. */
|
||||||
(*init) (argc, argv, __environ MAIN_AUXVEC_PARAM);
|
(*init) (argc, argv, __environ MAIN_AUXVEC_PARAM);
|
||||||
|
else
|
||||||
|
/* This is a current program. Use the dynamic segment to find
|
||||||
|
constructors. */
|
||||||
|
call_init (argc, argv, __environ);
|
||||||
|
#else /* !SHARED */
|
||||||
|
call_init (argc, argv, __environ);
|
||||||
|
#endif /* SHARED */
|
||||||
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
/* Auditing checkpoint: we have a new object. */
|
/* Auditing checkpoint: we have a new object. */
|
||||||
@ -365,3 +476,36 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
|
|||||||
|
|
||||||
exit (result);
|
exit (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Starting with glibc 2.34, the init parameter is always NULL. Older
|
||||||
|
libcs are not prepared to handle that. The macro
|
||||||
|
DEFINE_LIBC_START_MAIN_VERSION creates GLIBC_2.34 alias, so that
|
||||||
|
newly linked binaries reflect that dependency. The macros below
|
||||||
|
expect that the exported function is called
|
||||||
|
__libc_start_main_impl. */
|
||||||
|
#ifdef SHARED
|
||||||
|
# define DEFINE_LIBC_START_MAIN_VERSION \
|
||||||
|
DEFINE_LIBC_START_MAIN_VERSION_1 \
|
||||||
|
strong_alias (__libc_start_main_impl, __libc_start_main_alias_2) \
|
||||||
|
versioned_symbol (libc, __libc_start_main_alias_2, __libc_start_main, \
|
||||||
|
GLIBC_2_34);
|
||||||
|
|
||||||
|
# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_34)
|
||||||
|
# define DEFINE_LIBC_START_MAIN_VERSION_1 \
|
||||||
|
strong_alias (__libc_start_main_impl, __libc_start_main_alias_1) \
|
||||||
|
compat_symbol (libc, __libc_start_main_alias_1, __libc_start_main, GLIBC_2_0);
|
||||||
|
# else
|
||||||
|
# define DEFINE_LIBC_START_MAIN_VERSION_1
|
||||||
|
# endif
|
||||||
|
#else /* !SHARED */
|
||||||
|
/* Enable calling the function under its exported name. */
|
||||||
|
# define DEFINE_LIBC_START_MAIN_VERSION \
|
||||||
|
strong_alias (__libc_start_main_impl, __libc_start_main)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Only define the version information if LIBC_START_MAIN was not set.
|
||||||
|
If there is a wrapper file, it must expand
|
||||||
|
DEFINE_LIBC_START_MAIN_VERSION on its own. */
|
||||||
|
#if DO_DEFINE_LIBC_START_MAIN_VERSION
|
||||||
|
DEFINE_LIBC_START_MAIN_VERSION
|
||||||
|
#endif
|
||||||
|
@ -22,10 +22,6 @@
|
|||||||
#include <elf-initfini.h>
|
#include <elf-initfini.h>
|
||||||
|
|
||||||
|
|
||||||
/* Type of the initializer. */
|
|
||||||
typedef void (*init_t) (int, char **, char **);
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
call_init (struct link_map *l, int argc, char **argv, char **env)
|
call_init (struct link_map *l, int argc, char **argv, char **env)
|
||||||
{
|
{
|
||||||
@ -71,7 +67,7 @@ call_init (struct link_map *l, int argc, char **argv, char **env)
|
|||||||
|
|
||||||
addrs = (ElfW(Addr) *) (init_array->d_un.d_ptr + l->l_addr);
|
addrs = (ElfW(Addr) *) (init_array->d_un.d_ptr + l->l_addr);
|
||||||
for (j = 0; j < jm; ++j)
|
for (j = 0; j < jm; ++j)
|
||||||
((init_t) addrs[j]) (argc, argv, env);
|
((dl_init_t) addrs[j]) (argc, argv, env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +99,7 @@ _dl_init (struct link_map *main_map, int argc, char **argv, char **env)
|
|||||||
|
|
||||||
addrs = (ElfW(Addr) *) (preinit_array->d_un.d_ptr + main_map->l_addr);
|
addrs = (ElfW(Addr) *) (preinit_array->d_un.d_ptr + main_map->l_addr);
|
||||||
for (cnt = 0; cnt < i; ++cnt)
|
for (cnt = 0; cnt < i; ++cnt)
|
||||||
((init_t) addrs[cnt]) (argc, argv, env);
|
((dl_init_t) addrs[cnt]) (argc, argv, env);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stupid users forced the ELF specification to be changed. It now
|
/* Stupid users forced the ELF specification to be changed. It now
|
||||||
|
@ -63,26 +63,16 @@ ENTRY(_start)
|
|||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
adrp x0, :got:main
|
adrp x0, :got:main
|
||||||
ldr PTR_REG (0), [x0, #:got_lo12:main]
|
ldr PTR_REG (0), [x0, #:got_lo12:main]
|
||||||
|
|
||||||
adrp x3, :got:__libc_csu_init
|
|
||||||
ldr PTR_REG (3), [x3, #:got_lo12:__libc_csu_init]
|
|
||||||
|
|
||||||
adrp x4, :got:__libc_csu_fini
|
|
||||||
ldr PTR_REG (4), [x4, #:got_lo12:__libc_csu_fini]
|
|
||||||
# else
|
# else
|
||||||
adrp x0, __wrap_main
|
adrp x0, __wrap_main
|
||||||
add x0, x0, :lo12:__wrap_main
|
add x0, x0, :lo12:__wrap_main
|
||||||
adrp x3, __libc_csu_init
|
|
||||||
add x3, x3, :lo12:__libc_csu_init
|
|
||||||
adrp x4, __libc_csu_fini
|
|
||||||
add x4, x4, :lo12:__libc_csu_fini
|
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
/* Set up the other arguments in registers */
|
/* Set up the other arguments in registers */
|
||||||
MOVL (0, main)
|
MOVL (0, main)
|
||||||
MOVL (3, __libc_csu_init)
|
|
||||||
MOVL (4, __libc_csu_fini)
|
|
||||||
#endif
|
#endif
|
||||||
|
mov x3, #0 /* Used to be init. */
|
||||||
|
mov x4, #0 /* Used to be fini. */
|
||||||
|
|
||||||
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
|
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini,
|
||||||
stack_end) */
|
stack_end) */
|
||||||
|
@ -55,9 +55,8 @@ _start:
|
|||||||
ldl a1, 16(sp) /* get argc */
|
ldl a1, 16(sp) /* get argc */
|
||||||
lda a2, 24(sp) /* get argv */
|
lda a2, 24(sp) /* get argv */
|
||||||
|
|
||||||
/* Load address of our own entry points to .fini and .init. */
|
mov $r31, a3 /* Used to be init. */
|
||||||
lda a3, __libc_csu_init
|
mov $r31, a4 /* Used to be fini. */
|
||||||
lda a4, __libc_csu_fini
|
|
||||||
|
|
||||||
/* Store address of the shared library termination function. */
|
/* Store address of the shared library termination function. */
|
||||||
mov v0, a5
|
mov v0, a5
|
||||||
|
@ -49,15 +49,14 @@ ENTRY (ENTRY_POINT)
|
|||||||
|
|
||||||
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end). */
|
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end). */
|
||||||
|
|
||||||
|
mov_s r3, 0 /* Used to be init. */
|
||||||
|
mov r4, 0 /* Used to be fini. */
|
||||||
|
|
||||||
#ifdef SHARED
|
#ifdef SHARED
|
||||||
ld r0, [pcl, @main@gotpc]
|
ld r0, [pcl, @main@gotpc]
|
||||||
ld r3, [pcl, @__libc_csu_init@gotpc]
|
|
||||||
ld r4, [pcl, @__libc_csu_fini@gotpc]
|
|
||||||
bl __libc_start_main@plt
|
bl __libc_start_main@plt
|
||||||
#else
|
#else
|
||||||
mov_s r0, main
|
mov_s r0, main
|
||||||
mov_s r3, __libc_csu_init
|
|
||||||
mov r4, __libc_csu_fini
|
|
||||||
bl __libc_start_main
|
bl __libc_start_main
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -94,30 +94,20 @@ _start:
|
|||||||
adr a4, .L_GOT
|
adr a4, .L_GOT
|
||||||
add sl, sl, a4
|
add sl, sl, a4
|
||||||
|
|
||||||
ldr ip, .L_GOT+4 /* __libc_csu_fini */
|
mov a4, #0 /* Used to be init. */
|
||||||
ldr ip, [sl, ip]
|
push { a4 } /* Used to be fini. */
|
||||||
|
|
||||||
push { ip } /* Push __libc_csu_fini */
|
ldr a1, .L_GOT+4 /* main */
|
||||||
|
|
||||||
ldr a4, .L_GOT+8 /* __libc_csu_init */
|
|
||||||
ldr a4, [sl, a4]
|
|
||||||
|
|
||||||
ldr a1, .L_GOT+12 /* main */
|
|
||||||
ldr a1, [sl, a1]
|
ldr a1, [sl, a1]
|
||||||
|
|
||||||
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
|
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
|
||||||
/* Let the libc call main and exit with its return code. */
|
/* Let the libc call main and exit with its return code. */
|
||||||
bl __libc_start_main(PLT)
|
bl __libc_start_main(PLT)
|
||||||
#else
|
#else
|
||||||
/* Fetch address of __libc_csu_fini */
|
|
||||||
ldr ip, =__libc_csu_fini
|
|
||||||
|
|
||||||
/* Push __libc_csu_fini */
|
mov a4, #0 /* Used to init. */
|
||||||
push { ip }
|
push { a4 } /* Used to fini. */
|
||||||
|
|
||||||
/* Set up the other arguments in registers */
|
|
||||||
ldr a1, =main
|
ldr a1, =main
|
||||||
ldr a4, =__libc_csu_init
|
|
||||||
|
|
||||||
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
|
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
|
||||||
/* Let the libc call main and exit with its return code. */
|
/* Let the libc call main and exit with its return code. */
|
||||||
@ -131,8 +121,6 @@ _start:
|
|||||||
.align 2
|
.align 2
|
||||||
.L_GOT:
|
.L_GOT:
|
||||||
.word _GLOBAL_OFFSET_TABLE_ - .L_GOT
|
.word _GLOBAL_OFFSET_TABLE_ - .L_GOT
|
||||||
.word __libc_csu_fini(GOT)
|
|
||||||
.word __libc_csu_init(GOT)
|
|
||||||
.word main(GOT)
|
.word main(GOT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -66,13 +66,9 @@ _start:
|
|||||||
.Lgetpc:
|
.Lgetpc:
|
||||||
lrw gb, .Lgetpc@GOTPC
|
lrw gb, .Lgetpc@GOTPC
|
||||||
addu gb, t0
|
addu gb, t0
|
||||||
lrw a3, __libc_csu_fini@GOT
|
|
||||||
ldr.w a3, (gb, a3 << 0)
|
|
||||||
stw a3, (sp, 0)
|
|
||||||
|
|
||||||
lrw a3, __libc_csu_init@GOT
|
movi a3, 0 /* Used to be init. */
|
||||||
addu a3, gb
|
stw a3, (sp, 0) /* Used to be fini. */
|
||||||
ldw a3, (a3, 0)
|
|
||||||
|
|
||||||
lrw t0, main@GOT
|
lrw t0, main@GOT
|
||||||
addu t0, gb
|
addu t0, gb
|
||||||
@ -85,14 +81,9 @@ _start:
|
|||||||
ldr.w t1, (gb, t1 << 0)
|
ldr.w t1, (gb, t1 << 0)
|
||||||
jsr t1
|
jsr t1
|
||||||
#else
|
#else
|
||||||
/* Fetch address of __libc_csu_fini. */
|
movi a3, 0 /* Used to be init. */
|
||||||
lrw a0, __libc_csu_fini
|
stw a3, (sp, 0) /* Used to be fini. */
|
||||||
/* Push __libc_csu_fini */
|
|
||||||
stw a0, (sp, 0)
|
|
||||||
|
|
||||||
/* Set up the other arguments in registers. */
|
|
||||||
lrw a0, main
|
lrw a0, main
|
||||||
lrw a3, __libc_csu_init
|
|
||||||
/* Let the libc call main and exit with its return code. */
|
/* Let the libc call main and exit with its return code. */
|
||||||
jsri __libc_start_main
|
jsri __libc_start_main
|
||||||
|
|
||||||
|
@ -93,6 +93,10 @@ typedef struct link_map *lookup_t;
|
|||||||
: (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0 \
|
: (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0 \
|
||||||
: LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value)
|
: LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value)
|
||||||
|
|
||||||
|
/* Type of a constructor function, in DT_INIT, DT_INIT_ARRAY,
|
||||||
|
DT_PREINIT_ARRAY. */
|
||||||
|
typedef void (*dl_init_t) (int, char **, char **);
|
||||||
|
|
||||||
/* On some architectures a pointer to a function is not just a pointer
|
/* On some architectures a pointer to a function is not just a pointer
|
||||||
to the actual code of the function but rather an architecture
|
to the actual code of the function but rather an architecture
|
||||||
specific descriptor. */
|
specific descriptor. */
|
||||||
@ -101,7 +105,7 @@ typedef struct link_map *lookup_t;
|
|||||||
(void *) SYMBOL_ADDRESS (map, ref, false)
|
(void *) SYMBOL_ADDRESS (map, ref, false)
|
||||||
# define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))
|
# define DL_LOOKUP_ADDRESS(addr) ((ElfW(Addr)) (addr))
|
||||||
# define DL_CALL_DT_INIT(map, start, argc, argv, env) \
|
# define DL_CALL_DT_INIT(map, start, argc, argv, env) \
|
||||||
((init_t) (start)) (argc, argv, env)
|
((dl_init_t) (start)) (argc, argv, env)
|
||||||
# define DL_CALL_DT_FINI(map, start) ((fini_t) (start)) ()
|
# define DL_CALL_DT_FINI(map, start) ((fini_t) (start)) ()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void attribute_hidden _dl_unmap (struct link_map *map);
|
|||||||
{ \
|
{ \
|
||||||
ElfW(Addr) addr; \
|
ElfW(Addr) addr; \
|
||||||
DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
|
DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
|
||||||
init_t init = (init_t) addr; \
|
dl_init_t init = (dl_init_t) addr; \
|
||||||
init (argc, argv, env); \
|
init (argc, argv, env); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
.import main, code
|
.import main, code
|
||||||
.import $global$, data
|
.import $global$, data
|
||||||
.import __libc_start_main, code
|
.import __libc_start_main, code
|
||||||
.import __libc_csu_fini, code
|
|
||||||
.import __libc_csu_init, code
|
|
||||||
|
|
||||||
/* Have the linker create plabel words so we get PLABEL32
|
/* Have the linker create plabel words so we get PLABEL32
|
||||||
relocs and not 21/14. The use of 21/14 relocs is only
|
relocs and not 21/14. The use of 21/14 relocs is only
|
||||||
@ -52,10 +50,6 @@
|
|||||||
.word P%main
|
.word P%main
|
||||||
.Lp__libc_start_main:
|
.Lp__libc_start_main:
|
||||||
.word P%__libc_start_main
|
.word P%__libc_start_main
|
||||||
.Lp__libc_csu_fini:
|
|
||||||
.word P%__libc_csu_fini
|
|
||||||
.Lp__libc_csu_init:
|
|
||||||
.word P%__libc_csu_init
|
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.align 4
|
.align 4
|
||||||
@ -77,8 +71,8 @@ _start:
|
|||||||
1. r26 - Application main
|
1. r26 - Application main
|
||||||
2. r25 - argc
|
2. r25 - argc
|
||||||
3. r24 - argv
|
3. r24 - argv
|
||||||
4. r23 - __libc_csu_init
|
4. r23 - init (unused)
|
||||||
5. sp-52 - __libc_csu_fini
|
5. sp-52 - fini (unused)
|
||||||
6. sp-56 - rtld_fini
|
6. sp-56 - rtld_fini
|
||||||
7. sp-60 - stackend */
|
7. sp-60 - stackend */
|
||||||
|
|
||||||
@ -108,14 +102,6 @@ _start:
|
|||||||
addil LT'.Lpmain, %r19
|
addil LT'.Lpmain, %r19
|
||||||
ldw RT'.Lpmain(%r1), %r26
|
ldw RT'.Lpmain(%r1), %r26
|
||||||
ldw 0(%r26),%r26
|
ldw 0(%r26),%r26
|
||||||
/* void (*init) (void) (4th argument) */
|
|
||||||
addil LT'.Lp__libc_csu_init, %r19
|
|
||||||
ldw RT'.Lp__libc_csu_init(%r1), %r23
|
|
||||||
ldw 0(%r23), %r23
|
|
||||||
/* void (*fini) (void) (5th argument) */
|
|
||||||
addil LT'.Lp__libc_csu_fini, %r19
|
|
||||||
ldw RT'.Lp__libc_csu_fini(%r1), %r22
|
|
||||||
ldw 0(%r22), %r22
|
|
||||||
#else
|
#else
|
||||||
/* Load $global$ address into %dp */
|
/* Load $global$ address into %dp */
|
||||||
ldil L%$global$, %dp
|
ldil L%$global$, %dp
|
||||||
@ -124,13 +110,9 @@ _start:
|
|||||||
/* load main (1st argument) */
|
/* load main (1st argument) */
|
||||||
ldil LR'.Lpmain, %r26
|
ldil LR'.Lpmain, %r26
|
||||||
ldw RR'.Lpmain(%r26), %r26
|
ldw RR'.Lpmain(%r26), %r26
|
||||||
/* void (*init) (void) (4th argument) */
|
|
||||||
ldil LR'.Lp__libc_csu_init, %r23
|
|
||||||
ldw RR'.Lp__libc_csu_init(%r23), %r23
|
|
||||||
/* void (*fini) (void) (5th argument) */
|
|
||||||
ldil LR'.Lp__libc_csu_fini, %r22
|
|
||||||
ldw RR'.Lp__libc_csu_fini(%r22), %r22
|
|
||||||
#endif
|
#endif
|
||||||
|
ldi 0,%r23 /* Used to be init. */
|
||||||
|
ldi 0,%r22 /* Used to be fini. */
|
||||||
/* Store 5th argument */
|
/* Store 5th argument */
|
||||||
stw %r22, -52(%sp)
|
stw %r22, -52(%sp)
|
||||||
/* void *stack_end (7th argument) */
|
/* void *stack_end (7th argument) */
|
||||||
|
@ -87,11 +87,9 @@ ENTRY (_start)
|
|||||||
call 1f
|
call 1f
|
||||||
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
addl $_GLOBAL_OFFSET_TABLE_, %ebx
|
||||||
|
|
||||||
/* Push address of our own entry points to .fini and .init. */
|
/* This used to be the addresses of .fini and .init. */
|
||||||
leal __libc_csu_fini@GOTOFF(%ebx), %eax
|
pushl $0
|
||||||
pushl %eax
|
pushl $0
|
||||||
leal __libc_csu_init@GOTOFF(%ebx), %eax
|
|
||||||
pushl %eax
|
|
||||||
|
|
||||||
pushl %ecx /* Push second argument: argv. */
|
pushl %ecx /* Push second argument: argv. */
|
||||||
pushl %esi /* Push first argument: argc. */
|
pushl %esi /* Push first argument: argc. */
|
||||||
@ -112,9 +110,9 @@ ENTRY (_start)
|
|||||||
But let the libc call main. */
|
But let the libc call main. */
|
||||||
call __libc_start_main@PLT
|
call __libc_start_main@PLT
|
||||||
#else
|
#else
|
||||||
/* Push address of our own entry points to .fini and .init. */
|
/* This used to be the addresses of .fini and .init. */
|
||||||
pushl $__libc_csu_fini
|
pushl $0
|
||||||
pushl $__libc_csu_init
|
pushl $0
|
||||||
|
|
||||||
pushl %ecx /* Push second argument: argv. */
|
pushl %ecx /* Push second argument: argv. */
|
||||||
pushl %esi /* Push first argument: argc. */
|
pushl %esi /* Push first argument: argc. */
|
||||||
|
@ -50,7 +50,7 @@ extern void attribute_hidden _dl_unmap (struct link_map *map);
|
|||||||
{ \
|
{ \
|
||||||
ElfW(Addr) addr; \
|
ElfW(Addr) addr; \
|
||||||
DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
|
DL_DT_FUNCTION_ADDRESS(map, start, , addr) \
|
||||||
init_t init = (init_t) addr; \
|
dl_init_t init = (dl_init_t) addr; \
|
||||||
init (argc, argv, env); \
|
init (argc, argv, env); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,20 +82,15 @@ _start:
|
|||||||
{
|
{
|
||||||
addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
|
addl r11 = @ltoff(__libc_ia64_register_backing_store_base), gp
|
||||||
addl out0 = @ltoff(@fptr(main)), gp
|
addl out0 = @ltoff(@fptr(main)), gp
|
||||||
addl out3 = @ltoff(@fptr(__libc_csu_init)), gp
|
mov out3 = r0 /* Used to be init. */
|
||||||
;;
|
;;
|
||||||
}
|
}
|
||||||
{ .mmi
|
{ .mmi
|
||||||
ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
|
ld8 r3 = [r11] /* pointer to __libc_ia64_register_backing_store_base */
|
||||||
ld8 out0 = [out0] /* pointer to `main' function descriptor */
|
ld8 out0 = [out0] /* pointer to `main' function descriptor */
|
||||||
addl out4 = @ltoff(@fptr(__libc_csu_fini)), gp
|
mov out4 = r0 /* Used to be fini. */
|
||||||
;;
|
;;
|
||||||
}
|
}
|
||||||
{ .mmi
|
|
||||||
ld8 out3 = [out3] /* pointer to `init' function descriptor */
|
|
||||||
ld8 out4 = [out4] /* pointer to `fini' function descriptor */
|
|
||||||
nop 0
|
|
||||||
}
|
|
||||||
.body
|
.body
|
||||||
{ .mib
|
{ .mib
|
||||||
st8 [r3] = r10
|
st8 [r3] = r10
|
||||||
|
@ -76,15 +76,14 @@ _start:
|
|||||||
pea (%a1) /* Push address of the shared library
|
pea (%a1) /* Push address of the shared library
|
||||||
termination function. */
|
termination function. */
|
||||||
|
|
||||||
|
/* These used to be addresses of the .fini and .init entry points. */
|
||||||
|
clr.l -(%sp)
|
||||||
|
clr.l -(%sp)
|
||||||
|
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
/* Load PIC register. */
|
/* Load PIC register. */
|
||||||
LOAD_GOT (%a5)
|
LOAD_GOT (%a5)
|
||||||
|
|
||||||
/* Push the address of our own entry points to `.fini' and
|
|
||||||
`.init'. */
|
|
||||||
move.l __libc_csu_fini@GOT(%a5), -(%sp)
|
|
||||||
move.l __libc_csu_init@GOT(%a5), -(%sp)
|
|
||||||
|
|
||||||
pea (%a0) /* Push second argument: argv. */
|
pea (%a0) /* Push second argument: argv. */
|
||||||
move.l %d0, -(%sp) /* Push first argument: argc. */
|
move.l %d0, -(%sp) /* Push first argument: argc. */
|
||||||
|
|
||||||
@ -94,10 +93,6 @@ _start:
|
|||||||
let the libc call main. */
|
let the libc call main. */
|
||||||
jbsr __libc_start_main@PLTPC
|
jbsr __libc_start_main@PLTPC
|
||||||
#else
|
#else
|
||||||
/* Push the address of our own entry points to `.fini' and
|
|
||||||
`.init'. */
|
|
||||||
pea __libc_csu_fini
|
|
||||||
pea __libc_csu_init
|
|
||||||
|
|
||||||
pea (%a0) /* Push second argument: argv. */
|
pea (%a0) /* Push second argument: argv. */
|
||||||
move.l %d0, -(%sp) /* Push first argument: argc. */
|
move.l %d0, -(%sp) /* Push first argument: argc. */
|
||||||
|
@ -2203,6 +2203,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -63,14 +63,14 @@ _start:
|
|||||||
mfs r20,rpc
|
mfs r20,rpc
|
||||||
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
|
addik r20,r20,_GLOBAL_OFFSET_TABLE_+8
|
||||||
lwi r5,r20,main@GOT
|
lwi r5,r20,main@GOT
|
||||||
lwi r8,r20,__libc_csu_init@GOT
|
addk r8,r0,r0 /* Used to be init. */
|
||||||
lwi r9,r20,__libc_csu_fini@GOT
|
addk r9,r0,r0 /* Used to be fini. */
|
||||||
brid __libc_start_main@PLT
|
brid __libc_start_main@PLT
|
||||||
addk r10,r0,r0
|
addk r10,r0,r0
|
||||||
#else
|
#else
|
||||||
addik r5,r0,main
|
addik r5,r0,main
|
||||||
addik r8,r0,__libc_csu_init
|
addk r8,r0,r0 /* Used to be init. */
|
||||||
addik r9,r0,__libc_csu_fini
|
addk r9,r0,r0 /* Used to be fini. */
|
||||||
brid __libc_start_main
|
brid __libc_start_main
|
||||||
addk r10,r0,r0
|
addk r10,r0,r0
|
||||||
#endif
|
#endif
|
||||||
|
@ -96,13 +96,13 @@ ENTRY_POINT:
|
|||||||
# if _MIPS_SIM == _ABIO32
|
# if _MIPS_SIM == _ABIO32
|
||||||
PTR_SUBIU $29, 32
|
PTR_SUBIU $29, 32
|
||||||
# endif
|
# endif
|
||||||
PTR_LA $7, __libc_csu_init /* init */
|
move $7, $0 /* Used to be init. */
|
||||||
PTR_LA $8, __libc_csu_fini
|
|
||||||
# if _MIPS_SIM == _ABIO32
|
# if _MIPS_SIM == _ABIO32
|
||||||
PTR_S $8, 16($29) /* fini */
|
PTR_S $0, 16($29) /* Used to be fini. */
|
||||||
PTR_S $2, 20($29) /* rtld_fini */
|
PTR_S $2, 20($29) /* rtld_fini */
|
||||||
PTR_S $29, 24($29) /* stack_end */
|
PTR_S $29, 24($29) /* stack_end */
|
||||||
# else
|
# else
|
||||||
|
move $8, $0 /* Used to be fini. */
|
||||||
move $9, $2 /* rtld_fini */
|
move $9, $2 /* rtld_fini */
|
||||||
move $10, $29 /* stack_end */
|
move $10, $29 /* stack_end */
|
||||||
# endif
|
# endif
|
||||||
@ -143,19 +143,17 @@ ENTRY_POINT:
|
|||||||
/* Lay out last arguments, and call __libc_start_main(). */
|
/* Lay out last arguments, and call __libc_start_main(). */
|
||||||
# ifdef __PIC__
|
# ifdef __PIC__
|
||||||
sw $7, 24($sp) /* stack_end */
|
sw $7, 24($sp) /* stack_end */
|
||||||
lw $4, %got(__libc_csu_fini)($3)
|
move $4, $0 /* Used to be ini. */
|
||||||
lw $7, %got(__libc_csu_init)($3) /* init */
|
sw $0, 16($sp) /* Used to be fini. */
|
||||||
sw $4, 16($sp) /* fini */
|
|
||||||
lw $4, %got(main)($3) /* main */
|
lw $4, %got(main)($3) /* main */
|
||||||
lw $3, %call16(__libc_start_main)($3)
|
lw $3, %call16(__libc_start_main)($3)
|
||||||
sw $2, 20($sp) /* rtld_fini */
|
sw $2, 20($sp) /* rtld_fini */
|
||||||
move $25, $3
|
move $25, $3
|
||||||
jalr $3
|
jalr $3
|
||||||
# else
|
# else
|
||||||
lw $4, 1f
|
|
||||||
sw $7, 24($sp) /* stack_end */
|
sw $7, 24($sp) /* stack_end */
|
||||||
lw $7, 2f /* init */
|
move $7, $0 /* Used to be init. */
|
||||||
sw $4, 16($sp) /* fini */
|
sw $0, 16($sp) /* Used to be fini. */
|
||||||
lw $4, 3f /* main */
|
lw $4, 3f /* main */
|
||||||
sw $2, 20($sp) /* rtld_fini */
|
sw $2, 20($sp) /* rtld_fini */
|
||||||
/* Load and call __libc_start_main(). */
|
/* Load and call __libc_start_main(). */
|
||||||
@ -165,8 +163,6 @@ ENTRY_POINT:
|
|||||||
hlt: b hlt /* Crash if somehow it does return. */
|
hlt: b hlt /* Crash if somehow it does return. */
|
||||||
# ifndef __PIC__
|
# ifndef __PIC__
|
||||||
.align 2
|
.align 2
|
||||||
1: .word __libc_csu_fini
|
|
||||||
2: .word __libc_csu_init
|
|
||||||
3: .word main
|
3: .word main
|
||||||
4: .word __libc_start_main
|
4: .word __libc_start_main
|
||||||
# endif
|
# endif
|
||||||
|
@ -92,18 +92,11 @@ _start:
|
|||||||
addi r2, r2, %lo(_gp_got - 1b)
|
addi r2, r2, %lo(_gp_got - 1b)
|
||||||
add r22, r22, r2
|
add r22, r22, r2
|
||||||
|
|
||||||
/* Push fini */
|
/* Used to be fini. */
|
||||||
movhi r8, %call_hiadj(__libc_csu_fini)
|
stw zero, 0(sp)
|
||||||
addi r8, r8, %call_lo(__libc_csu_fini)
|
|
||||||
add r8, r8, r22
|
|
||||||
ldw r8, 0(r8)
|
|
||||||
stw r8, 0(sp)
|
|
||||||
|
|
||||||
/* r7 == init */
|
/* Used to be init. */
|
||||||
movhi r7, %call_hiadj(__libc_csu_init)
|
mov r7, zero
|
||||||
addi r7, r7, %call_lo(__libc_csu_init)
|
|
||||||
add r7, r7, r22
|
|
||||||
ldw r7, 0(r7)
|
|
||||||
|
|
||||||
/* r6 == argv */
|
/* r6 == argv */
|
||||||
addi r6, sp, 16
|
addi r6, sp, 16
|
||||||
|
@ -52,8 +52,8 @@
|
|||||||
L(start_addresses):
|
L(start_addresses):
|
||||||
.long _SDA_BASE_
|
.long _SDA_BASE_
|
||||||
.long main
|
.long main
|
||||||
.long __libc_csu_init
|
.long 0 /* Used to be init. */
|
||||||
.long __libc_csu_fini
|
.long 0 /* Used to be fini. */
|
||||||
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
||||||
|
|
||||||
.section ".text"
|
.section ".text"
|
||||||
|
@ -53,8 +53,8 @@ L(start_addresses):
|
|||||||
.quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
|
.quad 0 /* was _SDA_BASE_ but not in 64-bit ABI*/
|
||||||
/* function descriptors so don't need JUMPTARGET */
|
/* function descriptors so don't need JUMPTARGET */
|
||||||
.quad main
|
.quad main
|
||||||
.quad __libc_csu_init
|
.quad 0 /* Used to be init. */
|
||||||
.quad __libc_csu_fini
|
.quad 0 /* Used to be fini. */
|
||||||
|
|
||||||
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
ASM_SIZE_DIRECTIVE(L(start_addresses))
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ ENTRY (ENTRY_POINT)
|
|||||||
REG_L a1, 0(sp) /* argc. */
|
REG_L a1, 0(sp) /* argc. */
|
||||||
addi a2, sp, SZREG /* argv. */
|
addi a2, sp, SZREG /* argv. */
|
||||||
andi sp, sp, ALMASK /* Align stack. */
|
andi sp, sp, ALMASK /* Align stack. */
|
||||||
lla a3, __libc_csu_init
|
li a3, 0 /* Used to be init. */
|
||||||
lla a4, __libc_csu_fini
|
li a4, 0 /* Used to be fini. */
|
||||||
mv a6, sp /* stack_end. */
|
mv a6, sp /* stack_end. */
|
||||||
|
|
||||||
call __libc_start_main@plt
|
call __libc_start_main@plt
|
||||||
|
@ -175,18 +175,16 @@ _start:
|
|||||||
*/
|
*/
|
||||||
stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
|
stm %r14,%r15,96(%r15) # store rtld_fini/stack_end to parameter area
|
||||||
la %r7,96(%r15)
|
la %r7,96(%r15)
|
||||||
l %r6,.L2-.Llit(%r13) # load pointer to __libc_csu_fini
|
|
||||||
l %r5,.L1-.Llit(%r13) # load pointer to __libc_csu_init
|
|
||||||
l %r2,.L3-.Llit(%r13) # load pointer to main
|
l %r2,.L3-.Llit(%r13) # load pointer to main
|
||||||
l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
|
l %r1,.L4-.Llit(%r13) # load pointer to __libc_start_main
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
l %r12,.L5-.Llit(%r13) # load .got pointer
|
l %r12,.L5-.Llit(%r13) # load .got pointer
|
||||||
la %r6,0(%r13,%r6)
|
|
||||||
la %r5,0(%r13,%r5)
|
|
||||||
la %r12,0(%r13,%r12)
|
la %r12,0(%r13,%r12)
|
||||||
l %r2,0(%r12,%r2)
|
l %r2,0(%r12,%r2)
|
||||||
la %r1,0(%r13,%r1)
|
la %r1,0(%r13,%r1)
|
||||||
#endif
|
#endif
|
||||||
|
lhi %r6, 0 # Used to fini.
|
||||||
|
lhi %r5, 0 # Used to init.
|
||||||
|
|
||||||
/* ok, now branch to the libc main routine */
|
/* ok, now branch to the libc main routine */
|
||||||
basr %r14,%r1
|
basr %r14,%r1
|
||||||
@ -197,13 +195,9 @@ _start:
|
|||||||
cfi_endproc
|
cfi_endproc
|
||||||
.Llit:
|
.Llit:
|
||||||
#ifndef PIC
|
#ifndef PIC
|
||||||
.L1: .long __libc_csu_init
|
|
||||||
.L2: .long __libc_csu_fini
|
|
||||||
.L3: .long main
|
.L3: .long main
|
||||||
.L4: .long __libc_start_main
|
.L4: .long __libc_start_main
|
||||||
#else
|
#else
|
||||||
.L1: .long __libc_csu_init-.Llit
|
|
||||||
.L2: .long __libc_csu_fini-.Llit
|
|
||||||
.L3: .long main@GOT
|
.L3: .long main@GOT
|
||||||
.L4: .long __libc_start_main@plt-.Llit
|
.L4: .long __libc_start_main@plt-.Llit
|
||||||
.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
|
.L5: .long _GLOBAL_OFFSET_TABLE_-.Llit
|
||||||
|
@ -80,8 +80,8 @@ _start:
|
|||||||
*/
|
*/
|
||||||
stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
|
stmg %r14,%r15,160(%r15) # store rtld_fini/stack_end to parameter area
|
||||||
la %r7,160(%r15)
|
la %r7,160(%r15)
|
||||||
larl %r6,__libc_csu_fini # load pointer to __libc_csu_fini
|
lghi %r6,0 # Used to be fini.
|
||||||
larl %r5,__libc_csu_init # load pointer to __libc_csu_init
|
lghi %r5,0 # Used to be init.
|
||||||
|
|
||||||
/* Ok, now branch to the libc main routine. */
|
/* Ok, now branch to the libc main routine. */
|
||||||
#ifdef PIC
|
#ifdef PIC
|
||||||
|
@ -70,12 +70,11 @@ _start:
|
|||||||
|
|
||||||
/* Push the last arguments to main() onto the stack */
|
/* Push the last arguments to main() onto the stack */
|
||||||
mov.l r4,@-r15
|
mov.l r4,@-r15
|
||||||
mov.l L_fini,r0
|
mov.l r14,@-r15 /* Used to be fini. */
|
||||||
mov.l r0,@-r15
|
|
||||||
|
|
||||||
/* Set up the other arguments for main() that go in registers */
|
/* Set up the other arguments for main() that go in registers */
|
||||||
mov.l L_main,r4
|
mov.l L_main,r4
|
||||||
mov.l L_init,r7
|
mov #0,r7 /* Used to be init. */
|
||||||
|
|
||||||
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
|
/* __libc_start_main (main, argc, argv, init, fini, rtld_fini) */
|
||||||
|
|
||||||
@ -90,10 +89,6 @@ _start:
|
|||||||
.align 2
|
.align 2
|
||||||
L_main:
|
L_main:
|
||||||
.long main
|
.long main
|
||||||
L_init:
|
|
||||||
.long __libc_csu_init
|
|
||||||
L_fini:
|
|
||||||
.long __libc_csu_fini
|
|
||||||
L_libc_start_main:
|
L_libc_start_main:
|
||||||
.long __libc_start_main
|
.long __libc_start_main
|
||||||
L_abort:
|
L_abort:
|
||||||
|
@ -59,22 +59,14 @@ _start:
|
|||||||
/* Load the addresses of the user entry points. */
|
/* Load the addresses of the user entry points. */
|
||||||
#ifndef PIC
|
#ifndef PIC
|
||||||
sethi %hi(main), %o0
|
sethi %hi(main), %o0
|
||||||
sethi %hi(__libc_csu_init), %o3
|
|
||||||
sethi %hi(__libc_csu_fini), %o4
|
|
||||||
or %o0, %lo(main), %o0
|
or %o0, %lo(main), %o0
|
||||||
or %o3, %lo(__libc_csu_init), %o3
|
|
||||||
or %o4, %lo(__libc_csu_fini), %o4
|
|
||||||
#else
|
#else
|
||||||
sethi %gdop_hix22(main), %o0
|
sethi %gdop_hix22(main), %o0
|
||||||
sethi %gdop_hix22(__libc_csu_init), %o3
|
|
||||||
sethi %gdop_hix22(__libc_csu_fini), %o4
|
|
||||||
xor %o0, %gdop_lox10(main), %o0
|
xor %o0, %gdop_lox10(main), %o0
|
||||||
xor %o3, %gdop_lox10(__libc_csu_init), %o3
|
|
||||||
xor %o4, %gdop_lox10(__libc_csu_fini), %o4
|
|
||||||
ld [%l7 + %o0], %o0, %gdop(main)
|
ld [%l7 + %o0], %o0, %gdop(main)
|
||||||
ld [%l7 + %o3], %o3, %gdop(__libc_csu_init)
|
|
||||||
ld [%l7 + %o4], %o4, %gdop(__libc_csu_fini)
|
|
||||||
#endif
|
#endif
|
||||||
|
mov 0, %o3 /* Used to be init. */
|
||||||
|
mov 0, %o4 /* Used to be fini. */
|
||||||
|
|
||||||
/* When starting a binary via the dynamic linker, %g1 contains the
|
/* When starting a binary via the dynamic linker, %g1 contains the
|
||||||
address of the shared library termination function, which will be
|
address of the shared library termination function, which will be
|
||||||
|
@ -60,22 +60,14 @@ _start:
|
|||||||
/* Load the addresses of the user entry points. */
|
/* Load the addresses of the user entry points. */
|
||||||
#ifndef PIC
|
#ifndef PIC
|
||||||
sethi %hi(main), %o0
|
sethi %hi(main), %o0
|
||||||
sethi %hi(__libc_csu_init), %o3
|
|
||||||
sethi %hi(__libc_csu_fini), %o4
|
|
||||||
or %o0, %lo(main), %o0
|
or %o0, %lo(main), %o0
|
||||||
or %o3, %lo(__libc_csu_init), %o3
|
|
||||||
or %o4, %lo(__libc_csu_fini), %o4
|
|
||||||
#else
|
#else
|
||||||
sethi %gdop_hix22(main), %o0
|
sethi %gdop_hix22(main), %o0
|
||||||
sethi %gdop_hix22(__libc_csu_init), %o3
|
|
||||||
sethi %gdop_hix22(__libc_csu_fini), %o4
|
|
||||||
xor %o0, %gdop_lox10(main), %o0
|
xor %o0, %gdop_lox10(main), %o0
|
||||||
xor %o3, %gdop_lox10(__libc_csu_init), %o3
|
|
||||||
xor %o4, %gdop_lox10(__libc_csu_fini), %o4
|
|
||||||
ldx [%l7 + %o0], %o0, %gdop(main)
|
ldx [%l7 + %o0], %o0, %gdop(main)
|
||||||
ldx [%l7 + %o3], %o3, %gdop(__libc_csu_init)
|
|
||||||
ldx [%l7 + %o4], %o4, %gdop(__libc_csu_fini)
|
|
||||||
#endif
|
#endif
|
||||||
|
mov 0, %o3 /* Used to be init. */
|
||||||
|
mov 0, %o4 /* Used to be fini. */
|
||||||
|
|
||||||
/* When starting a binary via the dynamic linker, %g1 contains the
|
/* When starting a binary via the dynamic linker, %g1 contains the
|
||||||
address of the shared library termination function, which will be
|
address of the shared library termination function, which will be
|
||||||
|
@ -2171,3 +2171,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -2253,6 +2253,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _IO_fprintf F
|
GLIBC_2.4 _IO_fprintf F
|
||||||
GLIBC_2.4 _IO_printf F
|
GLIBC_2.4 _IO_printf F
|
||||||
GLIBC_2.4 _IO_sprintf F
|
GLIBC_2.4 _IO_sprintf F
|
||||||
|
@ -1931,3 +1931,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -155,6 +155,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _Exit F
|
GLIBC_2.4 _Exit F
|
||||||
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
|
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
|
||||||
GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
|
GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
|
||||||
|
@ -152,6 +152,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _Exit F
|
GLIBC_2.4 _Exit F
|
||||||
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
|
GLIBC_2.4 _IO_2_1_stderr_ D 0xa0
|
||||||
GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
|
GLIBC_2.4 _IO_2_1_stdin_ D 0xa0
|
||||||
|
@ -2115,3 +2115,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -2074,6 +2074,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2241,6 +2241,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2106,6 +2106,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -156,6 +156,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _Exit F
|
GLIBC_2.4 _Exit F
|
||||||
GLIBC_2.4 _IO_2_1_stderr_ D 0x98
|
GLIBC_2.4 _IO_2_1_stderr_ D 0x98
|
||||||
GLIBC_2.4 _IO_2_1_stdin_ D 0x98
|
GLIBC_2.4 _IO_2_1_stdin_ D 0x98
|
||||||
|
@ -2186,6 +2186,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2166,3 +2166,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -2163,3 +2163,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -2157,6 +2157,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2155,6 +2155,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2163,6 +2163,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2157,6 +2157,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2204,3 +2204,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -41,12 +41,12 @@ struct startup_info
|
|||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
__libc_start_main (int argc, char **argv,
|
__libc_start_main_impl (int argc, char **argv,
|
||||||
char **ev,
|
char **ev,
|
||||||
ElfW (auxv_t) * auxvec,
|
ElfW (auxv_t) * auxvec,
|
||||||
void (*rtld_fini) (void),
|
void (*rtld_fini) (void),
|
||||||
struct startup_info *stinfo,
|
struct startup_info *stinfo,
|
||||||
char **stack_on_entry)
|
char **stack_on_entry)
|
||||||
{
|
{
|
||||||
/* the PPC SVR4 ABI says that the top thing on the stack will
|
/* the PPC SVR4 ABI says that the top thing on the stack will
|
||||||
be a NULL pointer, so if not we assume that we're being called
|
be a NULL pointer, so if not we assume that we're being called
|
||||||
@ -99,3 +99,4 @@ __libc_start_main (int argc, char **argv,
|
|||||||
stinfo->init, stinfo->fini, rtld_fini,
|
stinfo->init, stinfo->fini, rtld_fini,
|
||||||
stack_on_entry);
|
stack_on_entry);
|
||||||
}
|
}
|
||||||
|
DEFINE_LIBC_START_MAIN_VERSION
|
||||||
|
@ -2213,6 +2213,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _IO_fprintf F
|
GLIBC_2.4 _IO_fprintf F
|
||||||
GLIBC_2.4 _IO_printf F
|
GLIBC_2.4 _IO_printf F
|
||||||
GLIBC_2.4 _IO_sprintf F
|
GLIBC_2.4 _IO_sprintf F
|
||||||
|
@ -2246,6 +2246,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _IO_fprintf F
|
GLIBC_2.4 _IO_fprintf F
|
||||||
GLIBC_2.4 _IO_printf F
|
GLIBC_2.4 _IO_printf F
|
||||||
GLIBC_2.4 _IO_sprintf F
|
GLIBC_2.4 _IO_sprintf F
|
||||||
|
@ -2076,6 +2076,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _IO_fprintf F
|
GLIBC_2.4 _IO_fprintf F
|
||||||
GLIBC_2.4 _IO_printf F
|
GLIBC_2.4 _IO_printf F
|
||||||
GLIBC_2.4 _IO_sprintf F
|
GLIBC_2.4 _IO_sprintf F
|
||||||
|
@ -2366,3 +2366,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -1933,3 +1933,4 @@ GLIBC_2.33 wprintf F
|
|||||||
GLIBC_2.33 write F
|
GLIBC_2.33 write F
|
||||||
GLIBC_2.33 writev F
|
GLIBC_2.33 writev F
|
||||||
GLIBC_2.33 wscanf F
|
GLIBC_2.33 wscanf F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -2133,3 +2133,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -2211,6 +2211,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _IO_fprintf F
|
GLIBC_2.4 _IO_fprintf F
|
||||||
GLIBC_2.4 _IO_printf F
|
GLIBC_2.4 _IO_printf F
|
||||||
GLIBC_2.4 _IO_sprintf F
|
GLIBC_2.4 _IO_sprintf F
|
||||||
|
@ -2112,6 +2112,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _IO_fprintf F
|
GLIBC_2.4 _IO_fprintf F
|
||||||
GLIBC_2.4 _IO_printf F
|
GLIBC_2.4 _IO_printf F
|
||||||
GLIBC_2.4 _IO_sprintf F
|
GLIBC_2.4 _IO_sprintf F
|
||||||
|
@ -2081,6 +2081,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2078,6 +2078,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2202,6 +2202,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 _IO_fprintf F
|
GLIBC_2.4 _IO_fprintf F
|
||||||
GLIBC_2.4 _IO_printf F
|
GLIBC_2.4 _IO_printf F
|
||||||
GLIBC_2.4 _IO_sprintf F
|
GLIBC_2.4 _IO_sprintf F
|
||||||
|
@ -2129,6 +2129,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2088,6 +2088,7 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
GLIBC_2.4 __confstr_chk F
|
GLIBC_2.4 __confstr_chk F
|
||||||
GLIBC_2.4 __fgets_chk F
|
GLIBC_2.4 __fgets_chk F
|
||||||
GLIBC_2.4 __fgets_unlocked_chk F
|
GLIBC_2.4 __fgets_unlocked_chk F
|
||||||
|
@ -2185,3 +2185,4 @@ GLIBC_2.33 mknod F
|
|||||||
GLIBC_2.33 mknodat F
|
GLIBC_2.33 mknodat F
|
||||||
GLIBC_2.33 stat F
|
GLIBC_2.33 stat F
|
||||||
GLIBC_2.33 stat64 F
|
GLIBC_2.33 stat64 F
|
||||||
|
GLIBC_2.34 __libc_start_main F
|
||||||
|
@ -96,17 +96,13 @@ ENTRY (_start)
|
|||||||
which grow downwards). */
|
which grow downwards). */
|
||||||
pushq %rsp
|
pushq %rsp
|
||||||
|
|
||||||
#ifdef PIC
|
/* These used to be the addresses of .fini and .init. */
|
||||||
/* Pass address of our own entry points to .fini and .init. */
|
xorl %r8d, %r8d
|
||||||
mov __libc_csu_fini@GOTPCREL(%rip), %R8_LP
|
xorl %ecx, %ecx
|
||||||
mov __libc_csu_init@GOTPCREL(%rip), %RCX_LP
|
|
||||||
|
|
||||||
|
#ifdef PIC
|
||||||
mov main@GOTPCREL(%rip), %RDI_LP
|
mov main@GOTPCREL(%rip), %RDI_LP
|
||||||
#else
|
#else
|
||||||
/* Pass address of our own entry points to .fini and .init. */
|
|
||||||
mov $__libc_csu_fini, %R8_LP
|
|
||||||
mov $__libc_csu_init, %RCX_LP
|
|
||||||
|
|
||||||
mov $main, %RDI_LP
|
mov $main, %RDI_LP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user