1 --- glibc-2.3.2/sysdeps/generic/ldsodefs.h.orig 2003-10-03 11:47:45.000000000 -0400
2 +++ glibc-2.3.2/sysdeps/generic/ldsodefs.h 2003-10-03 11:48:10.000000000 -0400
3 @@ -292,7 +292,7 @@ struct rtld_global
4 /* The object to be initialized first. */
5 EXTERN struct link_map *_dl_initfirst;
7 -#if HP_TIMING_AVAIL || HP_SMALL_TIMING_AVAIL
8 +#if HP_TIMING_AVAIL || HP_SMALL_TIMING_AVAIL || HP_TIMING_PAD
9 /* Start time on CPU clock. */
10 EXTERN hp_timing_t _dl_cpuclock_offset;
12 --- /dev/null 1969-12-31 19:00:00.000000000 -0500
13 +++ glibc-2.3.2/sysdeps/i386/hp-timing.h 2003-10-03 11:50:30.000000000 -0400
15 +/* High precision, low overhead timing functions. i386 version.
16 + Copyright (C) 2003 Free Software Foundation, Inc.
17 + This file is part of the GNU C Library.
19 + The GNU C Library is free software; you can redistribute it and/or
20 + modify it under the terms of the GNU Lesser General Public
21 + License as published by the Free Software Foundation; either
22 + version 2.1 of the License, or (at your option) any later version.
24 + The GNU C Library is distributed in the hope that it will be useful,
25 + but WITHOUT ANY WARRANTY; without even the implied warranty of
26 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 + Lesser General Public License for more details.
29 + You should have received a copy of the GNU Lesser General Public
30 + License along with the GNU C Library; if not, write to the Free
31 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
34 +#ifndef _i386_HP_TIMING_H
35 +#define _i386_HP_TIMING_H 1
37 +#define hp_timing_t hp_timing_t__
38 +#include <sysdeps/generic/hp-timing.h>
41 +/* We don't use high-precision timers, but we might load an i686 libpthread
43 +#define HP_TIMING_PAD 1
45 +/* i686 uses 64bit values for the times. */
46 +typedef unsigned long long int hp_timing_t;
48 +#endif /* hp-timing.h */
49 --- glibc-2.3.2/elf/Makefile.orig 2003-10-12 13:15:46.000000000 -0400
50 +++ glibc-2.3.2/elf/Makefile 2003-10-12 13:17:38.000000000 -0400
51 @@ -23,7 +23,7 @@ subdir := elf
52 headers = elf.h bits/elfclass.h link.h
53 routines = $(dl-routines) dl-open dl-close dl-support dl-iteratephdr \
54 dl-iteratephdr-static dl-addr enbl-secure dl-profstub \
55 - dl-origin dl-libc dl-sym dl-tsd
56 + dl-origin dl-libc dl-sym dl-tsd dl-altinit
58 # The core dynamic linking functions are in libc for the static and
60 @@ -40,6 +40,10 @@ elide-routines.os = $(all-dl-routines) d
61 rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
62 all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines)
64 +# We only need to re-run initializers if ld.so and libc.so might be built
65 +# for different machines, so only shared libraries need dl-altinit.
66 +shared-only-routines = dl-altinit
68 distribute := rtld-Rules \
69 $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
70 dl-cache.h dl-hash.h soinit.c sofini.c ldd.bash.in \
71 @@ -91,7 +95,7 @@ include ../Makeconfig
73 ifeq ($(unwind-find-fde),yes)
74 routines += unwind-dw2-fde-glibc
75 -shared-only-routines = unwind-dw2-fde-glibc
76 +shared-only-routines += unwind-dw2-fde-glibc
79 before-compile = $(objpfx)trusted-dirs.h
80 --- /dev/null 1969-12-31 19:00:00.000000000 -0500
81 +++ glibc-2.3.2/elf/dl-altinit.c 2003-10-12 13:23:15.000000000 -0400
83 +/* Extra initializers for shared libc.
84 + Copyright (C) 2003 Free Software Foundation, Inc.
85 + This file is part of the GNU C Library.
87 + The GNU C Library is free software; you can redistribute it and/or
88 + modify it under the terms of the GNU Lesser General Public
89 + License as published by the Free Software Foundation; either
90 + version 2.1 of the License, or (at your option) any later version.
92 + The GNU C Library is distributed in the hope that it will be useful,
93 + but WITHOUT ANY WARRANTY; without even the implied warranty of
94 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95 + Lesser General Public License for more details.
97 + You should have received a copy of the GNU Lesser General Public
98 + License along with the GNU C Library; if not, write to the Free
99 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
102 +#include <ldsodefs.h>
103 +#include <hp-timing.h>
105 +/* This file is used from the shared libc, to initialize anything which
106 + ld.so should have initialized but didn't - for instance, if ld.so
107 + is built for a machine without HP_TIMING but libc.so is built for
108 + a machine with HP_TIMING, clock_gettime will expect dl_cpuclock_offset
109 + to be initialized. */
112 +dlinit_hptiming (void)
114 +#if HP_TIMING_AVAIL || HP_SMALL_TIMING_AVAIL
115 + if (GL(dl_cpuclock_offset) == 0)
116 + HP_TIMING_NOW (GL(dl_cpuclock_offset));
120 +static void dlinit_alt (void) __attribute__((constructor));
124 + dlinit_hptiming ();