mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-30 06:21:07 +00:00
74bd2300b5
2001-10-02 Jakub Jelinek <jakub@redhat.com> H.J. Lu <hjl@gnu.org> * configure.in (libc_cv_gcc_static_libgcc): Set to -static-libgcc if gcc supports this flag. (EXPORT_UNWIND_FIND_FDE): Define unless target configure disables it. (gcc3): Allow glibc to be compiled with gcc 3.x. * config.h.in (EXPORT_UNWIND_FIND_FDE): Add. * config.make.in (static-libgcc, unwind-find-fde): Add. * Makerules (build-shlib-helper, build-module-helper): Use it. * scripts/versions.awk: Make sure GLIBC_ versions come first. * elf/soinit.c (__libc_global_ctors): Set tbases and dbases if necessary. (_fini): Call __deregister_frame_info_bases if __register_frame_info_bases was used to register. * elf/Versions (__register_frame_info, __deregister_frame_info): Add for GLIBC_2.0. (__register_frame_info_bases, __register_frame_info_table_bases, __deregister_frame_info_bases, _Unwind_Find_FDE): Add for GLIBC_2.2.5. * elf/Makefile (routines): Add unwind-dw2-fde. (shared-only-routines): Add unwind-dw2-fde. * sysdeps/alpha/gccframe.h: New file. * sysdeps/arm/gccframe.h: New file. * sysdeps/generic/framestate.c: New file. * sysdeps/generic/dwarf2.h: New file. * sysdeps/generic/gccframe.h (struct object): Update from gcc 3.0. * sysdeps/generic/unwind-dw2-fde.c: New file. * sysdeps/unix/sysv/linux/ia64/unwind-dw2-fde.c: New file. * sysdeps/generic/unwind-dw2-fde.h: New file. * sysdeps/generic/unwind-dw2.c: New file. * sysdeps/generic/unwind-pe.h: New file. * sysdeps/generic/unwind.h: New file. * sysdeps/hppa/gccframe.h: New file. * sysdeps/i386/gccframe.h: New file. * sysdeps/m68k/gccframe.h: New file. * sysdeps/mips/gccframe.h: New file. * sysdeps/powerpc/gccframe.h: New file. * sysdeps/s390/gccframe.h: New file. * sysdeps/sh/gccframe.h: New file. * sysdeps/sparc/gccframe.h: New file. * sysdeps/vax/gccframe.h: New file. * sysdeps/unix/sysv/linux/configure.in (libc_cv_gcc_unwind_find_fde): Set on all architectures except ia64. * sysdeps/mach/hurd/configure.in (libc_cv_gcc_unwind_find_fde): Set for i386. * sysdeps/mach/hurd/i386/Versions (__register_frame_info, __deregister_frame_info): Move to elf/Versions. * sysdeps/unix/sysv/linux/m68k/Versions: Likewise. * sysdeps/unix/sysv/linux/arm/Versions: Likewise. * sysdeps/unix/sysv/linux/alpha/Versions: Likewise. * sysdeps/unix/sysv/linux/i386/Versions: Likewise. * sysdeps/unix/sysv/linux/mips/Versions: Likewise. * sysdeps/unix/sysv/linux/powerpc/Versions: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Versions: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/Versions: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/Versions: Likewise. * sysdeps/mach/hurd/i386/Makefile (sysdep-routines): Add framestate. * sysdeps/unix/sysv/linux/arm/Makefile: Likewise. * sysdeps/unix/sysv/linux/alpha/Makefile: Likewise. * sysdeps/unix/sysv/linux/i386/Makefile: Likewise. * sysdeps/unix/sysv/linux/m68k/Makefile: Likewise. * sysdeps/unix/sysv/linux/mips/Makefile: Likewise. * sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile: Likewise. * sysdeps/unix/sysv/linux/sparc/Makefile: Likewise. * sysdeps/unix/sysv/linux/ia64/ldd-rewrite.sed: New file. * sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed: New file. * sysdeps/generic/strnlen.c: New file.
99 lines
2.5 KiB
C
99 lines
2.5 KiB
C
/* Initializer module for building the ELF shared C library. This file and
|
|
sofini.c do the work normally done by crtbeginS.o and crtendS.o, to wrap
|
|
the `.ctors' and `.dtors' sections so the lists are terminated, and
|
|
calling those lists of functions. */
|
|
|
|
#include <libc-internal.h>
|
|
#include <stdlib.h>
|
|
|
|
#ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
|
|
# include <gccframe.h>
|
|
#endif
|
|
|
|
static void (*const __CTOR_LIST__[1]) (void)
|
|
__attribute__ ((section (".ctors")))
|
|
= { (void (*) (void)) -1 };
|
|
static void (*const __DTOR_LIST__[1]) (void)
|
|
__attribute__ ((section (".dtors")))
|
|
= { (void (*) (void)) -1 };
|
|
|
|
static inline void
|
|
run_hooks (void (*const list[]) (void))
|
|
{
|
|
while (*++list)
|
|
(**list) ();
|
|
}
|
|
|
|
#ifdef HAVE_DWARF2_UNWIND_INFO
|
|
static char __EH_FRAME_BEGIN__[]
|
|
__attribute__ ((section (".eh_frame")))
|
|
= { };
|
|
# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
|
|
extern void __register_frame_info (const void *, struct object *);
|
|
extern void __register_frame_info_bases (const void *, struct object *,
|
|
void *, void *);
|
|
extern void __deregister_frame_info (const void *);
|
|
extern void __deregister_frame_info_bases (const void *);
|
|
# else
|
|
extern void __register_frame (const void *);
|
|
extern void __deregister_frame (const void *);
|
|
# endif
|
|
#endif
|
|
|
|
/* This function will be called from _init in init-first.c. */
|
|
void
|
|
__libc_global_ctors (void)
|
|
{
|
|
/* Call constructor functions. */
|
|
run_hooks (__CTOR_LIST__);
|
|
|
|
#ifdef HAVE_DWARF2_UNWIND_INFO
|
|
# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
|
|
{
|
|
static struct object ob;
|
|
# if defined CRT_GET_RFIB_TEXT || defined CRT_GET_RFIB_DATA
|
|
void *tbase, *dbase;
|
|
|
|
# ifdef CRT_GET_RFIB_TEXT
|
|
CRT_GET_RFIB_TEXT (tbase);
|
|
# else
|
|
tbase = NULL;
|
|
# endif
|
|
# ifdef CRT_GET_RFIB_DATA
|
|
CRT_GET_RFIB_DATA (dbase);
|
|
# else
|
|
dbase = NULL;
|
|
# endif
|
|
__register_frame_info_bases (__EH_FRAME_BEGIN__, &ob, tbase, dbase);
|
|
# else
|
|
__register_frame_info (__EH_FRAME_BEGIN__, &ob);
|
|
# endif
|
|
}
|
|
# else
|
|
__register_frame (__EH_FRAME_BEGIN__);
|
|
# endif
|
|
#endif
|
|
}
|
|
|
|
|
|
/* This function becomes the DT_FINI termination function
|
|
for the C library. */
|
|
void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks. */
|
|
void
|
|
_fini (void)
|
|
{
|
|
/* Call destructor functions. */
|
|
run_hooks (__DTOR_LIST__);
|
|
#ifdef HAVE_DWARF2_UNWIND_INFO
|
|
# ifdef HAVE_DWARF2_UNWIND_INFO_STATIC
|
|
# if defined CRT_GET_RFIB_TEXT || defined CRT_GET_RFIB_DATA
|
|
__deregister_frame_info_bases (__EH_FRAME_BEGIN__);
|
|
# else
|
|
__deregister_frame_info (__EH_FRAME_BEGIN__);
|
|
# endif
|
|
# else
|
|
__deregister_frame (__EH_FRAME_BEGIN__);
|
|
# endif
|
|
#endif
|
|
}
|