crtend.asm: Include "auto-host.h".

* config/ia64/crtend.asm: Include "auto-host.h".
        [HAVE_INITFINI_ARRAY]: Invoke __do_global_ctors_aux via .init_array.
        * config/ia64/crtbegin.asm: Similarly.
        * config/ia64/t-ia64 (crtbegin.o): Include from current directory.
        (crtend.o, crtbeginS.o, crtendS.o): Likewise.

        * aclocal.m4 (gcc_AC_INITFINI_ARRAY): New.
        * configure.in: Use it if --enable-initfini-array not specified.
        * doc/install.texi (Configuration): Document --enable-initfini-array.
        * configure, config.in: Rebuild.

From-SVN: r58909
This commit is contained in:
David Mosberger 2002-11-07 22:48:10 +00:00 committed by Richard Henderson
parent f72ab53b26
commit 07cf4226a7
9 changed files with 438 additions and 314 deletions

View File

@ -1,3 +1,16 @@
2002-11-07 David Mosberger <davidm@hpl.hp.com>
* config/ia64/crtend.asm: Include "auto-host.h".
[HAVE_INITFINI_ARRAY]: Invoke __do_global_ctors_aux via .init_array.
* config/ia64/crtbegin.asm: Similarly.
* config/ia64/t-ia64 (crtbegin.o): Include from current directory.
(crtend.o, crtbeginS.o, crtendS.o): Likewise.
* aclocal.m4 (gcc_AC_INITFINI_ARRAY): New.
* configure.in: Use it if --enable-initfini-array not specified.
* doc/install.texi (Configuration): Document --enable-initfini-array.
* configure, config.in: Rebuild.
2002-11-07 Jason Thorpe <thorpej@wasabisystems.com>
* config/arm/arm-protos.h (arm_get_frame_size)

26
gcc/aclocal.m4 vendored
View File

@ -1690,3 +1690,29 @@ strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
])
AC_DEFUN(gcc_AC_INITFINI_ARRAY,
[AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
gcc_cv_initfinit_array, [dnl
cat > conftest.c <<EOF
static int x = -1;
int main (void) { return x; }
int foo (void) { x = 0; }
int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
EOF
if AC_TRY_COMMAND([${CC-cc} -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
then
if ./conftest; then
gcc_cv_initfinit_array=yes
else
gcc_cv_initfinit_array=no
fi
else
gcc_cv_initfinit_array=no
fi
rm -f conftest*])
AC_SUBST(gcc_cv_initfinit_array)
if test $gcc_cv_initfinit_array = yes; then
AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
[Define .init_array/.fini_array sections are available and working.])
fi])

View File

@ -482,6 +482,9 @@
/* Define if <time.h> defines clock_t. */
#undef HAVE_CLOCK_T
/* Define .init_array/.fini_array sections are available and working. */
#undef HAVE_INITFINI_ARRAY
/* Define if host mkdir takes a single argument. */
#undef MKDIR_TAKES_ONE_ARG

View File

@ -16,6 +16,8 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "auto-host.h"
.section .ctors,"aw","progbits"
.align 8
__CTOR_LIST__:
@ -52,6 +54,15 @@ __dso_handle:
.hidden __dso_handle#
#ifdef HAVE_INITFINI_ARRAY
.section .fini_array,"a","progbits"
data8 @fptr(__do_global_dtors_aux)
.section .init_array,"a","progbits"
data8 @fptr(__do_jv_register_classes)
#else /* !HAVE_INITFINI_ARRAY */
/*
* Fragment of the ELF _fini routine that invokes our dtor cleanup.
*
@ -98,6 +109,7 @@ __dso_handle:
br.call.sptk.many b0 = b6
;;
}
#endif /* !HAVE_INITFINI_ARRAY */
.section .text
.align 16

View File

@ -16,6 +16,8 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "auto-host.h"
.section .ctors,"aw","progbits"
.align 8
__CTOR_END__:
@ -31,6 +33,12 @@ __DTOR_END__:
__JCR_END__:
data8 0
#ifdef HAVE_INITFINI_ARRAY
.section .init_array,"a","progbits"
data8 @fptr(__do_global_ctors_aux)
#else /* !HAVE_INITFINI_ARRAY */
/*
* Fragment of the ELF _init routine that invokes our dtor cleanup.
*
@ -59,6 +67,7 @@ __JCR_END__:
br.call.sptk.many b0 = b6
;;
}
#endif /* !HAVE_INITFINI_ARRAY */
.text
.align 16

View File

@ -24,15 +24,21 @@ T = disable
# Assemble startup files.
crtbegin.o: $(srcdir)/config/ia64/crtbegin.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crtbegin.o -x assembler-with-cpp $(srcdir)/config/ia64/crtbegin.asm
$(GCC_FOR_TARGET) -I. -c -o crtbegin.o -x assembler-with-cpp \
$(srcdir)/config/ia64/crtbegin.asm
crtend.o: $(srcdir)/config/ia64/crtend.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -c -o crtend.o -x assembler-with-cpp $(srcdir)/config/ia64/crtend.asm
$(GCC_FOR_TARGET) -I. -c -o crtend.o -x assembler-with-cpp \
$(srcdir)/config/ia64/crtend.asm
crtbeginS.o: $(srcdir)/config/ia64/crtbegin.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -DSHARED -c -o crtbeginS.o -x assembler-with-cpp $(srcdir)/config/ia64/crtbegin.asm
$(GCC_FOR_TARGET) -I. -DSHARED -c -o crtbeginS.o \
-x assembler-with-cpp \
$(srcdir)/config/ia64/crtbegin.asm
crtendS.o: $(srcdir)/config/ia64/crtend.asm $(GCC_PASSES)
$(GCC_FOR_TARGET) -DSHARED -c -o crtendS.o -x assembler-with-cpp $(srcdir)/config/ia64/crtend.asm
$(GCC_FOR_TARGET) -I. -DSHARED -c -o crtendS.o -x assembler-with-cpp \
$(srcdir)/config/ia64/crtend.asm
crtfastmath.o: $(srcdir)/config/ia64/crtfastmath.c $(GCC_PASSES)
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o crtfastmath.o $(srcdir)/config/ia64/crtfastmath.c
$(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o crtfastmath.o \
$(srcdir)/config/ia64/crtfastmath.c
LIB2ADDEH = $(srcdir)/config/ia64/unwind-ia64.c $(srcdir)/unwind-sjlj.c

661
gcc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -744,6 +744,10 @@ if test $gcc_cv_type_clock_t = yes; then
[Define if <time.h> defines clock_t.])
fi
AC_ARG_ENABLE(initfini-array,
[ --enable-initfini-array use .init_array/.fini_array sections],
gcc_cv_initfinit_array=$enableval, [gcc_AC_INITFINI_ARRAY])
# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
CFLAGS="$saved_CFLAGS"

View File

@ -741,6 +741,14 @@ Specify that a user visible @command{cpp} program should not be installed.
Specify that the user visible @command{cpp} program should be installed
in @file{@var{prefix}/@var{dirname}/cpp}, in addition to @var{bindir}.
@item --enable-initfini-array
Force the use of sections @code{.init_array} and @code{.fini_array}
(instead of @code{.init} and @code{.fini}) for constructors and
destructors. Option @option{--disable-initfini-array} has the
opposite effect. If neither option is specified, the configure script
will try to guess whether the @code{.init_array} and
@code{.fini_array} sections are supported and, if they are, use them.
@item --enable-maintainer-mode
The build rules that
regenerate the GCC master message catalog @file{gcc.pot} are normally