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. --- ChangeLog | 10 ++++++++++ conf/portability.h | 6 ++++++ config.make.in | 6 ++++-- csu/initfini.c | 14 ++++++++++++-- sysdeps/generic/sysd-stdio.c | 4 +++- 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6105a2e61..0feb593697 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +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. + Fri Aug 4 16:01:59 1995 Roland McGrath * Makefile (headers): Added gnu-versions.h. @@ -30,6 +35,9 @@ Wed Jul 26 02:00:29 1995 Roland McGrath [$(have-initfini)=yes]: Test this rather than $(elf) for crtstuff. [start-installed-name-rule]: If this is defined, elide rule for $(objpfx)$(start-installed-name). + * csu/initfini.c (SECTION): New macro, different definitions for + #ifdef HAVE_ELF and not. + (_init, _fini): Use that macro. * sysdeps/unix/sysv/sco3.2.4/Makefile [$(subdir)=csu] (start-installed-rule, start-installed-name-rule): New variables; specify crt1.o, created by our own rule. @@ -42,6 +50,7 @@ Wed Jul 26 02:00:29 1995 Roland McGrath * munch-tmpl.c [HAVE_INITFINI]: Call _init and atexit (_fini) in this case rather than #ifdef HAVE_ELF. * config.h.in (HAVE_INITFINI): New macro. + * config.make.in (have-initfini): New variable, set by configure. * stdio/vfscanf.c (conv_error): Simplify expression to avoid "value computed is not used" warning. @@ -78,6 +87,7 @@ Wed Jul 26 02:00:29 1995 Roland McGrath * inet/netdb.h: Incorporated from BIND 4.9.3-BETA24 release. [__GNU_LIBRARY__]: Include instead of repeating its declarations (and doing so only #ifdef sun!). + * conf/portability.h (NEED_INETADDR, NEED_INETATON): New macros. * posix/sys/types.h [__USE_BSD] (__BIT_TYPES_DEFINED__): New macro. [__USE_BSD] [__GNUC__] (int64_t, u_int64_t, register_t): New typedefs. diff --git a/conf/portability.h b/conf/portability.h index ab41b5d977..a3c6302544 100644 --- a/conf/portability.h +++ b/conf/portability.h @@ -18,3 +18,9 @@ #ifdef sun. */ #undef sun + +/* The source code copied from BIND for inet_addr/inet_aton + doesn't actually define the functions without these macros. */ + +#define NEED_INETADDR +#define NEED_INETATON diff --git a/config.make.in b/config.make.in index 0f974688a1..652f10ec13 100644 --- a/config.make.in +++ b/config.make.in @@ -14,11 +14,13 @@ config-sysdirs = @sysnames@ config-defines = @DEFS@ +elf = @elf@ +weak-symbols = @weak@ +have-initfini = @libc_cv_have_initfini@ + # Configuration options. gnu-as = @gnu_as@ gnu-ld = @gnu_ld@ -elf = @elf@ -weak-symbols = @weak@ build-shared = @shared@ build-profile = @profile@ build-omitfp = @omitfp@ 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. */ diff --git a/sysdeps/generic/sysd-stdio.c b/sysdeps/generic/sysd-stdio.c index fef0ed4d9a..7a3f7fc918 100644 --- a/sysdeps/generic/sysd-stdio.c +++ b/sysdeps/generic/sysd-stdio.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1994, 1995 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 @@ -174,6 +174,8 @@ DEFUN(__stdio_reopen, (filename, m, cookieptr), if (__stdio_open (filename, m, &newcookie)) return -1; } + else + return -1; } if (newcookie != *cookieptr) -- cgit v1.2.3