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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Alpha hwcaps


Falk Hueffner <falk.hueffner@student.uni-tuebingen.de> writes:

> You mean like this?

Grr, dl-sysdep.c gets picked up from elsewhere. Next try.

It seems the additional paths are only checked when explicitely
stating a library path:

/# LD_LIBRARY_PATH=/lib strace true                            execve("/bin/true", ["true"], [/* 27 vars */]) = 0                              uname({sys="Linux", node="juist", ...}) = 0
brk(0)                                  = 0x120014000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/lib/ev68/libc.so.6.1", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/lib/ev68", 0x11fffedf0)          = -1 ENOENT (No such file or directory)
open("/lib/ev67/libc.so.6.1", O_RDONLY) = 3
[...]

# strace true                     
execve("/bin/true", ["true"], [/* 26 vars */]) = 0
uname({sys="Linux", node="juist", ...}) = 0
brk(0)                                  = 0x120014000
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=6116, ...}) = 0
mmap(NULL, 6116, PROT_READ, MAP_PRIVATE, 3, 0) = 0x20000018000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6.1", O_RDONLY)      = 3
[...]

Seems /etc/ld.so.cache won't pick up these directories. Rerunning
ldconfig doesn't help. Any hints?

        Falk

--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysdeps/unix/sysv/linux/alpha/dl-sysdep.c	29 Feb 2004 19:40:37 -0000
@@ -0,0 +1,100 @@
+/* Operating system support for run-time dynamic linker.  Alpha version.
+   Contributed by Falk Hueffner <falk@debian.org>, 2004.
+   Copyright (C) 2004 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 <stddef.h>
+
+#include <ldsodefs.h>
+
+/* The model of orthogonal feature bits doesn't really fit Alpha; all
+   we want is to have the list of architectures scanned linearly.
+   Therefore, we override the default _dl_important_hwcaps
+   implementation.  */
+const struct r_strlenpair *
+internal_function
+_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
+		      size_t *max_capstrlen)
+{
+  enum {
+    ARCH_EV7,
+    ARCH_EV68,
+    ARCH_EV67,
+    ARCH_EV6,
+    ARCH_PCA56,
+    ARCH_EV56,
+    ARCH_EV5,
+    ARCH_EV4,
+    ARCH_END = ARCH_EV4
+  };
+#define STRLENPAIR(S) { S, sizeof S - 1 }
+  static const struct r_strlenpair archs[] = {
+    STRLENPAIR("ev7/"),
+    STRLENPAIR("ev68/"),
+    STRLENPAIR("ev67/"),
+    STRLENPAIR("ev6/"),
+    STRLENPAIR("pca56/"),
+    STRLENPAIR("ev56/"),
+    STRLENPAIR("ev5/"),
+  };
+  enum {
+    AMASK_BWX	      = 1 <<  0,
+    AMASK_FIX	      = 1 <<  1,
+    AMASK_CIX	      = 1 <<  2,
+    AMASK_MVI	      = 1 <<  8,
+    AMASK_PREC_TRAPS  = 1 <<  9,
+    AMASK_PREFETCH_WH = 1 << 12,
+  };
+  enum { IMPLVER_EV4, IMPLVER_EV5, IMPLVER_EV6, IMPLVER_EV7 };
+  unsigned long implver, amask;
+  int arch;
+
+  asm ("implver %0" : "=r" (implver));
+  asm ("amask %1,%0" : "=r" (amask) : "r" (-1));
+  amask = ~amask;
+
+  if (implver == IMPLVER_EV4)
+    arch = ARCH_EV4;
+  else if (implver == IMPLVER_EV5)
+    {
+      if (amask & AMASK_MVI)
+	arch = ARCH_PCA56;
+      else if (amask & AMASK_BWX)
+	arch = ARCH_EV56;
+      else
+	arch = ARCH_EV5;
+    }
+  else if (implver == IMPLVER_EV6)
+    {
+      if (amask & AMASK_PREFETCH_WH)
+	arch = ARCH_EV68;
+      else if (amask & AMASK_CIX)
+	arch = ARCH_EV67;
+      else
+	arch = ARCH_EV6;
+    }
+  else
+    arch = ARCH_EV7;
+
+  *sz = ARCH_END - arch;
+  *max_capstrlen = strlen("pca56/");
+  return archs + arch;
+}
+
+#define _DL_IMPORTANT_HWCAPS_DEFINED 1
+#include <sysdeps/unix/sysv/linux/dl-sysdep.c>
Index: sysdeps/generic/dl-sysdep.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/dl-sysdep.c,v
retrieving revision 1.108
diff -u -p -r1.108 dl-sysdep.c
--- sysdeps/generic/dl-sysdep.c	28 Feb 2004 17:55:37 -0000	1.108
+++ sysdeps/generic/dl-sysdep.c	29 Feb 2004 19:40:38 -0000
@@ -332,6 +332,7 @@ _dl_show_auxv (void)
 
 
 /* Return an array of useful/necessary hardware capability names.  */
+#ifndef _DL_IMPORTANT_HWCAPS_DEFINED
 const struct r_strlenpair *
 internal_function
 _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
@@ -512,3 +513,4 @@ _dl_important_hwcaps (const char *platfo
 
   return result;
 }
+#endif /* _DL_IMPORTANT_HWCAPS_DEFINED */

-- 
	Falk


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