summaryrefslogtreecommitdiff
path: root/packages/glibc/glibc-2.3.2/glibc-i686-timing.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/glibc/glibc-2.3.2/glibc-i686-timing.patch')
-rw-r--r--packages/glibc/glibc-2.3.2/glibc-i686-timing.patch125
1 files changed, 125 insertions, 0 deletions
diff --git a/packages/glibc/glibc-2.3.2/glibc-i686-timing.patch b/packages/glibc/glibc-2.3.2/glibc-i686-timing.patch
index e69de29bb2..acac110944 100644
--- a/packages/glibc/glibc-2.3.2/glibc-i686-timing.patch
+++ b/packages/glibc/glibc-2.3.2/glibc-i686-timing.patch
@@ -0,0 +1,125 @@
+--- glibc-2.3.2/sysdeps/generic/ldsodefs.h.orig 2003-10-03 11:47:45.000000000 -0400
++++ glibc-2.3.2/sysdeps/generic/ldsodefs.h 2003-10-03 11:48:10.000000000 -0400
+@@ -292,7 +292,7 @@ struct rtld_global
+ /* The object to be initialized first. */
+ EXTERN struct link_map *_dl_initfirst;
+
+-#if HP_TIMING_AVAIL || HP_SMALL_TIMING_AVAIL
++#if HP_TIMING_AVAIL || HP_SMALL_TIMING_AVAIL || HP_TIMING_PAD
+ /* Start time on CPU clock. */
+ EXTERN hp_timing_t _dl_cpuclock_offset;
+
+--- /dev/null 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/sysdeps/i386/hp-timing.h 2003-10-03 11:50:30.000000000 -0400
+@@ -0,0 +1,34 @@
++/* High precision, low overhead timing functions. i386 version.
++ Copyright (C) 2003 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _i386_HP_TIMING_H
++#define _i386_HP_TIMING_H 1
++
++#define hp_timing_t hp_timing_t__
++#include <sysdeps/generic/hp-timing.h>
++#undef hp_timing_t
++
++/* We don't use high-precision timers, but we might load an i686 libpthread
++ which does. */
++#define HP_TIMING_PAD 1
++
++/* i686 uses 64bit values for the times. */
++typedef unsigned long long int hp_timing_t;
++
++#endif /* hp-timing.h */
+--- glibc-2.3.2/elf/Makefile.orig 2003-10-12 13:15:46.000000000 -0400
++++ glibc-2.3.2/elf/Makefile 2003-10-12 13:17:38.000000000 -0400
+@@ -23,7 +23,7 @@ subdir := elf
+ headers = elf.h bits/elfclass.h link.h
+ routines = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \
+ dl-iteratephdr-static dl-addr enbl-secure dl-profstub \
+- dl-origin dl-libc dl-sym dl-tsd
++ dl-origin dl-libc dl-sym dl-tsd dl-altinit
+
+ # The core dynamic linking functions are in libc for the static and
+ # profiled libraries.
+@@ -40,6 +40,10 @@ elide-routines.os = $(all-dl-routines) d
+ rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
+ all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
+
++# We only need to re-run initializers if ld.so and libc.so might be built
++# for different machines, so only shared libraries need dl-altinit.
++shared-only-routines = dl-altinit
++
+ distribute := rtld-Rules \
+ $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
+ dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \
+@@ -91,7 +95,7 @@ include ../Makeconfig
+
+ ifeq ($(unwind-find-fde),yes)
+ routines += unwind-dw2-fde-glibc
+-shared-only-routines = unwind-dw2-fde-glibc
++shared-only-routines += unwind-dw2-fde-glibc
+ endif
+
+ before-compile = $(objpfx)trusted-dirs.h
+--- /dev/null 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/elf/dl-altinit.c 2003-10-12 13:23:15.000000000 -0400
+@@ -0,0 +1,43 @@
++/* Extra initializers for shared libc.
++ Copyright (C) 2003 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#include <ldsodefs.h>
++#include <hp-timing.h>
++
++/* This file is used from the shared libc, to initialize anything which
++ ld.so should have initialized but didn't - for instance, if ld.so
++ is built for a machine without HP_TIMING but libc.so is built for
++ a machine with HP_TIMING, clock_gettime will expect dl_cpuclock_offset
++ to be initialized. */
++
++static void
++dlinit_hptiming (void)
++{
++#if HP_TIMING_AVAIL || HP_SMALL_TIMING_AVAIL
++ if (GL(dl_cpuclock_offset) == 0)
++ HP_TIMING_NOW (GL(dl_cpuclock_offset));
++#endif
++}
++
++static void dlinit_alt (void) __attribute__((constructor));
++static void
++dlinit_alt (void)
++{
++ dlinit_hptiming ();
++}