From b236e99d90748f6caf77994e96dc5aaa48ce2993 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 28 Aug 1996 00:26:07 +0000 Subject: Upadte. Tue Aug 27 17:45:21 1996 Ulrich Drepper * Makerules: Add some test for correct version of GNU Make. * io/fcntl.h: Undo change from Mon Aug 26 22:22:17 1996. * sysdeps/unix/sysv/linux/fcntlbits.h: Place macros here instead. * sysdeps/generic/dl-sysdep.c: Initialize break address to avoid overwriting last page (OK, Roland). Tue Aug 27 16:20:37 1996 Ulrich Drepper * resolv/resolv.h: Update from BIND-4.9.5-T3A. * resolv/arpa/nameser.h: Likewise. * resolv/res_init.c: Likewise. * resolv/res_debug.c: Likewise. * resolv/res_mkquery.c: Likewise. Tue Aug 27 15:47:04 1996 Ulrich Drepper * elf/dl-error.c (catch): Define errstring element not as const. (_dl_catch_error): ERRSTRING argument is not const pointer. Initialize *ERRSTRING and *OBJNAME separately. * elf/link.h: Change prototype for `_dl_catch_error'. * elf/dl-load.c (_dl_map_object): Use separate variable for copied NAME to avoid `const' warning. * elf/dlerror.c: Make `last_errstring' variable not const pointer. * elf/rtld.c: Implement reading of /etc/ld.so.preload. This provides preloading even for SUID binaries. Add some more casts to avoid signed<->unsigned warnings. Tue Aug 27 15:40:28 1996 NIIBE Yutaka * posix/sys/types.h: Define loff_t. * sysdeps/unix/sysv/linux/gnu/types.h: Define __loff_t. Mon Aug 26 16:31:33 1996 Thomas Bushnell, n/BSG * sysdeps/mach/hurd/setitimer.c (setitimer_locked): Tolerate NEW being null; in that case don't touch the timer at all (but do return something in OLD if necessary). Mon Aug 26 13:35:16 1996 Thomas Bushnell, n/BSG * sysdeps/mach/hurd/i386/init-first.c (__libc_multiple_libcs): New variable. * sysdeps/i386/init-first.c: Likewise. * sysdeps/stub/init-first.c: Likewise. --- ChangeLog | 57 ++++++++++++++++++++++++++++++++++++++---- Makerules | 12 +++++++-- config.make.in | 1 + configure.in | 17 +++++++++++++ csu/Makefile | 2 +- elf/rtld.c | 14 ----------- gmon/gmon.c | 4 +-- io/fcntl.h | 9 +++++++ misc/Makefile | 3 +++ misc/init-misc.c | 7 +++++- sysdeps/alpha/dl-machine.h | 6 ++++- sysdeps/generic/machine-gmon.h | 4 +-- sysdeps/generic/sbrk.c | 18 +++++++++++-- sysdeps/mach/hurd/getcwd.c | 6 ++++- sysdeps/posix/profil.c | 14 ++++++++--- 15 files changed, 139 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ea44b01e1..875cabc365 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Tue Aug 27 17:45:21 1996 Ulrich Drepper + + * Makerules: Add some test for correct version of GNU Make. + + * io/fcntl.h: Undo change from Mon Aug 26 22:22:17 1996. + * sysdeps/unix/sysv/linux/fcntlbits.h: Place macros here instead. + + * sysdeps/generic/dl-sysdep.c: Initialize break address to + avoid overwriting last page (OK, Roland). + +Tue Aug 27 16:20:37 1996 Ulrich Drepper + + * resolv/resolv.h: Update from BIND-4.9.5-T3A. + * resolv/arpa/nameser.h: Likewise. + * resolv/res_init.c: Likewise. + * resolv/res_debug.c: Likewise. + * resolv/res_mkquery.c: Likewise. + +Tue Aug 27 15:47:04 1996 Ulrich Drepper + + * elf/dl-error.c (catch): Define errstring element not as const. + (_dl_catch_error): ERRSTRING argument is not const pointer. + Initialize *ERRSTRING and *OBJNAME separately. + * elf/link.h: Change prototype for `_dl_catch_error'. + + * elf/dl-load.c (_dl_map_object): Use separate variable for + copied NAME to avoid `const' warning. + + * elf/dlerror.c: Make `last_errstring' variable not const pointer. + + * elf/rtld.c: Implement reading of /etc/ld.so.preload. This + provides preloading even for SUID binaries. + Add some more casts to avoid signed<->unsigned warnings. + +Tue Aug 27 15:40:28 1996 NIIBE Yutaka + + * posix/sys/types.h: Define loff_t. + * sysdeps/unix/sysv/linux/gnu/types.h: Define __loff_t. + Mon Aug 26 22:22:17 1996 Ulrich Drepper * io/fcntl.h: Add definition for BSD F* macros. @@ -20,11 +59,6 @@ Fri Aug 16 21:17:50 1996 Andreas Schwab - - * Makerules (o-iterator-doit): Simplify reference to autolock - script. - Sat Aug 24 15:27:41 1996 Andreas Schwab * sysdeps/mach/hurd/getcwd.c @@ -49,6 +83,19 @@ Sun Aug 25 18:25:52 1996 Andreas Schwab + + * sysdeps/mach/hurd/setitimer.c (setitimer_locked): Tolerate NEW + being null; in that case don't touch the timer at all (but do + return something in OLD if necessary). + +Mon Aug 26 13:35:16 1996 Thomas Bushnell, n/BSG + + * sysdeps/mach/hurd/i386/init-first.c (__libc_multiple_libcs): New + variable. + * sysdeps/i386/init-first.c: Likewise. + * sysdeps/stub/init-first.c: Likewise. + Mon Aug 26 02:01:37 1996 Ulrich Drepper * elf/dl-open.c (_dl_open): Call library initializer with diff --git a/Makerules b/Makerules index f82408146a..2cc5b9c550 100644 --- a/Makerules +++ b/Makerules @@ -333,6 +333,15 @@ $(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so endif endif +# Some files must not be compiled with the exception handler mechanism +# enabled (introduced in gcc-2.8). Use $(no-exceptions) in the +# appropriate CFLAGS definition. +ifeq ($(have-no-exceptions),yes) +no-exceptions = -fno-exceptions +else +no-exceptions = +endif + # Figure out the source filenames in this directory. override sources := $(addsuffix .c,$(filter-out $(elided-routines),\ @@ -475,8 +484,7 @@ define o-iterator-doit $(common-objpfx)$(patsubst %,$(libtype$o),c)($(ar-symtab-name)): \ $(common-objpfx)$(patsubst %,$(libtype$o),c)(\ $(patsubst $(objpfx)%,%,$(o-objects))) $(subdirs-stamp-o); \ - topdir=`cd $(..).; pwd`; \ - $$$$topdir/autolock.sh \ + $$(..)./autolock.sh \ $$(common-objpfx)$$(patsubst %,$$(libtype$o),c).lck \ $$(RANLIB) $$(common-objpfx)$$(patsubst %,$$(libtype$o),c) endef diff --git a/config.make.in b/config.make.in index b099199c36..614d1d2ae5 100644 --- a/config.make.in +++ b/config.make.in @@ -19,6 +19,7 @@ elf = @elf@ have-initfini = @libc_cv_have_initfini@ have-no-whole-archive = @libc_cv_ld_no_whole_archive@ +have-no-exceptions = @libc_cv_gcc_no_exceptions@ # Configuration options. gnu-as = @gnu_as@ diff --git a/configure.in b/configure.in index a2668b9ff9..8939236641 100644 --- a/configure.in +++ b/configure.in @@ -497,6 +497,23 @@ fi rm -f conftest*]) AC_SUBST(libc_cv_ld_no_whole_archive)dnl +AC_CACHE_CHECK(for gcc -fno-exceptions, libc_cv_gcc_no_exceptions, [dnl +cat > conftest.c <<\EOF +_start () {} +int __eh_pc; +__throw () {} +EOF +dnl No \ in command here because it ends up inside ''. +if AC_TRY_COMMAND([${CC-cc} $CFLAGS + -nostdlib -nostartfiles -fno-exceptions + -o conftest conftest.c]); then + libc_cv_gcc_no_exceptions=yes +else + libc_cv_gcc_no_exceptions=no +fi +rm -f conftest*]) +AC_SUBST(libc_cv_gcc_no_exceptions)dnl + ### End of automated tests. ### Now run sysdeps configure fragments. diff --git a/csu/Makefile b/csu/Makefile index 9254b7f2be..b61b1d74a3 100644 --- a/csu/Makefile +++ b/csu/Makefile @@ -80,7 +80,7 @@ define initfini -rm -f $(objpfx)crtcommon.tmp (echo 'cat > crtcommon.tmp <<\EOF_common'; \ $(CC) $< $(CPPFLAGS) $(CFLAGS) \ - -fPIC -finhibit-size-directive -g0 -S -o -; \ + -fPIC -finhibit-size-directive $(no-exceptions) -g0 -S -o -; \ echo 'EOF_common') | (cd $(@D); $(SHELL)) cat $(objpfx)crtcommon.tmp >> $(objpfx)crti.s-new cat $(objpfx)crtcommon.tmp >> $(objpfx)crtn.s-new diff --git a/elf/rtld.c b/elf/rtld.c index be71e88c3c..8b754920f8 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -486,20 +486,6 @@ of this helper program; chances are you did not intend to run this program.\n", _dl_debug_state (); } - if (_dl_rtld_map.l_info[DT_INIT]) - { - /* Call the initializer for the compatibility version of the - dynamic linker. There is no additional initialization - required for the ABI-compliant dynamic linker. */ - - (*(void (*) (int, char **, char**)) - (_dl_rtld_map.l_addr + _dl_rtld_map.l_info[DT_INIT]->d_un.d_ptr)) - (0, NULL, NULL); - - /* Clear the field so a future dlopen won't run it again. */ - _dl_rtld_map.l_info[DT_INIT] = NULL; - } - /* We finished the intialization and will start up. */ _dl_starting_up = 1; diff --git a/gmon/gmon.c b/gmon/gmon.c index 8e47c52681..a356c4cc47 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -55,7 +55,7 @@ struct gmonparam _gmonparam = { GMON_PROF_OFF }; static int s_scale; #define SCALE_1_TO_1 0x10000L -#define ERR(s) write(2, s, sizeof(s)) +#define ERR(s) write(2, s, sizeof(s) - 1) /* * Discover the tick frequency of the machine if something goes wrong, @@ -65,7 +65,7 @@ static int DEFUN_VOID(hertz) { struct itimerval tim; - + tim.it_interval.tv_sec = 0; tim.it_interval.tv_usec = 1; tim.it_value.tv_sec = 0; diff --git a/io/fcntl.h b/io/fcntl.h index 792bd938ec..7d24c22c42 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -43,6 +43,15 @@ __BEGIN_DECLS #endif #endif /* Use misc. */ +/* Define some more compatibility macros to be backward compatible with + BSD systems which did not managed to hide these kernel macros. */ +#ifdef __USE_BSD +#define FAPPEND O_APPEND +#define FASYNC O_ASYNC +#define FFSYNC O_FSYNC +#define FNONBLOCK O_NONBLOCK +#define FNDELAY O_NDELAY +#endif /* Use BSD. */ /* Do the file control operation described by CMD on FD. The remaining arguments are interpreted depending on CMD. */ diff --git a/misc/Makefile b/misc/Makefile index 1631b2121d..5bdb8252ed 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -71,3 +71,6 @@ $(objpfx)libbsd-compat.a: $(objpfx)bsd-compat.o ln $< $@ $(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib) + + +CFLAGS-init-misc.c = -fkeep-inline-functions diff --git a/misc/init-misc.c b/misc/init-misc.c index bf89e9ec0f..05e697d43b 100644 --- a/misc/init-misc.c +++ b/misc/init-misc.c @@ -25,7 +25,12 @@ char *__progname = (char *) ""; weak_alias (__progname_full, program_invocation_name) weak_alias (__progname, program_invocation_short_name) -void + +static void __init_misc (int argc, char **argv, char **envp) + __attribute__ ((unused)); + + +static void __init_misc (int argc, char **argv, char **envp) { if (argv && argv[0]) diff --git a/sysdeps/alpha/dl-machine.h b/sysdeps/alpha/dl-machine.h index 2bf8f9b7ec..3704c25c3c 100644 --- a/sysdeps/alpha/dl-machine.h +++ b/sysdeps/alpha/dl-machine.h @@ -217,7 +217,11 @@ _dl_start_user: jsr $26, ($0) ldgp $gp, 0($26) br 1b -2: /* Pass our finalizer function to the user in $0. */ +2: /* Clear the startup flag. */ + .set at + stl $31, _dl_starting_up + .set noat + /* Pass our finalizer function to the user in $0. */ lda $0, _dl_fini /* Jump to the user's entry point. */ mov $9, $27 diff --git a/sysdeps/generic/machine-gmon.h b/sysdeps/generic/machine-gmon.h index 115962a601..43bf62d663 100644 --- a/sysdeps/generic/machine-gmon.h +++ b/sysdeps/generic/machine-gmon.h @@ -46,6 +46,6 @@ static inline void mcount_internal (frompc, selfpc) #define MCOUNT \ void _mcount (void) \ { \ - mcount_internal ((u_long) __builtin_return_address (0), \ - (u_long) __builtin_return_address (1)); \ + mcount_internal ((u_long) __builtin_return_address (1), \ + (u_long) __builtin_return_address (0)); \ } diff --git a/sysdeps/generic/sbrk.c b/sysdeps/generic/sbrk.c index f63195adb3..d3ea705294 100644 --- a/sysdeps/generic/sbrk.c +++ b/sysdeps/generic/sbrk.c @@ -38,8 +38,22 @@ __sbrk (ptrdiff_t increment) instances of __brk and __sbrk can share the heap, returning interleaved pieces of it. */ if (__curbrk == NULL || __libc_multiple_libcs) - if (__brk (0) < 0) - return (void *) -1; + { + extern void _end; + + if (__brk (0) < 0) /* Initialize the break. */ + return (void *) -1; + + /* Align break address to page boundary if not happened before. */ + if (!__libc_multiple_libcs && __curbrk == &_end) + { + size_t pg = __getpagesize (); + ptrdiff_t rest = pg - ((&_end - (void *) 0) & (pg - 1)); + + if (__brk (__curbrk + rest) < 0) + return (void *) -1; + } + } if (increment == 0) return __curbrk; diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c index daa67fb858..4df2524afb 100644 --- a/sysdeps/mach/hurd/getcwd.c +++ b/sysdeps/mach/hurd/getcwd.c @@ -229,8 +229,12 @@ _hurd_canonicalize_directory_name_internal (file_t thisdir, free (file_name); return NULL; } - file_namep = &buf[file_namep - file_name]; + file_namep = &buf[file_namep - file_name + size / 2]; file_name = buf; + /* Move current contents up to the end of the buffer. + This is guaranteed to be non-overlapping. */ + memcpy (file_namep, file_namep - size / 2, + file_name + size - file_namep); } } file_namep -= d->d_namlen; diff --git a/sysdeps/posix/profil.c b/sysdeps/posix/profil.c index 8e34b3564f..a6786b1a13 100644 --- a/sysdeps/posix/profil.c +++ b/sysdeps/posix/profil.c @@ -37,7 +37,13 @@ static u_int pc_scale; static inline void profil_count (void *pc) { - size_t i = ((pc - pc_offset - (void *) 0) / 2) * pc_scale / 65536; + size_t i = (pc - pc_offset - (void *) 0) / 2; + + if (sizeof (unsigned long long int) > sizeof (size_t)) + i = (unsigned long long int) i * pc_scale / 65536; + else + i = i / 65536 * pc_scale + i % 65536 * pc_scale / 65536; + if (i < nsamples) ++samples[i]; } @@ -65,11 +71,11 @@ profil (u_short *sample_buffer, size_t size, size_t offset, u_int scale) if (samples == NULL) /* Wasn't turned on. */ return 0; - samples = NULL; - if (sigaction (SIGPROF, &oact, NULL) < 0) + if (setitimer (ITIMER_PROF, &otimer, NULL) < 0) return -1; - return setitimer (ITIMER_PROF, &otimer, NULL); + samples = NULL; + return sigaction (SIGPROF, &oact, NULL); } samples = sample_buffer; -- cgit v1.2.3