From ce33ee7caabb2803294ad7aa8108b039cc00c748 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 5 Nov 2005 17:46:24 +0000 Subject: [PATCH] * configure.in: If init_array/fini_array support is not available, bail out. * config.h.in: Remove trace of optional init_array/fini_array support. * config.make.in: Likewise. * csu/elf-init.c: Likewise. * dlfcn/dlfcn.c: Likewise. * elf/soinit.c: Likewise. * sysdeps/ia64/elf/initfinit.c: Likewise. --- ChangeLog | 11 +++ config.h.in | 4 -- config.make.in | 1 - configure | 25 +++---- configure.in | 13 ++-- csu/elf-init.c | 19 ++--- dlfcn/dlfcn.c | 10 +-- elf/soinit.c | 9 +-- nptl/ChangeLog | 5 ++ nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c | 95 +------------------------ sysdeps/ia64/elf/initfini.c | 24 +------ 11 files changed, 46 insertions(+), 170 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ecc943429..1f8267d63c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-11-05 Ulrich Drepper + + * configure.in: If init_array/fini_array support is not available, + bail out. + * config.h.in: Remove trace of optional init_array/fini_array support. + * config.make.in: Likewise. + * csu/elf-init.c: Likewise. + * dlfcn/dlfcn.c: Likewise. + * elf/soinit.c: Likewise. + * sysdeps/ia64/elf/initfinit.c: Likewise. + 2005-11-04 Roland McGrath * sysdeps/i386/configure.in (libc_mtune_example): Variable removed. diff --git a/config.h.in b/config.h.in index 552523a83e..261ee73f04 100644 --- a/config.h.in +++ b/config.h.in @@ -158,10 +158,6 @@ /* Define if binutils support TLS handling. */ #undef HAVE_TLS_SUPPORT -/* Define if the linker supports .preinit_array/.init_array/.fini_array - sections. */ -#undef HAVE_INITFINI_ARRAY - /* Define if the compiler's exception support is based on libunwind. */ #undef HAVE_CC_WITH_LIBUNWIND diff --git a/config.make.in b/config.make.in index 3687507a17..e701212e99 100644 --- a/config.make.in +++ b/config.make.in @@ -53,7 +53,6 @@ with-fp = @with_fp@ with-cvs = @with_cvs@ old-glibc-headers = @old_glibc_headers@ unwind-find-fde = @libc_cv_gcc_unwind_find_fde@ -have-initfini-array = @libc_cv_initfinit_array@ have-cpp-asm-debuginfo = @libc_cv_cpp_asm_debuginfo@ enable-check-abi = @enable_check_abi@ have-forced-unwind = @libc_cv_forced_unwind@ diff --git a/configure b/configure index 69d7575af1..3c06983fbd 100755 --- a/configure +++ b/configure @@ -313,7 +313,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -5387,7 +5387,7 @@ _ACEOF echo "$as_me:$LINENO: checking for .preinit_array/.init_array/.fini_array support" >&5 echo $ECHO_N "checking for .preinit_array/.init_array/.fini_array support... $ECHO_C" >&6 -if test "${libc_cv_initfinit_array+set}" = set; then +if test "${libc_cv_initfini_array+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.c < /dev/null; then - libc_cv_initfinit_array=yes + libc_cv_initfini_array=yes else - libc_cv_initfinit_array=no + libc_cv_initfini_array=no fi else - libc_cv_initfinit_array=no + libc_cv_initfini_array=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $libc_cv_initfinit_array" >&5 -echo "${ECHO_T}$libc_cv_initfinit_array" >&6 - - if test $libc_cv_initfinit_array = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_INITFINI_ARRAY 1 -_ACEOF - +echo "$as_me:$LINENO: result: $libc_cv_initfini_array" >&5 +echo "${ECHO_T}$libc_cv_initfini_array" >&6 + if test $libc_cv_initfini_array != yes; then + { { echo "$as_me:$LINENO: error: Need linker with .init_array/.fini_array support." >&5 +echo "$as_me: error: Need linker with .init_array/.fini_array support." >&2;} + { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: checking for libunwind-support in compiler" >&5 @@ -8454,7 +8452,6 @@ s,@INSTALL_INFO@,$INSTALL_INFO,;t t s,@BISON@,$BISON,;t t s,@VERSIONING@,$VERSIONING,;t t s,@libc_cv_asm_protected_directive@,$libc_cv_asm_protected_directive,;t t -s,@libc_cv_initfinit_array@,$libc_cv_initfinit_array,;t t s,@libc_cv_cc_with_libunwind@,$libc_cv_cc_with_libunwind,;t t s,@libc_cv_z_nodelete@,$libc_cv_z_nodelete,;t t s,@libc_cv_z_nodlopen@,$libc_cv_z_nodlopen,;t t diff --git a/configure.in b/configure.in index 576e0c8815..dae24b503b 100644 --- a/configure.in +++ b/configure.in @@ -1257,7 +1257,7 @@ EOF fi AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support, - libc_cv_initfinit_array, [dnl + libc_cv_initfini_array, [dnl cat > conftest.c <&AS_MESSAGE_LOG_FD]) then if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then - libc_cv_initfinit_array=yes + libc_cv_initfini_array=yes else - libc_cv_initfinit_array=no + libc_cv_initfini_array=no fi else - libc_cv_initfinit_array=no + libc_cv_initfini_array=no fi rm -f conftest*]) - AC_SUBST(libc_cv_initfinit_array) - if test $libc_cv_initfinit_array = yes; then - AC_DEFINE(HAVE_INITFINI_ARRAY) + if test $libc_cv_initfini_array != yes; then + AC_MSG_ERROR([Need linker with .init_array/.fini_array support.]) fi AC_CACHE_CHECK(for libunwind-support in compiler, diff --git a/csu/elf-init.c b/csu/elf-init.c index 4343b8a1ab..27eae1550b 100644 --- a/csu/elf-init.c +++ b/csu/elf-init.c @@ -36,7 +36,7 @@ #include -#ifdef HAVE_INITFINI_ARRAY + /* These magic symbols are provided by the linker. */ extern void (*__preinit_array_start []) (int, char **, char **) attribute_hidden; @@ -48,7 +48,7 @@ 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; -#endif + /* These function symbols are provided for the .init/.fini section entry points automagically by the linker. */ @@ -63,11 +63,10 @@ extern void _fini (void); void __libc_csu_init (int argc, char **argv, char **envp) { -#ifdef HAVE_INITFINI_ARRAY /* For dynamically linked executables the preinit array is executed by the dynamic linker (before initializing any shared object. */ -# ifndef LIBC_NONSHARED +#ifndef LIBC_NONSHARED /* For static executables, preinit happens rights before init. */ { const size_t size = __preinit_array_end - __preinit_array_start; @@ -75,19 +74,13 @@ __libc_csu_init (int argc, char **argv, char **envp) for (i = 0; i < size; i++) (*__preinit_array_start [i]) (argc, argv, envp); } -# endif #endif _init (); -#ifdef HAVE_INITFINI_ARRAY - { - const size_t size = __init_array_end - __init_array_start; - size_t i; - for (i = 0; i < size; i++) + 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); - } -#endif } /* This function should not be used anymore. We run the executable's @@ -97,11 +90,9 @@ void __libc_csu_fini (void) { #ifndef LIBC_NONSHARED -# ifdef HAVE_INITFINI_ARRAY size_t i = __fini_array_end - __fini_array_start; while (i-- > 0) (*__fini_array_start [i]) (); -# endif _fini (); #endif diff --git a/dlfcn/dlfcn.c b/dlfcn/dlfcn.c index 8047150763..1ee225ba47 100644 --- a/dlfcn/dlfcn.c +++ b/dlfcn/dlfcn.c @@ -23,7 +23,7 @@ int __dlfcn_argc attribute_hidden; char **__dlfcn_argv attribute_hidden; -#ifdef HAVE_INITFINI_ARRAY + static void init (int argc, char *argv[]) { @@ -33,7 +33,7 @@ init (int argc, char *argv[]) static void (*const init_array []) (int argc, char *argv[]) __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) - __attribute_used__ = { init }; -#else -# error "Need linker with .init_array support." -#endif + __attribute_used__ = +{ + init +}; diff --git a/elf/soinit.c b/elf/soinit.c index 2015ea2d66..29e4707ceb 100644 --- a/elf/soinit.c +++ b/elf/soinit.c @@ -78,14 +78,8 @@ __libc_global_ctors (void) /* This function becomes the DT_FINI termination function for the C library. */ -#ifndef HAVE_INITFINI_ARRAY -void _fini (void) __attribute__ ((section (".fini"))); /* Just for kicks. */ -void -_fini (void) -#else void __libc_fini (void) -#endif { /* Call destructor functions. */ run_hooks (__DTOR_LIST__); @@ -101,7 +95,6 @@ __libc_fini (void) # endif #endif } -#ifdef HAVE_INITFINI_ARRAY + void (*_fini_ptr) (void) __attribute__ ((section (".fini_array"))) = &__libc_fini; -#endif diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 9167a137f1..c42be9ae7a 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2005-11-05 Ulrich Drepper + + * sysdeps/unix/sysv/linux/ia64/pt-initfini.c: Remove trace of + optional init_array/fini_array support. + 2005-10-24 Roland McGrath * sysdeps/unix/sysv/linux/x86_64/sem_trywait.S: Remove unnecessary diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c b/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c index b7d4e57945..b6d2cec0d0 100644 --- a/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c +++ b/nptl/sysdeps/unix/sysv/linux/ia64/pt-initfini.c @@ -1,5 +1,5 @@ /* Special .init and .fini section support for ia64. NPTL version. - Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it @@ -38,7 +38,6 @@ #include -#ifdef HAVE_INITFINI_ARRAY __asm__ ("\n\ #include \"defs.h\"\n\ @@ -49,95 +48,3 @@ __asm__ ("\n\ .xdata8 \".init_array\",@fptr(__pthread_initialize_minimal_internal)\n\ /*@_init_PROLOG_ENDS*/\n\ "); - -#else - -__asm__ ("\n\ -\n\ -#include \"defs.h\"\n\ -\n\ -/*@HEADER_ENDS*/\n\ -\n\ -/*@_init_PROLOG_BEGINS*/\n\ - .section .init\n\ - .align 16\n\ - .global _init#\n\ - .proc _init#\n\ -_init:\n\ - .prologue\n\ - .save ar.pfs, r34\n\ - alloc r34 = ar.pfs, 0, 3, 0, 0\n\ - .vframe r32\n\ - mov r32 = r12\n\ - .save rp, r33\n\ - mov r33 = b0\n\ - .body\n\ - adds r12 = -16, r12\n\ - ;;\n\ - st8 [r12] = gp, -16\n\ - br.call.sptk.many b0 = __pthread_initialize_minimal_internal# ;;\n\ - ;;\n\ - adds r12 = 16, r12\n\ - ;;\n\ - ld8 gp = [r12]\n\ - ;;\n\ - .endp _init#\n\ -\n\ -/*@_init_PROLOG_ENDS*/\n\ -\n\ -/*@_init_EPILOG_BEGINS*/\n\ - .section .init\n\ - .proc _init#\n\ - .prologue\n\ - .save ar.pfs, r34\n\ - .vframe r32\n\ - .save rp, r33\n\ - .body\n\ - mov r12 = r32\n\ - mov ar.pfs = r34\n\ - mov b0 = r33\n\ - br.ret.sptk.many b0\n\ - .endp _init#\n\ -/*@_init_EPILOG_ENDS*/\n\ -\n\ -/*@_fini_PROLOG_BEGINS*/\n\ - .section .fini\n\ - .align 16\n\ - .global _fini#\n\ - .proc _fini#\n\ -_fini:\n\ - .prologue\n\ - .save ar.pfs, r34\n\ - alloc r34 = ar.pfs, 0, 3, 0, 0\n\ - .vframe r32\n\ - mov r32 = r12\n\ - .save rp, r33\n\ - mov r33 = b0\n\ - .body\n\ - adds r12 = -16, r12\n\ - ;;\n\ - .endp _fini#\n\ -\n\ -/*@_fini_PROLOG_ENDS*/\n\ -\n\ -/*@_fini_EPILOG_BEGINS*/\n\ - .section .fini\n\ - .proc _fini#\n\ - .prologue\n\ - .save ar.pfs, r34\n\ - .vframe r32\n\ - .save rp, r33\n\ - .body\n\ - mov r12 = r32\n\ - mov ar.pfs = r34\n\ - mov b0 = r33\n\ - br.ret.sptk.many b0\n\ - .endp _fini#\n\ -\n\ -/*@_fini_EPILOG_ENDS*/\n\ -\n\ -/*@TRAILER_BEGINS*/\n\ - .weak __gmon_start__#\n\ -"); - -#endif diff --git a/sysdeps/ia64/elf/initfini.c b/sysdeps/ia64/elf/initfini.c index 3aa44de8f1..d0a65ece80 100644 --- a/sysdeps/ia64/elf/initfini.c +++ b/sysdeps/ia64/elf/initfini.c @@ -1,5 +1,5 @@ /* Special .init and .fini section support for ia64. - Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2003, 2005 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 @@ -51,7 +51,6 @@ __asm__ ("\n\n" "\n" "/*@_init_PROLOG_BEGINS*/\n"); -#ifdef HAVE_INITFINI_ARRAY /* If we have working .init_array support, we want to keep the .init section empty (apart from the mandatory prologue/epilogue. This @@ -75,7 +74,6 @@ gmon_initializer (void) __asm__ (".section .init_array, \"aw\"\n" "\tdata8 @fptr(gmon_initializer)\n"); -#endif __asm__ (".section .init\n" " .global _init#\n" @@ -90,27 +88,7 @@ __asm__ (".section .init\n" " mov r33 = b0\n" " .body\n" " adds r12 = -16, r12\n" -#ifdef HAVE_INITFINI_ARRAY " ;;\n" /* see gmon_initializer() above */ -#else -" .weak __gmon_start__#\n" -" addl r14 = @ltoff(@fptr(__gmon_start__#)), gp\n" -" ;;\n" -" ld8 r15 = [r14]\n" -" ;;\n" -" cmp.eq p6, p7 = 0, r15\n" -" (p6) br.cond.dptk .L5\n" -"\n" -"/* we could use r35 to save gp, but we use the stack since that's what\n" -" * all the other init routines will do --davidm 00/04/05 */\n" -" st8 [r12] = gp, -16\n" -" br.call.sptk.many b0 = __gmon_start__# ;;\n" -" adds r12 = 16, r12\n" -" ;;\n" -" ld8 gp = [r12]\n" -" ;;\n" -".L5:\n" -#endif " .endp _init#\n" "\n" "/*@_init_PROLOG_ENDS*/\n" -- 2.11.4.GIT