summaryrefslogtreecommitdiff
path: root/csu
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-08-07 18:24:47 +0000
committerRoland McGrath <roland@gnu.org>1995-08-07 18:24:47 +0000
commit99a9e88e55c4cb46ce645aedac3e5d1a906dfd69 (patch)
tree41578c33d0c64ba2a51cf3f5df1109b782226f6d /csu
parent5e98d83c10427044f41fa3a48d49bbdd0e176b41 (diff)
Mon Aug 7 14:04:36 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* 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.
Diffstat (limited to 'csu')
-rw-r--r--csu/initfini.c14
1 files changed, 12 insertions, 2 deletions
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 <stdlib.h>
+
+#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. */