OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / glibc / glibc-2.5.patch
1 diff -ur glibc-2.5/Makeconfig glibc/Makeconfig
2 --- glibc-2.5/Makeconfig        2006-07-11 07:42:27.000000000 +1000
3 +++ glibc/Makeconfig    2008-07-05 00:01:41.000000000 +1000
4 @@ -526,12 +526,12 @@
5    libunwind = -lunwind
6  endif
7  ifneq ($(have-as-needed),yes)
8 - libgcc_eh := -lgcc_eh $(libunwind)
9 + libgcc_eh := $(libunwind)
10  else
11   libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed
12  endif
13  gnulib := -lgcc $(libgcc_eh)
14 -static-gnulib := -lgcc -lgcc_eh $(libunwind)
15 +static-gnulib := -lgcc $(libunwind)
16  libc.so-gnulib := -lgcc
17  endif
18  ifeq ($(elf),yes)
19 diff -ur glibc-2.5/dlfcn/Makefile glibc/dlfcn/Makefile
20 --- glibc-2.5/dlfcn/Makefile    2006-09-01 02:59:15.000000000 +1000
21 +++ glibc/dlfcn/Makefile        2008-07-05 00:02:11.000000000 +1000
22 @@ -136,7 +136,7 @@
23  $(objpfx)bug-atexit2-lib.so: $(common-objpfx)libc.so \
24                              $(common-objpfx)libc_nonshared.a
25  
26 -LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(common-objpfx)elf/ld.so \
27 +LDLIBS-bug-atexit3-lib.so = -lstdc++ $(common-objpfx)elf/ld.so \
28                             $(common-objpfx)libc_nonshared.a
29  $(objpfx)bug-atexit3: $(libdl)
30  $(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
31 diff -ur glibc-2.5/malloc/memusage.c glibc/malloc/memusage.c
32 --- glibc-2.5/malloc/memusage.c 2005-10-15 07:09:34.000000000 +1000
33 +++ glibc/malloc/memusage.c     2008-07-05 00:30:28.000000000 +1000
34 @@ -33,6 +33,9 @@
35  #include <sys/mman.h>
36  #include <sys/time.h>
37  
38 +#ifndef LONG_BIT
39 +#define LONG_BIT 32
40 +#endif
41  #include <memusage.h>
42  
43  /* Pointer to the real functions.  These are determined used `dlsym'
44 @@ -110,7 +113,7 @@
45  };
46  
47  static struct entry buffer[2 * DEFAULT_BUFFER_SIZE];
48 -static uatomic32_t buffer_cnt;
49 +static uint32_t buffer_cnt;
50  static struct entry first;
51  
52  
53 @@ -160,7 +163,7 @@
54    /* Store the value only if we are writing to a file.  */
55    if (fd != -1)
56      {
57 -      uatomic32_t idx = atomic_exchange_and_add (&buffer_cnt, 1);
58 +      uint32_t idx = atomic_exchange_and_add (&buffer_cnt, 1);
59        if (idx >= 2 * buffer_size)
60         {
61           /* We try to reset the counter to the correct range.  If
62 @@ -790,13 +793,13 @@
63      }
64  
65    /* Write a colorful statistic.  */
66 -  fprintf (stderr, "\n\
67 -\e[01;32mMemory usage summary:\e[0;0m heap total: %llu, heap peak: %lu, stack peak: %lu\n\
68 -\e[04;34m         total calls   total memory   failed calls\e[0m\n\
69 -\e[00;34m malloc|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
70 -\e[00;34mrealloc|\e[0m %10lu   %12llu   %s%12lu\e[00;00m   (in place: %ld, dec: %ld)\n\
71 -\e[00;34m calloc|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
72 -\e[00;34m   free|\e[0m %10lu   %12llu\n",
73 +  fprintf (stderr, "\n"
74 +"\e[01;32mMemory usage summary:\e[0;0m heap total: %llu, heap peak: %lu, stack peak: %lu\n"
75 +"\e[04;34m         total calls   total memory   failed calls\e[0m\n"
76 +"\e[00;34m malloc|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n"
77 +"\e[00;34mrealloc|\e[0m %10lu   %12llu   %s%12lu\e[00;00m   (in place: %ld, dec: %ld)\n"
78 +"\e[00;34m calloc|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n"
79 +"\e[00;34m   free|\e[0m %10lu   %12llu\n",
80            (unsigned long long int) grand_total, (unsigned long int) peak_heap,
81            (unsigned long int) peak_stack,
82            (unsigned long int) calls[idx_malloc],
83 @@ -816,12 +819,12 @@
84            (unsigned long long int) total[idx_free]);
85  
86    if (trace_mmap)
87 -    fprintf (stderr, "\
88 -\e[00;34mmmap(r)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
89 -\e[00;34mmmap(w)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
90 -\e[00;34mmmap(a)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n\
91 -\e[00;34m mremap|\e[0m %10lu   %12llu   %s%12lu\e[00;00m   (in place: %ld, dec: %ld)\n\
92 -\e[00;34m munmap|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n",
93 +    fprintf (stderr, ""
94 +"\e[00;34mmmap(r)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n"
95 +"\e[00;34mmmap(w)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n"
96 +"\e[00;34mmmap(a)|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n"
97 +"\e[00;34m mremap|\e[0m %10lu   %12llu   %s%12lu\e[00;00m   (in place: %ld, dec: %ld)\n"
98 +"\e[00;34m munmap|\e[0m %10lu   %12llu   %s%12lu\e[00;00m\n",
99              (unsigned long int) calls[idx_mmap_r],
100              (unsigned long long int) total[idx_mmap_r],
101              failed[idx_mmap_r] ? "\e[01;41m" : "",
102 diff -ur glibc-2.5/sysdeps/generic/memusage.h glibc/sysdeps/generic/memusage.h
103 --- glibc-2.5/sysdeps/generic/memusage.h        2005-08-20 11:07:03.000000000 +1000
104 +++ glibc/sysdeps/generic/memusage.h    2008-07-05 00:26:00.000000000 +1000
105 @@ -38,14 +38,14 @@
106  #endif
107  
108  #if LONG_BIT == 32
109 -# define memusage_cntr_t uatomic32_t
110 +# define memusage_cntr_t uint32_t
111  #else
112 -# define memusage_cntr_t uatomic64_t
113 +# define memusage_cntr_t uint64_t
114  #endif
115  #ifndef memusage_size_t
116  # if LONG_BIT == 32
117 -#  define memusage_size_t uatomic32_t
118 +#  define memusage_size_t uint32_t
119  # else
120 -#  define memusage_size_t uatomic64_t
121 +#  define memusage_size_t uint64_t
122  # endif
123  #endif
124 diff -ur glibc-2.5/sysdeps/unix/sysv/linux/getcwd.c glibc/sysdeps/unix/sysv/linux/getcwd.c
125 --- glibc-2.5/sysdeps/unix/sysv/linux/getcwd.c  2006-04-03 03:58:28.000000000 +1000
126 +++ glibc/sysdeps/unix/sysv/linux/getcwd.c      2008-07-04 23:11:52.000000000 +1000
127 @@ -78,6 +78,9 @@
128      return generic_getcwd (buf, size);
129  
130  #ifndef NO_ALLOCATION
131 +#ifndef MAX
132 +#define MAX(a,b) ((a) > (b) ? (a) : (b))
133 +#endif
134    size_t alloc_size = size;
135    if (size == 0)
136      {