]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-git.patch
- @BASH@ not expanded, "hardcode" in
[packages/glibc.git] / glibc-git.patch
1 commit 6e502e19455c6110dd4487d91b7b7d6d8121f9ba
2 Author: Ulrich Drepper <drepper@gmail.com>
3 Date:   Wed Jun 22 08:32:55 2011 -0400
4
5     Clean up after kernel sigcontext header mess
6
7 diff --git a/sysdeps/unix/sysv/linux/bits/sigcontext.h b/sysdeps/unix/sysv/linux/bits/sigcontext.h
8 index 67dcf94..0f5b607 100644
9 --- a/sysdeps/unix/sysv/linux/bits/sigcontext.h
10 +++ b/sysdeps/unix/sysv/linux/bits/sigcontext.h
11 @@ -1,4 +1,4 @@
12 -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
13 +/* Copyright (C) 1996, 1997, 1998, 2011 Free Software Foundation, Inc.
14     This file is part of the GNU C Library.
15  
16     The GNU C Library is free software; you can redistribute it and/or
17 @@ -26,4 +26,8 @@
18  # define sigcontext_struct sigcontext
19  
20  # include <asm/sigcontext.h>
21 +
22 +/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards.  */
23 +# define __need_NULL
24 +# include <stddef.h>
25  #endif
26 commit 852eb34d5c56bc75bdd82327fcf310d98655f6b0
27 Author: Ulrich Drepper <drepper@gmail.com>
28 Date:   Wed Jun 22 09:50:39 2011 -0400
29
30     Rate limit expensive _SC_NPROCESSORS_ONLN computation
31
32 diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
33 index af454b6..a13b6e3 100644
34 --- a/sysdeps/unix/sysv/linux/getsysstats.c
35 +++ b/sysdeps/unix/sysv/linux/getsysstats.c
36 @@ -1,5 +1,5 @@
37  /* Determine various system internal values, Linux version.
38 -   Copyright (C) 1996-2003,2006,2007,2009,2010 Free Software Foundation, Inc.
39 +   Copyright (C) 1996-2003,2006,2007,2009,2010,2011 Free Software Foundation, Inc.
40     This file is part of the GNU C Library.
41     Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
42  
43 @@ -35,6 +35,16 @@
44  
45  #include <atomic.h>
46  #include <not-cancel.h>
47 +#include <kernel-features.h>
48 +
49 +#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
50 +# undef INTERNAL_VSYSCALL
51 +# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
52 +# undef INLINE_VSYSCALL
53 +# define INLINE_VSYSCALL INLINE_SYSCALL
54 +#else
55 +# include <bits/libc-vdso.h>
56 +#endif
57  
58  
59  /* How we can determine the number of available processors depends on
60 @@ -128,6 +138,22 @@ next_line (int fd, char *const buffer, char **cp, char **re,
61  int
62  __get_nprocs ()
63  {
64 +  static int cached_result;
65 +  static time_t timestamp;
66 +
67 +#ifdef __ASSUME_POSIX_TIMERS
68 +  struct timespec ts;
69 +  INTERNAL_SYSCALL_DECL (err);
70 +  INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts);
71 +#else
72 +  struct timeval ts;
73 +  gettimeofday (&ts, NULL);
74 +#endif
75 +  time_t prev = timestamp;
76 +  atomic_read_barrier ();
77 +  if (ts.tv_sec == prev)
78 +    return cached_result;
79 +
80    /* XXX Here will come a test for the new system call.  */
81  
82    const size_t buffer_size = __libc_use_alloca (8192) ? 8192 : 512;
83 @@ -169,6 +195,10 @@ __get_nprocs ()
84         }
85      }
86  
87 +  cached_result = result;
88 +  atomic_write_barrier ();
89 +  timestamp = ts.tv_sec;
90 +
91    return result;
92  }
93  weak_alias (__get_nprocs, get_nprocs)
94 commit 84e2a551a72c79b020694bb327e33b6d71b09b63
95 Author: Ulrich Drepper <drepper@gmail.com>
96 Date:   Wed Jun 22 10:32:07 2011 -0400
97
98     Use a /sys/devices/system/cpu/online for _SC_NPROCESSORS_ONLN implementation
99
100 diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c
101 index a13b6e3..b74774f 100644
102 --- a/sysdeps/unix/sysv/linux/getsysstats.c
103 +++ b/sysdeps/unix/sysv/linux/getsysstats.c
104 @@ -161,20 +161,65 @@ __get_nprocs ()
105    char *buffer_end = buffer + buffer_size;
106    char *cp = buffer_end;
107    char *re = buffer_end;
108 -  int result = 1;
109  
110  #ifdef O_CLOEXEC
111    const int flags = O_RDONLY | O_CLOEXEC;
112  #else
113    const int flags = O_RDONLY;
114  #endif
115 +  int fd = open_not_cancel_2 ("/sys/devices/system/cpu/online", flags);
116 +  char *l;
117 +  int result = 0;
118 +  if (fd != -1)
119 +    {
120 +      l = next_line (fd, buffer, &cp, &re, buffer_end);
121 +      if (l != NULL)
122 +       do
123 +         {
124 +           char *endp;
125 +           unsigned long int n = strtoul (l, &endp, 10);
126 +           if (l == endp)
127 +             {
128 +               result = 0;
129 +               break;
130 +             }
131 +
132 +           unsigned long int m = n;
133 +           if (*endp == '-')
134 +             {
135 +               l = endp + 1;
136 +               m = strtoul (l, &endp, 10);
137 +               if (l == endp)
138 +                 {
139 +                   result = 0;
140 +                   break;
141 +                 }
142 +             }
143 +
144 +           result += m - n + 1;
145 +
146 +           l = endp;
147 +           while (l < re && isspace (*l))
148 +             ++l;
149 +         }
150 +       while (l < re);
151 +
152 +      close_not_cancel_no_status (fd);
153 +
154 +      if (result > 0)
155 +       goto out;
156 +    }
157 +
158 +  cp = buffer_end;
159 +  re = buffer_end;
160 +  result = 1;
161 +
162    /* The /proc/stat format is more uniform, use it by default.  */
163 -  int fd = open_not_cancel_2 ("/proc/stat", flags);
164 +  fd = open_not_cancel_2 ("/proc/stat", flags);
165    if (fd != -1)
166      {
167        result = 0;
168  
169 -      char *l;
170        while ((l = next_line (fd, buffer, &cp, &re, buffer_end)) != NULL)
171         /* The current format of /proc/stat has all the cpu* entries
172            at the front.  We assume here that stays this way.  */
173 @@ -195,6 +240,7 @@ __get_nprocs ()
174         }
175      }
176  
177 + out:
178    cached_result = result;
179    atomic_write_barrier ();
180    timestamp = ts.tv_sec;
181 commit 2d4fa81e11abc464b5b1f6417525285e84ff787c
182 Author: Roland McGrath <roland@hack.frob.com>
183 Date:   Sat Jun 11 03:41:23 2011 -0700
184
185     Consolidate shlib.lds references in new variables.
186
187 diff --git a/Makerules b/Makerules
188 index 6b4b0e1..d3cb4cc 100644
189 --- a/Makerules
190 +++ b/Makerules
191 @@ -514,8 +514,11 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
192         mv -f $@T $@
193  common-generated += shlib.lds
194  
195 +shlib-lds = $(common-objpfx)shlib.lds
196 +shlib-lds-flags = -T $(shlib-lds)
197 +
198  define build-shlib
199 -$(build-shlib-helper) -o $@ -T $(common-objpfx)shlib.lds \
200 +$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
201           $(csu-objpfx)abi-note.o $(build-shlib-objlist)
202  endef
203  else
204 @@ -557,11 +560,11 @@ ifeq (yes,$(elf))
205  # binutils only position loadable notes into the first page for binaries,
206  # not for shared objects
207  define build-module
208 -$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
209 +$(build-module-helper) -o $@ $(shlib-lds-flags) \
210           $(csu-objpfx)abi-note.o $(build-module-objlist)
211  endef
212  define build-module-asneeded
213 -$(build-module-helper) -o $@ -T $(common-objpfx)shlib.lds \
214 +$(build-module-helper) -o $@ $(shlib-lds-flags) \
215           $(csu-objpfx)abi-note.o \
216           -Wl,--as-needed $(build-module-objlist) -Wl,--no-as-needed
217  endef
218 @@ -618,7 +621,7 @@ $(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
219                          $(common-objpfx)libc_pic.os \
220                          $(elfobjdir)/sofini.os \
221                          $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
222 -                        $(common-objpfx)shlib.lds
223 +                        $(shlib-lds)
224         $(build-shlib)
225  ifeq ($(versioning),yes)
226  $(common-objpfx)libc.so: $(common-objpfx)libc.map
227 @@ -689,7 +692,7 @@ include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
228  
229  extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
230  $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
231 -               $(objpfx)%.os $(common-objpfx)shlib.lds \
232 +               $(objpfx)%.os $(shlib-lds) \
233                 $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
234         $(build-module)
235  endif
236 diff --git a/iconvdata/extra-module.mk b/iconvdata/extra-module.mk
237 index 163074f..43f4e12 100644
238 --- a/iconvdata/extra-module.mk
239 +++ b/iconvdata/extra-module.mk
240 @@ -4,7 +4,7 @@ extra-modules-left := $(strip $(filter-out $(mod),$(extra-modules-left)))
241  extra-objs := $(extra-objs) $(patsubst %,%.os,$($(mod)-routines))
242  
243  $(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\
244 -                   $(common-objpfx)shlib.lds
245 +                   $(shlib-lds)
246         $(build-module-asneeded)
247  
248  # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
249 commit f781ef4015504e8a1da649c266584976238aa079
250 Author: Roland McGrath <roland@hack.frob.com>
251 Date:   Sat Jun 11 04:16:49 2011 -0700
252
253     Add --with-default-link configure option.
254
255 diff --git a/Makerules b/Makerules
256 index d3cb4cc..23d9f1c 100644
257 --- a/Makerules
258 +++ b/Makerules
259 @@ -479,6 +479,11 @@ endif
260  endif
261  
262  ifeq (yes,$(elf))
263 +ifeq (yes,$(use-default-link))
264 +# If the linker is good enough, we can let it use its default linker script.
265 +shlib-lds =
266 +shlib-lds-flags =
267 +else
268  # binutils only position loadable notes into the first page for binaries,
269  # not for shared objects
270  $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
271 @@ -516,6 +521,7 @@ common-generated += shlib.lds
272  
273  shlib-lds = $(common-objpfx)shlib.lds
274  shlib-lds-flags = -T $(shlib-lds)
275 +endif
276  
277  define build-shlib
278  $(build-shlib-helper) -o $@ $(shlib-lds-flags) \
279 diff --git a/config.make.in b/config.make.in
280 index 0656b1b..34842bf 100644
281 --- a/config.make.in
282 +++ b/config.make.in
283 @@ -69,6 +69,7 @@ have-cc-with-libunwind = @libc_cv_cc_with_libunwind@
284  fno-unit-at-a-time = @fno_unit_at_a_time@
285  bind-now = @bindnow@
286  have-hash-style = @libc_cv_hashstyle@
287 +use-default-link = @use_default_link@
288  
289  static-libgcc = @libc_cv_gcc_static_libgcc@
290  
291 diff --git a/configure b/configure
292 index 20e7340..e8ad775 100755
293 --- a/configure
294 +++ b/configure
295 @@ -696,6 +696,7 @@ force_install
296  bindnow
297  oldest_abi
298  enable_check_abi
299 +use_default_link
300  with_cvs
301  with_fp
302  ac_ct_CXX
303 @@ -770,6 +771,7 @@ with_selinux
304  with_xcoff
305  with_cvs
306  with_headers
307 +with_default_link
308  enable_sanity_checks
309  enable_check_abi
310  enable_shared
311 @@ -1464,6 +1466,7 @@ Optional Packages:
312    --without-cvs           if CVS should not be used
313    --with-headers=PATH     location of system headers to use (for example
314                            /usr/src/linux/include) [default=compiler default]
315 +  --with-default-link     do not use explicit linker scripts [default=no]
316    --with-tls              enable support for TLS
317    --without-__thread      do not use TLS features even when supporting them
318    --with-cpu=CPU          select code for CPU variant
319 @@ -3581,6 +3584,16 @@ else
320  fi
321  
322  
323 +
324 +
325 +# Check whether --with-default-link was given.
326 +if test "${with_default_link+set}" = set; then :
327 +  withval=$with_default_link; use_default_link=$withval
328 +else
329 +  use_default_link=no
330 +fi
331 +
332 +
333  # Check whether --enable-sanity-checks was given.
334  if test "${enable_sanity_checks+set}" = set; then :
335    enableval=$enable_sanity_checks; enable_sanity=$enableval
336 diff --git a/configure.in b/configure.in
337 index f2b3921..f34aab3 100644
338 --- a/configure.in
339 +++ b/configure.in
340 @@ -114,6 +114,14 @@ AC_ARG_WITH([headers],
341             [sysheaders=$withval],
342             [sysheaders=''])
343  
344 +AC_SUBST(use_default_link)
345 +AC_ARG_WITH([default-link],
346 +           AC_HELP_STRING([--with-default-link],
347 +                          [do not use explicit linker scripts
348 +                           @<:@default=no@:>@]),
349 +           [use_default_link=$withval],
350 +           [use_default_link=no])
351 +
352  AC_ARG_ENABLE([sanity-checks],
353               AC_HELP_STRING([--disable-sanity-checks],
354                              [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
355 commit 5c55070081c27168d27145afdf6a92cd56c9abb3
356 Author: Roland McGrath <roland@hack.frob.com>
357 Date:   Sat Jun 11 00:45:12 2011 -0700
358
359     Use linker --print-output-format option if available.
360
361 diff --git a/Makerules b/Makerules
362 index d70a196..a8b575c 100644
363 --- a/Makerules
364 +++ b/Makerules
365 @@ -990,10 +990,14 @@ install: $(inst_slibdir)/libc.so$(libc.so-version)
366  $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
367                             $(common-objpfx)config.make \
368                             $(common-objpfx)config.h $(..)Makerules
369 +ifneq (unknown,$(output-format))
370 +       echo > $@.new 'OUTPUT_FORMAT($(output-format))'
371 +else
372         $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
373                   -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
374         | sed -n -f $< > $@.new
375         rm -f $@.so
376 +endif
377         mv -f $@.new $@
378  common-generated += format.lds
379  
380 diff --git a/config.make.in b/config.make.in
381 index b73b21e..407ebc1 100644
382 --- a/config.make.in
383 +++ b/config.make.in
384 @@ -70,6 +70,7 @@ fno-unit-at-a-time = @fno_unit_at_a_time@
385  bind-now = @bindnow@
386  have-hash-style = @libc_cv_hashstyle@
387  use-default-link = @use_default_link@
388 +output-format = @libc_cv_output_format@
389  
390  static-libgcc = @libc_cv_gcc_static_libgcc@
391  
392 diff --git a/configure b/configure
393 index 2568345..55a4b30 100755
394 --- a/configure
395 +++ b/configure
396 @@ -647,6 +647,7 @@ libc_cv_have_initfini
397  gnu89_inline
398  libc_cv_ssp
399  fno_unit_at_a_time
400 +libc_cv_output_format
401  libc_cv_hashstyle
402  libc_cv_fpie
403  libc_cv_z_execstack
404 @@ -6703,6 +6704,24 @@ $as_echo "$libc_cv_hashstyle" >&6; }
405  
406  fi
407  
408 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
409 +$as_echo_n "checking linker output format... " >&6; }
410 +if ${libc_cv_output_format+:} false; then :
411 +  $as_echo_n "(cached) " >&6
412 +else
413 +  if libc_cv_output_format=`
414 +${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&5`
415 +then
416 +  :
417 +else
418 +  libc_cv_output_format=
419 +fi
420 +test -n "$libc_cv_output_format" || libc_cv_output_format=unknown
421 +fi
422 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_output_format" >&5
423 +$as_echo "$libc_cv_output_format" >&6; }
424 +
425 +
426  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-toplevel-reorder -fno-section-anchors" >&5
427  $as_echo_n "checking for -fno-toplevel-reorder -fno-section-anchors... " >&6; }
428  if ${libc_cv_fno_toplevel_reorder+:} false; then :
429 diff --git a/configure.in b/configure.in
430 index 55e5649..a28cd70 100644
431 --- a/configure.in
432 +++ b/configure.in
433 @@ -1803,6 +1803,17 @@ EOF
434    AC_SUBST(libc_cv_hashstyle)
435  fi
436  
437 +AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
438 +if libc_cv_output_format=`
439 +${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
440 +then
441 +  :
442 +else
443 +  libc_cv_output_format=
444 +fi
445 +test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
446 +AC_SUBST(libc_cv_output_format)
447 +
448  AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
449  cat > conftest.c <<EOF
450  int foo;
This page took 0.068089 seconds and 3 git commands to generate.