This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ia64 pagesize patch


On Thu, Jan 04, 2001 at 04:05:20PM +0100, Andreas Schwab wrote:
> Jes Sorensen <jes@linuxcare.com> writes:
> 
> |> >>>>> "Ulrich" == Ulrich Drepper <drepper@redhat.com> writes:
> |> 
> |> Ulrich> Jes Sorensen <jes@linuxcare.com> writes:
> |> >> The only question is whether it would make more sense to default to
> |> >> the maximum allowable page size for the default?
> |> 
> |> Ulrich> Have you decided what you want to do?
> |> 
> |> I am currently on vacation so I haven't had time to deal with it. If
> |> we are guaranteed AT_PAGESZ to  be set on modern kernels I'd be ok
> |> with the panic() approach you suggested. I need to bounce this by the
> |> ia64 people to see if they have any objections.
> 
> The AT_PAGESZ approach doesn't seem to work for statically linked
> binaries.
> 
> Andreas.
> 

Here is a patch. BTW, _dl_clktck and _dl_pagesize only work with 2.4
kernel.


-- 
H.J. Lu (hjl@valinux.com)
---
2001-01-04  H.J. Lu  <hjl@gnu.org>

	* elf/dl-support.c (DL_FIND_AUXV): New. Defined if not defined.
	(_dl_clktck): Declared.
	(non_dynamic_init): Take 3 arguments.
	Set _dl_pagesize, _dl_platform and _dl_clktck from AUX.

Index: elf/dl-support.c
===================================================================
RCS file: /work/cvs/gnu/glibc/elf/dl-support.c,v
retrieving revision 1.1.1.7
diff -u -p -r1.1.1.7 dl-support.c
--- elf/dl-support.c	2000/09/26 17:32:14	1.1.1.7
+++ elf/dl-support.c	2001/01/04 22:56:42
@@ -107,15 +107,46 @@ int _dl_starting_up = 1;
    At this time it is not anymore a problem to modify the tables.  */
 __libc_lock_define_initialized_recursive (, _dl_load_lock)
 
+#ifndef DL_FIND_AUXV
+#define DL_FIND_AUXV(auxp,envp) \
+  do { \
+    void **_tmp; \
+    for (_tmp = (void **) (envp); *_tmp; ++_tmp) \
+      continue; \
+    (auxp) = (void *) ++_tmp; \
+  } while (0)
+#endif
 
-static void non_dynamic_init (void) __attribute__ ((unused));
+extern int _dl_clktck;
 
+static void non_dynamic_init (int argc, char **argv, char **envp)
+  __attribute__ ((unused));
+
 static void
-non_dynamic_init (void)
+non_dynamic_init (int argc, char **argv, char **envp)
 {
-  _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1;
+  ElfW(auxv_t) *av;
+
+  DL_FIND_AUXV (av, envp);
 
-  _dl_pagesize = __getpagesize ();
+  for (; av->a_type != AT_NULL; ++av)
+    switch (av->a_type)
+      {
+      case AT_PAGESZ:
+	_dl_pagesize = av->a_un.a_val;
+	break;
+      case AT_PLATFORM:
+	_dl_platform = av->a_un.a_ptr;
+	break;
+      case AT_CLKTCK:
+	_dl_clktck = av->a_un.a_val;
+	break;
+      }
+
+  if (!_dl_pagesize)
+    _dl_pagesize = __getpagesize ();
+
+  _dl_verbose = *(getenv ("LD_WARN") ?: "") == '\0' ? 0 : 1;
 
   /* Initialize the data structures for the search paths for shared
      objects.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]