patches/glibc/2.1.3/rh62-11-glibc-2.1.3-calloc.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 08 17:48:32 2007 +0000 (2007-05-08)
changeset 78 c3868084d81a
permissions -rw-r--r--
Huge fixes to glibc build, so that we can build at least (and at last):
- use ports addon even when installing headers,
- use optimisation (-O) when installing headers, to avoid unnecessary warnings (thanks Robert P. J. DAY for pointing this out!),
- lowest kernel version to use is only X.Y.Z, not X.Y.Z.T,
- a bit of preparations for NPTL (RSN I hope),
- fix fixing the linker scripts (changing the backup file is kind of useless and stupid);

Shut uClibc finish step: there really is nothing to do;

Add a patch for glibc-2.3.6 weak aliases handling on some archs (ARM and ALPHA at least);

Did not catch the make errors: fixed the pattern matching in scripts/functions;

Introduce a new log level, ALL:
- send components' build messages there,
- DEBUG log level is destined only for crosstool-NG debug messages,
- migrate sub-actions to use appropriate log levels;

Update the armeb-unknown-linux-gnu sample:
- it builds!
- uses gcc-4.0.4 and glibc-2.3.6,
- updated to latest config options set.
     1 diff -ur glibc-2.1.3.orig/malloc/malloc.c glibc-2.1.3/malloc/malloc.c
     2 --- glibc-2.1.3.orig/malloc/malloc.c	Wed Feb 23 10:02:55 2000
     3 +++ glibc-2.1.3/malloc/malloc.c	Thu Aug  1 09:24:10 2002
     4 @@ -3656,12 +3656,20 @@
     5  {
     6    arena *ar_ptr;
     7    mchunkptr p, oldtop;
     8 -  INTERNAL_SIZE_T sz, csz, oldtopsize;
     9 +  INTERNAL_SIZE_T bytes, sz, csz, oldtopsize;
    10    Void_t* mem;
    11  
    12 +  /* size_t is unsigned so the behavior on overflow is defined;
    13 +   * request2size() uses similar post-checks anyway. */
    14 +  bytes = n * elem_size;
    15 +  if ((n | elem_size) >= 65536 && elem_size && bytes / elem_size != n) {
    16 +    __set_errno (ENOMEM);
    17 +    return 0;
    18 +  }
    19 +
    20  #if defined _LIBC || defined MALLOC_HOOKS
    21    if (__malloc_hook != NULL) {
    22 -    sz = n * elem_size;
    23 +    sz = bytes;
    24  #if defined __GNUC__ && __GNUC__ >= 2
    25      mem = (*__malloc_hook)(sz, __builtin_return_address (0));
    26  #else
    27 @@ -3678,7 +3686,7 @@
    28    }
    29  #endif
    30  
    31 -  if(request2size(n * elem_size, sz))
    32 +  if(request2size(bytes, sz))
    33      return 0;
    34    arena_get(ar_ptr, sz);
    35    if(!ar_ptr)