From 99a9e88e55c4cb46ce645aedac3e5d1a906dfd69 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 7 Aug 1995 18:24:47 +0000 Subject: Mon Aug 7 14:04:36 1995 Roland McGrath * sysdeps/generic/sysd-stdio.c (__stdio_reopen): Return failure when __stdio_open fails with a code other than ENFILE or EMFILE. * csu/initfini.c (SECTION): New macro, different definitions for #ifdef HAVE_ELF and not. (_init, _fini): Use that macro. * config.make.in (have-initfini): New variable, set by configure. * conf/portability.h (NEED_INETADDR, NEED_INETATON): New macros. --- csu/initfini.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'csu') diff --git a/csu/initfini.c b/csu/initfini.c index 1da5e2721a..8dcd30a008 100644 --- a/csu/initfini.c +++ b/csu/initfini.c @@ -34,12 +34,22 @@ Cambridge, MA 02139, USA. */ #include + +#ifdef HAVE_ELF /* These declarations make the functions go in the right sections when we define them below. GCC syntax does not allow the attribute specifications to be in the function definitions themselves. */ void _init (void) __attribute__ ((section (".init"))); void _fini (void) __attribute__ ((section (".fini"))); +#define SECTION(x) /* Put nothing extra before the defn. */ + +#else +/* Some non-ELF systems support .init and .fini sections, + but the __attribute__ syntax only works for ELF. */ +#define SECTION(x) asm (".section " x); +#endif + /* End the here document containing the initial common code. Then move the output file crtcommon.tmp to crti.s-new and crtn.s-new. */ asm ("\nEOF_common\n\ @@ -48,10 +58,10 @@ cp -f crti.s-new crtn.s-new"); /* Append the .init prologue to crti.s-new. */ asm ("cat >> crti.s-new <<\\EOF.crti.init"); +SECTION (".init") void _init (void) { - (void) &_init; /* Don't optimize out the function! */ /* End the here document containing the .init prologue code. Then fetch the .section directive just written and append that to crtn.s-new, followed by the function epilogue. */ @@ -67,10 +77,10 @@ asm ("\nEOF.crtn.init\ \n\ cat >> crti.s-new <<\\EOF.crti.fini"); +SECTION (".fini") void _fini (void) { - (void) &_fini; /* Don't optimize out the function! */ /* End the here document containing the .fini prologue code. Then fetch the .section directive just written and append that to crtn.s-new, followed by the function epilogue. */ -- cgit 1.4.1