1 commit 6e502e19455c6110dd4487d91b7b7d6d8121f9ba
2 Author: Ulrich Drepper <drepper@gmail.com>
3 Date: Wed Jun 22 08:32:55 2011 -0400
5 Clean up after kernel sigcontext header mess
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
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.
16 The GNU C Library is free software; you can redistribute it and/or
18 # define sigcontext_struct sigcontext
20 # include <asm/sigcontext.h>
22 +/* The Linux kernel headers redefine NULL wrongly, so cleanup afterwards. */
26 commit 852eb34d5c56bc75bdd82327fcf310d98655f6b0
27 Author: Ulrich Drepper <drepper@gmail.com>
28 Date: Wed Jun 22 09:50:39 2011 -0400
30 Rate limit expensive _SC_NPROCESSORS_ONLN computation
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
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.
46 #include <not-cancel.h>
47 +#include <kernel-features.h>
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
55 +# include <bits/libc-vdso.h>
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,
64 + static int cached_result;
65 + static time_t timestamp;
67 +#ifdef __ASSUME_POSIX_TIMERS
69 + INTERNAL_SYSCALL_DECL (err);
70 + INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, &ts);
73 + gettimeofday (&ts, NULL);
75 + time_t prev = timestamp;
76 + atomic_read_barrier ();
77 + if (ts.tv_sec == prev)
78 + return cached_result;
80 /* XXX Here will come a test for the new system call. */
82 const size_t buffer_size = __libc_use_alloca (8192) ? 8192 : 512;
83 @@ -169,6 +195,10 @@ __get_nprocs ()
87 + cached_result = result;
88 + atomic_write_barrier ();
89 + timestamp = ts.tv_sec;
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
98 Use a /sys/devices/system/cpu/online for _SC_NPROCESSORS_ONLN implementation
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;
111 const int flags = O_RDONLY | O_CLOEXEC;
113 const int flags = O_RDONLY;
115 + int fd = open_not_cancel_2 ("/sys/devices/system/cpu/online", flags);
120 + l = next_line (fd, buffer, &cp, &re, buffer_end);
125 + unsigned long int n = strtoul (l, &endp, 10);
132 + unsigned long int m = n;
136 + m = strtoul (l, &endp, 10);
144 + result += m - n + 1;
147 + while (l < re && isspace (*l))
152 + close_not_cancel_no_status (fd);
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);
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 ()
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
185 Consolidate shlib.lds references in new variables.
187 diff --git a/Makerules b/Makerules
188 index 6b4b0e1..d3cb4cc 100644
191 @@ -514,8 +514,11 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
193 common-generated += shlib.lds
195 +shlib-lds = $(common-objpfx)shlib.lds
196 +shlib-lds-flags = -T $(shlib-lds)
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)
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
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)
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
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
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))
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
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))
243 $(objpfx)$(mod).so: $(addprefix $(objpfx),$(addsuffix .os,$($(mod)-routines)))\
244 - $(common-objpfx)shlib.lds
246 $(build-module-asneeded)
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
253 Add --with-default-link configure option.
255 diff --git a/Makerules b/Makerules
256 index d3cb4cc..23d9f1c 100644
259 @@ -479,6 +479,11 @@ endif
263 +ifeq (yes,$(use-default-link))
264 +# If the linker is good enough, we can let it use its default linker script.
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
273 shlib-lds = $(common-objpfx)shlib.lds
274 shlib-lds-flags = -T $(shlib-lds)
278 $(build-shlib-helper) -o $@ $(shlib-lds-flags) \
279 diff --git a/config.make.in b/config.make.in
280 index 0656b1b..34842bf 100644
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@
286 have-hash-style = @libc_cv_hashstyle@
287 +use-default-link = @use_default_link@
289 static-libgcc = @libc_cv_gcc_static_libgcc@
291 diff --git a/configure b/configure
292 index 20e7340..e8ad775 100755
295 @@ -696,6 +696,7 @@ force_install
303 @@ -770,6 +771,7 @@ with_selinux
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
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
329 + use_default_link=no
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
340 @@ -114,6 +114,14 @@ AC_ARG_WITH([headers],
341 [sysheaders=$withval],
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])
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
359 Use linker --print-output-format option if available.
361 diff --git a/Makerules b/Makerules
362 index d70a196..a8b575c 100644
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))'
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
378 common-generated += format.lds
380 diff --git a/config.make.in b/config.make.in
381 index b73b21e..407ebc1 100644
384 @@ -70,6 +70,7 @@ fno-unit-at-a-time = @fno_unit_at_a_time@
386 have-hash-style = @libc_cv_hashstyle@
387 use-default-link = @use_default_link@
388 +output-format = @libc_cv_output_format@
390 static-libgcc = @libc_cv_gcc_static_libgcc@
392 diff --git a/configure b/configure
393 index 2568345..55a4b30 100755
396 @@ -647,6 +647,7 @@ libc_cv_have_initfini
400 +libc_cv_output_format
404 @@ -6703,6 +6704,24 @@ $as_echo "$libc_cv_hashstyle" >&6; }
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
413 + if libc_cv_output_format=`
414 +${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&5`
418 + libc_cv_output_format=
420 +test -n "$libc_cv_output_format" || libc_cv_output_format=unknown
422 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_output_format" >&5
423 +$as_echo "$libc_cv_output_format" >&6; }
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
433 @@ -1803,6 +1803,17 @@ EOF
434 AC_SUBST(libc_cv_hashstyle)
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`
443 + libc_cv_output_format=
445 +test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
446 +AC_SUBST(libc_cv_output_format)
448 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
449 cat > conftest.c <<EOF