uClibc: make UCLIBC_HAS_LONG_DOUBLE_MATH generic
[openwrt/svn-archive/archive.git] / toolchain / uClibc / patches-0.9.30.1 / 400-gcc4.4-fixes.patch
1 The gcc-4.4 documentation still suggests that the compiler will automatically
2 do format checking for the standard format function prototypes, but it is now
3 also barking warnings suggesting that we add them for this lot too. So added.
4
5 Signed-off-by: Ron Lee <ron@debian.org>
6 ---
7 include/stdio.h | 15 ++++++++++-----
8 1 files changed, 10 insertions(+), 5 deletions(-)
9
10 Index: uClibc-0.9.30.1/include/stdio.h
11 ===================================================================
12 --- uClibc-0.9.30.1.orig/include/stdio.h 2008-09-30 14:17:04.000000000 +0200
13 +++ uClibc-0.9.30.1/include/stdio.h 2009-07-06 21:16:14.000000000 +0200
14 @@ -325,7 +325,8 @@
15 extern int printf (__const char *__restrict __format, ...);
16 /* Write formatted output to S. */
17 extern int sprintf (char *__restrict __s,
18 - __const char *__restrict __format, ...) __THROW;
19 + __const char *__restrict __format, ...)
20 + __THROW __attribute__ ((__format__ (__printf__, 2, 3)));
21
22 /* Write formatted output to S from argument list ARG.
23
24 @@ -340,7 +341,8 @@
25 extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg);
26 /* Write formatted output to S from argument list ARG. */
27 extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
28 - __gnuc_va_list __arg) __THROW;
29 + __gnuc_va_list __arg)
30 + __THROW __attribute__ ((__format__ (__printf__, 2, 0)));
31 __END_NAMESPACE_STD
32
33 #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98
34 @@ -391,15 +393,18 @@
35 This function is a possible cancellation point and therefore not
36 marked with __THROW. */
37 extern int fscanf (FILE *__restrict __stream,
38 - __const char *__restrict __format, ...) __wur;
39 + __const char *__restrict __format, ...)
40 + __attribute__ ((__format__ (__scanf__, 2, 3))) __wur;
41 /* Read formatted input from stdin.
42
43 This function is a possible cancellation point and therefore not
44 marked with __THROW. */
45 -extern int scanf (__const char *__restrict __format, ...) __wur;
46 +extern int scanf (__const char *__restrict __format, ...)
47 + __attribute__ ((__format__ (__scanf__, 1, 2))) __wur;
48 /* Read formatted input from S. */
49 extern int sscanf (__const char *__restrict __s,
50 - __const char *__restrict __format, ...) __THROW;
51 + __const char *__restrict __format, ...)
52 + __THROW __attribute__ ((__format__ (__scanf__, 2, 3)));
53 __END_NAMESPACE_STD
54
55 #ifdef __USE_ISOC99
56 gcc-4.4 now barks about this, so appease it.
57
58 Signed-off-by: Ron Lee <ron@debian.org>
59 ---
60 ldso/ldso/arm/dl-sysdep.h | 3 ++-
61 1 files changed, 2 insertions(+), 1 deletions(-)
62
63 diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h
64 index 5191dd7..75c58b0 100644
65 --- a/ldso/ldso/arm/dl-sysdep.h
66 +++ b/ldso/ldso/arm/dl-sysdep.h
67 @@ -98,11 +98,12 @@ elf_machine_dynamic (void)
68 return dynamic;
69 }
70
71 +extern void __dl_start __asm__ ("_dl_start");
72 +
73 /* Return the run-time load address of the shared object. */
74 static __always_inline Elf32_Addr __attribute__ ((unused))
75 elf_machine_load_address (void)
76 {
77 - extern void __dl_start __asm__ ("_dl_start");
78 Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
79 Elf32_Addr pcrel_addr;
80 #if defined __OPTIMIZE__ && !defined __thumb__
81 usage() is also made static in answer to warnings about no prototype.
82 In __pthread_manager_event() we also have to drop the return statement,
83 else gcc will in turn complain about a non-returning function having one.
84
85 Signed-off-by: Ron Lee <ron@debian.org>
86 ---
87 libpthread/linuxthreads.old/manager.c | 4 ++--
88 utils/ldconfig.c | 4 ++--
89 2 files changed, 4 insertions(+), 4 deletions(-)
90
91 diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
92 index 19be92f..0617d7d 100644
93 --- a/libpthread/linuxthreads.old/manager.c
94 +++ b/libpthread/linuxthreads.old/manager.c
95 @@ -248,7 +248,7 @@ int attribute_noreturn __pthread_manager(void *arg)
96 }
97 }
98
99 -int __pthread_manager_event(void *arg)
100 +int attribute_noreturn __pthread_manager_event(void *arg)
101 {
102 /* If we have special thread_self processing, initialize it. */
103 #ifdef INIT_THREAD_SELF
104 @@ -260,7 +260,7 @@ int __pthread_manager_event(void *arg)
105 /* Free it immediately. */
106 __pthread_unlock (THREAD_GETMEM((&__pthread_manager_thread), p_lock));
107
108 - return __pthread_manager(arg);
109 + __pthread_manager(arg);
110 }
111
112 /* Process creation */
113 diff --git a/utils/ldconfig.c b/utils/ldconfig.c
114 index c52b170..f6aec5c 100644
115 --- a/utils/ldconfig.c
116 +++ b/utils/ldconfig.c
117 @@ -114,7 +114,7 @@ static void warnx(const char *s, ...)
118 fprintf(stderr, "\n");
119 }
120
121 -static void err(int errnum, const char *s, ...)
122 +static void attribute_noreturn err(int errnum, const char *s, ...)
123 {
124 va_list p;
125
126 @@ -783,7 +783,7 @@ void cache_print(void)
127 }
128 #endif
129
130 -void usage(void)
131 +static void attribute_noreturn usage(void)
132 {
133 fprintf(stderr,
134 #ifdef __LDSO_CACHE_SUPPORT__
135 --
136 This keeps gcc-4.4 from nagging that they have no prototypes.
137
138 Signed-off-by: Ron Lee <ron@debian.org>
139 ---
140 utils/ldconfig.c | 16 ++++++++--------
141 utils/ldd.c | 12 ++++++------
142 utils/readsoname2.c | 2 +-
143 3 files changed, 15 insertions(+), 15 deletions(-)
144
145 diff --git a/utils/ldconfig.c b/utils/ldconfig.c
146 index f6aec5c..3bd7cee 100644
147 --- a/utils/ldconfig.c
148 +++ b/utils/ldconfig.c
149 @@ -173,8 +173,8 @@ static char *xstrdup(const char *str)
150 #define readsonameXX readsoname64
151 #define __ELF_NATIVE_CLASS 64
152 #include "readsoname2.c"
153 -char *readsoname(char *name, FILE *infile, int expected_type,
154 - int *type, int elfclass)
155 +static char *readsoname(char *name, FILE *infile, int expected_type,
156 + int *type, int elfclass)
157 {
158 char *res;
159
160 @@ -206,8 +206,8 @@ char *readsoname(char *name, FILE *infile, int expected_type,
161 * If the expected, actual/deduced types missmatch we display a warning
162 * and use the actual/deduced type.
163 */
164 -char *is_shlib(const char *dir, const char *name, int *type,
165 - int *islink, int expected_type)
166 +static char *is_shlib(const char *dir, const char *name, int *type,
167 + int *islink, int expected_type)
168 {
169 char *good = NULL;
170 char *cp, *cp2;
171 @@ -323,7 +323,7 @@ char *is_shlib(const char *dir, const char *name, int *type,
172 }
173
174 /* update the symlink to new library */
175 -void link_shlib(const char *dir, const char *file, const char *so)
176 +static void link_shlib(const char *dir, const char *file, const char *so)
177 {
178 int change = 1;
179 char libname[BUFFER_SIZE];
180 @@ -380,7 +380,7 @@ void link_shlib(const char *dir, const char *file, const char *so)
181 }
182
183 /* figure out which library is greater */
184 -int libcmp(char *p1, char *p2)
185 +static int libcmp(char *p1, char *p2)
186 {
187 while (*p1) {
188 if (isdigit(*p1) && isdigit(*p2)) {
189 @@ -412,7 +412,7 @@ struct lib {
190 };
191
192 /* update all shared library links in a directory */
193 -void scan_dir(const char *rawname)
194 +static void scan_dir(const char *rawname)
195 {
196 DIR *dir;
197 const char *name;
198 @@ -554,7 +554,7 @@ void cache_write(void)
199 }
200 #else
201 /* return the list of system-specific directories */
202 -char *get_extpath(void)
203 +static char *get_extpath(void)
204 {
205 char *res = NULL, *cp;
206 FILE *file;
207 diff --git a/utils/ldd.c b/utils/ldd.c
208 index 1f1dc25..02b37f1 100644
209 --- a/utils/ldd.c
210 +++ b/utils/ldd.c
211 @@ -214,7 +214,7 @@ static char *elf_find_rpath(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic)
212 return NULL;
213 }
214
215 -int check_elf_header(ElfW(Ehdr) *const ehdr)
216 +static int check_elf_header(ElfW(Ehdr) *const ehdr)
217 {
218 if (!ehdr || *(uint32_t*)ehdr != ELFMAG_U32
219 || ehdr->e_ident[EI_CLASS] != ELFCLASSM
220 @@ -249,7 +249,7 @@ int check_elf_header(ElfW(Ehdr) *const ehdr)
221 static caddr_t cache_addr = NULL;
222 static size_t cache_size = 0;
223
224 -int map_cache(void)
225 +static int map_cache(void)
226 {
227 int fd;
228 struct stat st;
229 @@ -306,7 +306,7 @@ fail:
230 return -1;
231 }
232
233 -int unmap_cache(void)
234 +static int unmap_cache(void)
235 {
236 if (cache_addr == NULL || cache_addr == (caddr_t) - 1)
237 return -1;
238 @@ -372,8 +372,8 @@ static void search_for_named_library(char *name, char *result,
239 *result = '\0';
240 }
241
242 -void locate_library_file(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic, int is_suid,
243 - struct library *lib)
244 +static void locate_library_file(ElfW(Ehdr) *ehdr, ElfW(Dyn) *dynamic,
245 + int is_suid, struct library *lib)
246 {
247 char *buf;
248 char *path;
249 @@ -608,7 +608,7 @@ static struct library *find_elf_interpreter(ElfW(Ehdr) *ehdr)
250 /*
251 #warning "There may be two warnings here about vfork() clobbering, ignore them"
252 */
253 -int find_dependancies(char *filename)
254 +static int find_dependancies(char *filename)
255 {
256 int is_suid = 0;
257 FILE *thefile;
258 diff --git a/utils/readsoname2.c b/utils/readsoname2.c
259 index a74b46a..5cda331 100644
260 --- a/utils/readsoname2.c
261 +++ b/utils/readsoname2.c
262 @@ -1,4 +1,4 @@
263 -char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
264 +static char *readsonameXX(char *name, FILE *infile, int expected_type, int *type)
265 {
266 ElfW(Ehdr) *epnt;
267 ElfW(Phdr) *ppnt;
268 --
269 This cuts down on a lot of noise from gcc-4.4
270
271 Signed-off-by: Ron Lee <ron@debian.org>
272 ---
273 libc/misc/elf/dl-support.c | 5 ++---
274 libc/sysdeps/linux/arm/aeabi_assert.c | 5 ++---
275 libc/sysdeps/linux/arm/aeabi_atexit.c | 4 ++--
276 libc/sysdeps/linux/arm/aeabi_errno_addr.c | 4 ++--
277 libc/sysdeps/linux/arm/aeabi_localeconv.c | 4 ++--
278 libc/sysdeps/linux/arm/aeabi_memclr.c | 4 ++--
279 libc/sysdeps/linux/arm/aeabi_memcpy.c | 4 ++--
280 libc/sysdeps/linux/arm/aeabi_memmove.c | 4 ++--
281 libc/sysdeps/linux/arm/aeabi_memset.c | 4 ++--
282 libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c | 15 ++++++---------
283 libc/sysdeps/linux/arm/find_exidx.c | 4 ++--
284 .../linuxthreads.old/sysdeps/arm/pt-machine.h | 4 ++--
285 utils/chroot_realpath.c | 3 +++
286 13 files changed, 31 insertions(+), 33 deletions(-)
287
288 diff --git a/libc/misc/elf/dl-support.c b/libc/misc/elf/dl-support.c
289 index 3c1d853..4dd155e 100644
290 --- a/libc/misc/elf/dl-support.c
291 +++ b/libc/misc/elf/dl-support.c
292 @@ -17,9 +17,8 @@
293 ElfW(Phdr) *_dl_phdr;
294 size_t _dl_phnum;
295
296 -void
297 -internal_function
298 -_dl_aux_init (ElfW(auxv_t) *av)
299 +void internal_function _dl_aux_init (ElfW(auxv_t) *av);
300 +void internal_function _dl_aux_init (ElfW(auxv_t) *av)
301 {
302 /* Get the program headers base address from the aux vect */
303 _dl_phdr = (ElfW(Phdr) *) av[AT_PHDR].a_un.a_val;
304 diff --git a/libc/sysdeps/linux/arm/aeabi_assert.c b/libc/sysdeps/linux/arm/aeabi_assert.c
305 index 53943ac..348ca9b 100644
306 --- a/libc/sysdeps/linux/arm/aeabi_assert.c
307 +++ b/libc/sysdeps/linux/arm/aeabi_assert.c
308 @@ -22,9 +22,8 @@
309
310 /* libc_hidden_proto(__assert) */
311
312 -void
313 -__aeabi_assert (const char *assertion, const char *file,
314 - unsigned int line)
315 +void __aeabi_assert(const char *assertion, const char *file, unsigned int line);
316 +void __aeabi_assert(const char *assertion, const char *file, unsigned int line)
317 {
318 __assert (assertion, file, line, NULL);
319 }
320 diff --git a/libc/sysdeps/linux/arm/aeabi_atexit.c b/libc/sysdeps/linux/arm/aeabi_atexit.c
321 index 4a7a6f1..ebb233b 100644
322 --- a/libc/sysdeps/linux/arm/aeabi_atexit.c
323 +++ b/libc/sysdeps/linux/arm/aeabi_atexit.c
324 @@ -24,8 +24,8 @@ libc_hidden_proto(__cxa_atexit)
325 /* Register a function to be called by exit or when a shared library
326 is unloaded. This routine is like __cxa_atexit, but uses the
327 calling sequence required by the ARM EABI. */
328 -int
329 -__aeabi_atexit (void *arg, void (*func) (void *), void *d)
330 +int __aeabi_atexit (void *arg, void (*func) (void *), void *d);
331 +int __aeabi_atexit (void *arg, void (*func) (void *), void *d)
332 {
333 return __cxa_atexit (func, arg, d);
334 }
335 diff --git a/libc/sysdeps/linux/arm/aeabi_errno_addr.c b/libc/sysdeps/linux/arm/aeabi_errno_addr.c
336 index 09bdc1e..5e262a6 100644
337 --- a/libc/sysdeps/linux/arm/aeabi_errno_addr.c
338 +++ b/libc/sysdeps/linux/arm/aeabi_errno_addr.c
339 @@ -18,8 +18,8 @@
340
341 #include <errno.h>
342
343 -volatile int *
344 -__aeabi_errno_addr (void)
345 +volatile int * __aeabi_errno_addr (void);
346 +volatile int * __aeabi_errno_addr (void)
347 {
348 return &errno;
349 }
350 diff --git a/libc/sysdeps/linux/arm/aeabi_localeconv.c b/libc/sysdeps/linux/arm/aeabi_localeconv.c
351 index 6fa29bb..4c34f57 100644
352 --- a/libc/sysdeps/linux/arm/aeabi_localeconv.c
353 +++ b/libc/sysdeps/linux/arm/aeabi_localeconv.c
354 @@ -20,8 +20,8 @@
355
356 /* libc_hidden_proto(localeconv) */
357
358 -struct lconv *
359 -__aeabi_localeconv (void)
360 +struct lconv * __aeabi_localeconv (void);
361 +struct lconv * __aeabi_localeconv (void)
362 {
363 return localeconv ();
364 }
365 diff --git a/libc/sysdeps/linux/arm/aeabi_memclr.c b/libc/sysdeps/linux/arm/aeabi_memclr.c
366 index c0f9021..9125bac 100644
367 --- a/libc/sysdeps/linux/arm/aeabi_memclr.c
368 +++ b/libc/sysdeps/linux/arm/aeabi_memclr.c
369 @@ -22,8 +22,8 @@
370
371 /* Clear memory. Can't alias to bzero because it's not defined in the
372 same translation unit. */
373 -void
374 -__aeabi_memclr (void *dest, size_t n)
375 +void __aeabi_memclr (void *dest, size_t n);
376 +void __aeabi_memclr (void *dest, size_t n)
377 {
378 memset (dest, 0, n);
379 }
380 diff --git a/libc/sysdeps/linux/arm/aeabi_memcpy.c b/libc/sysdeps/linux/arm/aeabi_memcpy.c
381 index 83eac0b..604c139 100644
382 --- a/libc/sysdeps/linux/arm/aeabi_memcpy.c
383 +++ b/libc/sysdeps/linux/arm/aeabi_memcpy.c
384 @@ -23,8 +23,8 @@
385 /* Copy memory like memcpy, but no return value required. Can't alias
386 to memcpy because it's not defined in the same translation
387 unit. */
388 -void
389 -__aeabi_memcpy (void *dest, const void *src, size_t n)
390 +void __aeabi_memcpy (void *dest, const void *src, size_t n);
391 +void __aeabi_memcpy (void *dest, const void *src, size_t n)
392 {
393 memcpy (dest, src, n);
394 }
395 diff --git a/libc/sysdeps/linux/arm/aeabi_memmove.c b/libc/sysdeps/linux/arm/aeabi_memmove.c
396 index 164d72b..7ecfbb7 100644
397 --- a/libc/sysdeps/linux/arm/aeabi_memmove.c
398 +++ b/libc/sysdeps/linux/arm/aeabi_memmove.c
399 @@ -23,8 +23,8 @@
400 /* Copy memory like memmove, but no return value required. Can't
401 alias to memmove because it's not defined in the same translation
402 unit. */
403 -void
404 -__aeabi_memmove (void *dest, const void *src, size_t n)
405 +void __aeabi_memmove (void *dest, const void *src, size_t n);
406 +void __aeabi_memmove (void *dest, const void *src, size_t n)
407 {
408 memmove (dest, src, n);
409 }
410 diff --git a/libc/sysdeps/linux/arm/aeabi_memset.c b/libc/sysdeps/linux/arm/aeabi_memset.c
411 index f1c366f..a37e21f 100644
412 --- a/libc/sysdeps/linux/arm/aeabi_memset.c
413 +++ b/libc/sysdeps/linux/arm/aeabi_memset.c
414 @@ -22,8 +22,8 @@
415
416 /* Set memory like memset, but different argument order and no return
417 value required. */
418 -void
419 -__aeabi_memset (void *dest, size_t n, int c)
420 +void __aeabi_memset (void *dest, size_t n, int c);
421 +void __aeabi_memset (void *dest, size_t n, int c)
422 {
423 memset (dest, c, n);
424 }
425 diff --git a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
426 index e657d38..4544dc7 100644
427 --- a/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
428 +++ b/libc/sysdeps/linux/arm/aeabi_unwind_cpp_pr1.c
429 @@ -24,20 +24,17 @@
430
431 #include <stdlib.h>
432
433 -attribute_hidden
434 -void
435 -__aeabi_unwind_cpp_pr0 (void)
436 +attribute_hidden void __aeabi_unwind_cpp_pr0 (void);
437 +attribute_hidden void __aeabi_unwind_cpp_pr0 (void)
438 {
439 }
440
441 -attribute_hidden
442 -void
443 -__aeabi_unwind_cpp_pr1 (void)
444 +attribute_hidden void __aeabi_unwind_cpp_pr1 (void);
445 +attribute_hidden void __aeabi_unwind_cpp_pr1 (void)
446 {
447 }
448
449 -attribute_hidden
450 -void
451 -__aeabi_unwind_cpp_pr2 (void)
452 +attribute_hidden void __aeabi_unwind_cpp_pr2 (void);
453 +attribute_hidden void __aeabi_unwind_cpp_pr2 (void)
454 {
455 }
456 diff --git a/libc/sysdeps/linux/arm/find_exidx.c b/libc/sysdeps/linux/arm/find_exidx.c
457 index 9e4f401..a16534b 100644
458 --- a/libc/sysdeps/linux/arm/find_exidx.c
459 +++ b/libc/sysdeps/linux/arm/find_exidx.c
460 @@ -65,8 +65,8 @@ find_exidx_callback (struct dl_phdr_info * info, size_t size, void * ptr)
461
462 /* Find the exception index table containing PC. */
463
464 -_Unwind_Ptr
465 -__gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
466 +_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount);
467 +_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int * pcount)
468 {
469 struct unw_eh_callback_data data;
470
471 diff --git a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
472 index 14eb6f6..583eb68 100644
473 --- a/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
474 +++ b/libpthread/linuxthreads.old/sysdeps/arm/pt-machine.h
475 @@ -33,8 +33,8 @@
476 time; let's hope nobody tries to use one. */
477
478 /* Spinlock implementation; required. */
479 -PT_EI long int
480 -testandset (int *spinlock)
481 +PT_EI long int testandset (int *spinlock);
482 +PT_EI long int testandset (int *spinlock)
483 {
484 register unsigned int ret;
485
486 diff --git a/utils/chroot_realpath.c b/utils/chroot_realpath.c
487 index 82ccbf6..d912a06 100644
488 --- a/utils/chroot_realpath.c
489 +++ b/utils/chroot_realpath.c
490 @@ -25,6 +25,9 @@
491 #define MAX_READLINKS 32
492
493 char *chroot_realpath(const char *chroot, const char *path,
494 + char resolved_path[]);
495 +
496 +char *chroot_realpath(const char *chroot, const char *path,
497 char resolved_path[])
498 {
499 char copy_path[PATH_MAX];
500 --
501 Once again all of these reduce the noise from gcc-4.4.
502 Replaces a few more (USE_TLS && HAVE___THREAD) with USE___THREAD while we need
503 to mess with them for this anyhow.
504
505 Signed-off-by: Ron Lee <ron@debian.org>
506 ---
507 libc/misc/fnmatch/fnmatch.c | 2 +-
508 libpthread/linuxthreads.old/cancel.c | 6 +++---
509 libpthread/linuxthreads.old/libc_pthread_init.c | 4 ++--
510 libpthread/linuxthreads.old/pthread.c | 2 +-
511 libpthread/linuxthreads.old/ptlongjmp.c | 4 ++--
512 libpthread/linuxthreads.old/specific.c | 2 +-
513 .../linuxthreads.old_db/td_thr_tls_get_addr.c | 2 +-
514 7 files changed, 11 insertions(+), 11 deletions(-)
515
516 Index: uClibc-0.9.30.1/libc/misc/fnmatch/fnmatch.c
517 ===================================================================
518 --- uClibc-0.9.30.1.orig/libc/misc/fnmatch/fnmatch.c 2008-06-01 22:44:48.000000000 +0200
519 +++ uClibc-0.9.30.1/libc/misc/fnmatch/fnmatch.c 2009-07-06 21:16:29.000000000 +0200
520 @@ -17,7 +17,7 @@
521 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
522 02111-1307 USA. */
523
524 -#if HAVE_CONFIG_H
525 +#ifdef HAVE_CONFIG_H
526 # include <config.h>
527 #endif
528
529 Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/cancel.c
530 ===================================================================
531 --- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/cancel.c 2008-07-23 13:23:36.000000000 +0200
532 +++ uClibc-0.9.30.1/libpthread/linuxthreads.old/cancel.c 2009-07-06 21:16:29.000000000 +0200
533 @@ -31,7 +31,7 @@
534
535 #ifdef _STACK_GROWS_DOWN
536 # define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other)
537 -#elif _STACK_GROWS_UP
538 +#elif defined _STACK_GROWS_UP
539 # define FRAME_LEFT(frame, other) ((char *) frame <= (char *) other)
540 #else
541 # error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
542 @@ -193,10 +193,10 @@
543
544 for (c = THREAD_GETMEM(self, p_cleanup); c != NULL; c = c->__prev)
545 {
546 -#if _STACK_GROWS_DOWN
547 +#ifdef _STACK_GROWS_DOWN
548 if ((char *) c <= currentframe)
549 break;
550 -#elif _STACK_GROWS_UP
551 +#elif defined _STACK_GROWS_UP
552 if ((char *) c >= currentframe)
553 break;
554 #else
555 Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/libc_pthread_init.c
556 ===================================================================
557 --- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/libc_pthread_init.c 2008-05-20 10:47:51.000000000 +0200
558 +++ uClibc-0.9.30.1/libpthread/linuxthreads.old/libc_pthread_init.c 2009-07-06 21:17:10.000000000 +0200
559 @@ -26,7 +26,7 @@
560
561 /* Experimentally off - libc_hidden_proto(memcpy) */
562
563 -#if !(USE_TLS && HAVE___THREAD) && defined __UCLIBC_HAS_XLOCALE__
564 +#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__
565 libc_hidden_proto(uselocale)
566 #endif
567
568 @@ -42,7 +42,7 @@
569 sizeof (__libc_pthread_functions));
570 #endif
571
572 -#if !(USE_TLS && HAVE___THREAD) && defined __UCLIBC_HAS_XLOCALE__
573 +#if ! defined USE___THREAD && defined __UCLIBC_HAS_XLOCALE__
574 /* Initialize thread-locale current locale to point to the global one.
575 With __thread support, the variable's initializer takes care of this. */
576 uselocale (LC_GLOBAL_LOCALE);
577 Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/pthread.c
578 ===================================================================
579 --- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/pthread.c 2008-10-03 15:59:52.000000000 +0200
580 +++ uClibc-0.9.30.1/libpthread/linuxthreads.old/pthread.c 2009-07-06 21:17:53.000000000 +0200
581 @@ -321,7 +321,7 @@
582
583 struct pthread_functions __pthread_functions =
584 {
585 -#if !(USE_TLS && HAVE___THREAD)
586 +#ifndef USE___THREAD
587 .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set,
588 .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get,
589 .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address,
590 Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/ptlongjmp.c
591 ===================================================================
592 --- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/ptlongjmp.c 2006-11-09 09:11:33.000000000 +0100
593 +++ uClibc-0.9.30.1/libpthread/linuxthreads.old/ptlongjmp.c 2009-07-06 21:16:29.000000000 +0200
594 @@ -35,13 +35,13 @@
595 c != NULL && _JMPBUF_UNWINDS(target, c);
596 c = c->__prev)
597 {
598 -#if _STACK_GROWS_DOWN
599 +#ifdef _STACK_GROWS_DOWN
600 if ((char *) c <= currentframe)
601 {
602 c = NULL;
603 break;
604 }
605 -#elif _STACK_GROWS_UP
606 +#elif defined _STACK_GROWS_UP
607 if ((char *) c >= currentframe)
608 {
609 c = NULL;
610 Index: uClibc-0.9.30.1/libpthread/linuxthreads.old/specific.c
611 ===================================================================
612 --- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old/specific.c 2008-05-20 10:47:51.000000000 +0200
613 +++ uClibc-0.9.30.1/libpthread/linuxthreads.old/specific.c 2009-07-06 21:18:28.000000000 +0200
614 @@ -167,7 +167,7 @@
615 __pthread_unlock(THREAD_GETMEM(self, p_lock));
616 }
617
618 -#if !(USE_TLS && HAVE___THREAD)
619 +#ifndef USE___THREAD
620
621 /* Thread-specific data for libc. */
622
623 Index: uClibc-0.9.30.1/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c
624 ===================================================================
625 --- uClibc-0.9.30.1.orig/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c 2005-11-22 22:32:06.000000000 +0100
626 +++ uClibc-0.9.30.1/libpthread/linuxthreads.old_db/td_thr_tls_get_addr.c 2009-07-06 21:16:29.000000000 +0200
627 @@ -31,7 +31,7 @@
628 size_t offset __attribute__ ((unused)),
629 void **address __attribute__ ((unused)))
630 {
631 -#if USE_TLS
632 +#ifdef USE_TLS
633 size_t modid;
634 union dtv pdtv, *dtvp;
635
636 elf.h needs __BYTE_ORDER, and s_scalbn.c needs {LONG,INT}_MAX.
637 shm.c complains about no prototypes for shm_{open,unlink} without its header.
638
639 Signed-off-by: Ron Lee <ron@debian.org>
640 ---
641 include/elf.h | 1 +
642 libm/s_scalbn.c | 1 +
643 librt/shm.c | 1 +
644 3 files changed, 3 insertions(+), 0 deletions(-)
645
646 diff --git a/include/elf.h b/include/elf.h
647 index 0129f1e..16a6972 100644
648 --- a/include/elf.h
649 +++ b/include/elf.h
650 @@ -28,6 +28,7 @@ extern "C" {
651 /* Standard ELF types. */
652
653 #include <stdint.h>
654 +#include <endian.h>
655
656 /* Type for a 16-bit quantity. */
657 typedef uint16_t Elf32_Half;
658 diff --git a/libm/s_scalbn.c b/libm/s_scalbn.c
659 index c534467..47983b0 100644
660 --- a/libm/s_scalbn.c
661 +++ b/libm/s_scalbn.c
662 @@ -18,6 +18,7 @@
663
664 #include "math.h"
665 #include "math_private.h"
666 +#include <limits.h>
667
668 static const double
669 two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
670 --
671 gcc-4.4 barks about that.
672
673 Signed-off-by: Ron Lee <ron@debian.org>
674 ---
675 utils/ldconfig.c | 4 ++--
676 1 files changed, 2 insertions(+), 2 deletions(-)
677
678 diff --git a/utils/ldconfig.c b/utils/ldconfig.c
679 index 3bd7cee..505316b 100644
680 --- a/utils/ldconfig.c
681 +++ b/utils/ldconfig.c
682 @@ -127,14 +127,14 @@ static void attribute_noreturn err(int errnum, const char *s, ...)
683
684 static void vperror_msg(const char *s, va_list p)
685 {
686 - int err = errno;
687 + int e = errno;
688
689 if (s == 0)
690 s = "";
691 verror_msg(s, p);
692 if (*s)
693 s = ": ";
694 - fprintf(stderr, "%s%s\n", s, strerror(err));
695 + fprintf(stderr, "%s%s\n", s, strerror(e));
696 }
697
698 static void warn(const char *s, ...)
699 --
700 Signed-off-by: Ron Lee <ron@debian.org>
701 ---
702 utils/ldconfig.c | 10 +++++-----
703 utils/ldd.c | 4 ++--
704 2 files changed, 7 insertions(+), 7 deletions(-)
705
706 diff --git a/utils/ldconfig.c b/utils/ldconfig.c
707 index 505316b..139b5f9 100644
708 --- a/utils/ldconfig.c
709 +++ b/utils/ldconfig.c
710 @@ -558,18 +558,18 @@ static char *get_extpath(void)
711 {
712 char *res = NULL, *cp;
713 FILE *file;
714 - struct stat stat;
715 + struct stat st;
716 char realconffile[BUFFER_SIZE];
717
718 if (!chroot_realpath(chroot_dir, conffile, realconffile))
719 return NULL;
720
721 if ((file = fopen(realconffile, "r")) != NULL) {
722 - fstat(fileno(file), &stat);
723 - res = xmalloc(stat.st_size + 1);
724 - fread(res, 1, stat.st_size, file);
725 + fstat(fileno(file), &st);
726 + res = xmalloc(st.st_size + 1);
727 + fread(res, 1, st.st_size, file);
728 fclose(file);
729 - res[stat.st_size] = '\0';
730 + res[st.st_size] = '\0';
731
732 /* convert comments fo spaces */
733 for (cp = res; *cp; /*nada */ ) {
734 diff --git a/utils/ldd.c b/utils/ldd.c
735 index 02b37f1..e7a94cb 100644
736 --- a/utils/ldd.c
737 +++ b/utils/ldd.c
738 @@ -683,8 +683,8 @@ foo:
739 && ehdr->e_ident[EI_VERSION] == EV_CURRENT
740 && MATCH_MACHINE(ehdr->e_machine))
741 {
742 - struct stat statbuf;
743 - if (stat(interp->path, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) {
744 + struct stat st;
745 + if (stat(interp->path, &st) == 0 && S_ISREG(st.st_mode)) {
746 pid_t pid;
747 int status;
748 static const char *const environment[] = {
749 --
750 Signed-off-by: Ron Lee <ron@debian.org>
751 ---
752 libpthread/linuxthreads.old/manager.c | 4 ++--
753 1 files changed, 2 insertions(+), 2 deletions(-)
754
755 diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c
756 index 0617d7d..88c9253 100644
757 --- a/libpthread/linuxthreads.old/manager.c
758 +++ b/libpthread/linuxthreads.old/manager.c
759 @@ -578,9 +578,9 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
760 /* See whether the TD_CREATE event bit is set in any of the
761 masks. */
762 int idx = __td_eventword (TD_CREATE);
763 - uint32_t mask = __td_eventmask (TD_CREATE);
764 + uint32_t m = __td_eventmask (TD_CREATE);
765
766 - if ((mask & (__pthread_threads_events.event_bits[idx]
767 + if ((m & (__pthread_threads_events.event_bits[idx]
768 | event_maskp->event_bits[idx])) != 0)
769 {
770 /* Lock the mutex the child will use now so that it will stop. */
771 --
772 Signed-off-by: Ron Lee <ron@debian.org>
773 ---
774 utils/chroot_realpath.c | 12 ++++++------
775 1 files changed, 6 insertions(+), 6 deletions(-)
776
777 diff --git a/utils/chroot_realpath.c b/utils/chroot_realpath.c
778 index d912a06..0be57bf 100644
779 --- a/utils/chroot_realpath.c
780 +++ b/utils/chroot_realpath.c
781 @@ -24,10 +24,10 @@
782
783 #define MAX_READLINKS 32
784
785 -char *chroot_realpath(const char *chroot, const char *path,
786 +char *chroot_realpath(const char *root, const char *path,
787 char resolved_path[]);
788
789 -char *chroot_realpath(const char *chroot, const char *path,
790 +char *chroot_realpath(const char *root, const char *path,
791 char resolved_path[])
792 {
793 char copy_path[PATH_MAX];
794 @@ -41,13 +41,13 @@ char *chroot_realpath(const char *chroot, const char *path,
795 int chroot_len;
796
797 /* Trivial case. */
798 - if (chroot == NULL || *chroot == '\0' ||
799 - (*chroot == '/' && chroot[1] == '\0')) {
800 + if (root == NULL || *root == '\0' ||
801 + (*root == '/' && root[1] == '\0')) {
802 strcpy(resolved_path, path);
803 return resolved_path;
804 }
805
806 - chroot_len = strlen(chroot);
807 + chroot_len = strlen(root);
808
809 if (chroot_len + strlen(path) >= PATH_MAX - 3) {
810 errno = ENAMETOOLONG;
811 @@ -60,7 +60,7 @@ char *chroot_realpath(const char *chroot, const char *path,
812 max_path = copy_path + PATH_MAX - chroot_len - 3;
813
814 /* Start with the chroot path. */
815 - strcpy(new_path, chroot);
816 + strcpy(new_path, root);
817 new_path += chroot_len;
818 while (*new_path == '/' && new_path > got_path)
819 new_path--;
820 --
821 Signed-off-by: Ron Lee <ron@debian.org>
822 ---
823 ldso/ldso/dl-elf.c | 4 +++-
824 ldso/ldso/dl-startup.c | 3 ++-
825 libc/inet/getaddrinfo.c | 9 ++++++---
826 3 files changed, 11 insertions(+), 5 deletions(-)
827
828 Index: uClibc-0.9.30.1/ldso/ldso/dl-elf.c
829 ===================================================================
830 --- uClibc-0.9.30.1.orig/ldso/ldso/dl-elf.c 2008-11-18 15:01:35.000000000 +0100
831 +++ uClibc-0.9.30.1/ldso/ldso/dl-elf.c 2009-07-06 21:20:03.000000000 +0200
832 @@ -341,6 +341,7 @@
833 ElfW(Addr) relro_addr = 0;
834 size_t relro_size = 0;
835 struct stat st;
836 + uint32_t *p32;
837 DL_LOADADDR_TYPE lib_loadaddr;
838 DL_INIT_LOADADDR_EXTRA_DECLS
839
840 Index: uClibc-0.9.30.1/ldso/ldso/dl-startup.c
841 ===================================================================
842 --- uClibc-0.9.30.1.orig/ldso/ldso/dl-startup.c 2008-05-30 16:22:26.000000000 +0200
843 +++ uClibc-0.9.30.1/ldso/ldso/dl-startup.c 2009-07-06 21:20:03.000000000 +0200
844 @@ -122,6 +122,7 @@
845 struct elf_resolve *tpnt = &tpnt_tmp;
846 ElfW(auxv_t) auxvt[AT_EGID + 1];
847 ElfW(Dyn) *dpnt;
848 + uint32_t *p32;
849
850 /* WARNING! -- we cannot make _any_ funtion calls until we have
851 * taken care of fixing up our own relocations. Making static
852 Index: uClibc-0.9.30.1/libc/inet/getaddrinfo.c
853 ===================================================================
854 --- uClibc-0.9.30.1.orig/libc/inet/getaddrinfo.c 2009-02-26 13:49:14.000000000 +0100
855 +++ uClibc-0.9.30.1/libc/inet/getaddrinfo.c 2009-07-06 21:20:03.000000000 +0200
856 @@ -539,7 +539,8 @@
857
858 if (scope_delim != NULL) {
859 int try_numericscope = 0;
860 - if (IN6_IS_ADDR_LINKLOCAL(at->addr) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) {
861 + uint32_t *a32 = (uint32_t*)at->addr;
862 + if (IN6_IS_ADDR_LINKLOCAL(a32) || IN6_IS_ADDR_MC_LINKLOCAL(at->addr)) {
863 at->scopeid = if_nametoindex(scope_delim + 1);
864 if (at->scopeid == 0)
865 try_numericscope = 1;
866 @@ -617,8 +618,10 @@
867 #endif
868 if (req->ai_family == 0 || req->ai_family == AF_INET) {
869 atr->family = AF_INET;
870 - if ((req->ai_flags & AI_PASSIVE) == 0)
871 - *(uint32_t*)atr->addr = htonl(INADDR_LOOPBACK);
872 + if ((req->ai_flags & AI_PASSIVE) == 0) {
873 + uint32_t *a = (uint32_t*)atr->addr;
874 + *a = htonl(INADDR_LOOPBACK);
875 + }
876 }
877 }
878
879 From 8ee834680d39677a60e26a0de4ece2f0c1ebbde2 Mon Sep 17 00:00:00 2001
880 From: Ron <ron@debian.org>
881 Date: Sat, 27 Jun 2009 04:44:27 +0930
882 Subject: [PATCH] Avoid warnings about shifting more bits than we have
883
884 The test here is a constant expression and will compile out.
885 For platforms that don't need the shift the code gets slightly smaller
886 and simpler, for those that do the result is unchanged.
887
888 Signed-off-by: Ron Lee <ron@debian.org>
889 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
890 ---
891 libc/sysdeps/linux/arm/posix_fadvise.c | 6 ++++--
892 1 files changed, 4 insertions(+), 2 deletions(-)
893
894 --- a/libc/sysdeps/linux/arm/posix_fadvise.c
895 +++ b/libc/sysdeps/linux/arm/posix_fadvise.c
896 @@ -10,6 +10,9 @@
897 #include <sys/syscall.h>
898 #include <fcntl.h>
899 #if defined __NR_arm_fadvise64_64
900 +
901 +#define HIGH_BITS(x) (sizeof(x) > 4 ? (x) >> 32 : 0)
902 +
903 /* This is for the ARM version of fadvise64_64 which swaps the params
904 * * about to avoid having ABI compat issues
905 * */
906 @@ -18,8 +21,8 @@
907 {
908 INTERNAL_SYSCALL_DECL (err);
909 int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
910 - __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
911 - __LONG_LONG_PAIR ((long)(len >> 32), (long)len));
912 + __LONG_LONG_PAIR (HIGH_BITS(offset), (long)offset),
913 + __LONG_LONG_PAIR (HIGH_BITS(len), (long)len));
914
915 if (INTERNAL_SYSCALL_ERROR_P (ret, err))
916 return INTERNAL_SYSCALL_ERRNO (ret, err);