diff options
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | FAQ.in | 2 | ||||
-rw-r--r-- | malloc/malloc.c | 38 | ||||
-rw-r--r-- | manual/install.texi | 2 | ||||
-rw-r--r-- | stdio-common/tstscanf.c | 17 | ||||
-rw-r--r-- | sysdeps/arm/dl-machine.h | 18 |
6 files changed, 72 insertions, 30 deletions
@@ -1,3 +1,28 @@ +1999-06-06 Ulrich Drepper <drepper@cygnus.com> + + * malloc/malloc.c: Introduce local variable __libc_getpagesize to + avoid multiple calls to getpagesize() which might be a syscall. + +1999-06-06 Philip Blundell <philb@gnu.org> + + * stdio-common/tstscanf.c (main): Test the half-word format "%hd". + +1999-06-06 Andreas Jaeger <aj@arthur.rhein-neckar.de> + + * manual/install.texi (Running make install): Correct typo in + dynamic linker invocation. + +1999-06-05 Philip Blundell <philb@gnu.org> + + * sysdeps/arm/dl-machine.h (elf_machine_load_address): Fix + problems with GOT addressing. + +1999-06-05 Wolfram Gloger <wmglo@dent.med.uni-muenchen.de> + + * malloc/malloc.c (check_action): Change into bitmap so that both + diagnostic and abort can be requested by setting it to 3. + (mALLOC_SET_STATe): Disable malloc checking if necessary. + 1999-06-03 Ulrich Drepper <drepper@cygnus.com> * configure.in: Few changes for HPUX. @@ -454,7 +454,7 @@ US. the libc.so which comes with glibc all I get is a core dump. {UD} On Linux, gcc sets the dynamic linker to /lib/ld-linux.so.1 unless the -user specifies a -dynamic-linker argument. This is the name of the libc5 +user specifies a --dynamic-linker argument. This is the name of the libc5 dynamic linker, which does not work with glibc. For casual use of GNU libc you can just specify to the linker diff --git a/malloc/malloc.c b/malloc/malloc.c index 43d89d4..2aec9c4 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -852,6 +852,8 @@ Void_t *(*__morecore)() = __default_morecore; #endif +static size_t __libc_pagesize; + #define MORECORE (*__morecore) #define MORECORE_FAILURE 0 #define MORECORE_CLEARS 1 @@ -860,7 +862,7 @@ Void_t *(*__morecore)() = __default_morecore; #define mremap __mremap #define mprotect __mprotect #undef malloc_getpagesize -#define malloc_getpagesize __getpagesize() +#define malloc_getpagesize __libc_pagesize #else /* _LIBC */ @@ -1654,6 +1656,7 @@ ptmalloc_init __MALLOC_P((void)) /* Initialize the pthreads interface. */ if (__pthread_initialize != NULL) __pthread_initialize(); + __libc_getpagesize = __getpagesize(); #endif mutex_init(&main_arena.mutex); mutex_init(&list_lock); @@ -1780,7 +1783,7 @@ __malloc_check_init() __free_hook = free_check; __realloc_hook = realloc_check; __memalign_hook = memalign_check; - if(check_action == 1) + if(check_action & 1) fprintf(stderr, "malloc: using debugging hooks\n"); } @@ -4068,7 +4071,11 @@ int mALLOPt(param_number, value) int param_number; int value; the heap contents are saved/restored via some other method. The primary example for this is GNU Emacs with its `dumping' procedure. `Hook' function pointers are never saved or restored by these - functions. */ + functions, with two exceptions: If malloc checking was in use when + malloc_get_state() was called, then malloc_set_state() calls + __malloc_check_init() if possible; if malloc checking was not in + use in the recorded state but the user requested malloc checking, + then the hooks are reset to 0. */ #define MALLOC_STATE_MAGIC 0x444c4541l #define MALLOC_STATE_VERSION (0*0x100l + 1l) /* major*0x100 + minor */ @@ -4196,10 +4203,18 @@ mALLOC_SET_STATe(msptr) Void_t* msptr; /* add version-dependent code here */ if (ms->version >= 1) { #if defined _LIBC || defined MALLOC_HOOKS - /* Check whether it is safe to enable malloc checking. */ + /* Check whether it is safe to enable malloc checking, or whether + it is necessary to disable it. */ if (ms->using_malloc_checking && !using_malloc_checking && !disallow_malloc_check) __malloc_check_init (); + else if (!ms->using_malloc_checking && using_malloc_checking) { + __malloc_hook = 0; + __free_hook = 0; + __realloc_hook = 0; + __memalign_hook = 0; + using_malloc_checking = 0; + } #endif } @@ -4319,13 +4334,11 @@ top_check() if((char*)t + chunksize(t) == sbrk_base + sbrked_mem || t == initial_top(&main_arena)) return 0; - switch(check_action) { - case 1: + if(check_action & 1) fprintf(stderr, "malloc: top chunk is corrupt\n"); - break; - case 2: + if(check_action & 2) abort(); - } + /* Try to set up a new top chunk. */ brk = MORECORE(0); front_misalign = (unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK; @@ -4374,13 +4387,10 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller; p = mem2chunk_check(mem); if(!p) { (void)mutex_unlock(&main_arena.mutex); - switch(check_action) { - case 1: + if(check_action & 1) fprintf(stderr, "free(): invalid pointer %p!\n", mem); - break; - case 2: + if(check_action & 2) abort(); - } return; } #if HAVE_MMAP diff --git a/manual/install.texi b/manual/install.texi index 00d6687..f2555c7 100644 --- a/manual/install.texi +++ b/manual/install.texi @@ -236,7 +236,7 @@ install}, or you will end up with a mixture of header files from both libraries, and you won't be able to compile anything. You may also need to reconfigure GCC to work with the new library. The easiest way to do that is to figure out the compiler switches to make it work again -(@samp{-Wl,-dynamic-linker=/lib/ld-linux.so.2} should work on Linux +(@samp{-Wl,--dynamic-linker=/lib/ld-linux.so.2} should work on Linux systems) and use them to recompile gcc. You can also edit the specs file (@file{/usr/lib/gcc-lib/@var{TARGET}/@var{VERSION}/specs}), but that is a bit of a black art. diff --git a/stdio-common/tstscanf.c b/stdio-common/tstscanf.c index 52473cd..85ea70f 100644 --- a/stdio-common/tstscanf.c +++ b/stdio-common/tstscanf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 96, 97, 98, 99 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 @@ -235,5 +235,20 @@ main (int argc, char **argv) } } + fputs ("Test 7:\n", stdout); + { + short a[2] = { -1, -1 }; + int res; + + res = sscanf ("32767 1234", "%hd %hd", &a[0], &a[1]); + printf ("res = %d, a[0] = %d, a[1] = %d\n", res, a[0], a[1]); + + if (res != 2 || a[0] != 32767 || a[1] != 1234) + { + fputs ("test failed!\n", stdout); + result = 1; + } + } + exit (result); } diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h index aff8df2..754a6ca 100644 --- a/sysdeps/arm/dl-machine.h +++ b/sysdeps/arm/dl-machine.h @@ -52,22 +52,14 @@ elf_machine_dynamic (void) /* Return the run-time load address of the shared object. */ -// patb static inline Elf32_Addr __attribute__ ((unused)) elf_machine_load_address (void) { - Elf32_Addr addr; - asm (" ldr ip,.L1 - ldr r3,.L3 - add r3, r3, sl - ldr ip,[sl, ip] - sub ip, r3, ip - b .L2 - .L1: .word _dl_start(GOT) - .L3: .word _dl_start(GOTOFF) - .L2: mov %0, ip" - : "=r" (addr) : : "ip", "r3"); - return addr; + extern void __dl_start asm ("_dl_start"); + Elf32_Addr got_addr = (Elf32_Addr) &__dl_start; + Elf32_Addr pcrel_addr; + asm ("adr %0, _dl_start" : "=r" (pcrel_addr)); + return pcrel_addr - got_addr; } |