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]

Honour LD_HWCAP_MASK in ldconfig



Uli,

following your suggestions, here is a patch for ldconfig.  Now
ldconfig looks into directories specified by LD_HWCAP_MASK.  The only
question I have is whether LD_HWCAP_MASK should override
HWCAP_IMPORTANT (as it does currently) or if we should 'or' them.

Ok to commit?
Andreas

2001-07-17  Andreas Jaeger  <aj@suse.de>

	* elf/ldconfig.c: Add new variable hwcap_mask to honour
	LD_HWCAP_MASK.
	(is_hwcap_platform): Use it.
	(set_hwcap): New function to set hwcap_mask.
	(main): Call set_hwcap.

============================================================
Index: elf/ldconfig.c
--- elf/ldconfig.c	2001/07/06 04:54:46	1.23
+++ elf/ldconfig.c	2001/07/17 07:59:55
@@ -107,6 +107,9 @@ static char *cache_file;
 /* Configuration file.  */
 static const char *config_file;
 
+/* Mask to use for important hardware capabilities.  */
+static unsigned long int hwcap_mask = HWCAP_IMPORTANT;
+
 /* Name and version of program.  */
 static void print_version (FILE *stream, struct argp_state *state);
 void (*argp_program_version_hook) (FILE *, struct argp_state *)
@@ -147,7 +150,7 @@ is_hwcap_platform (const char *name)
 {
   int hwcap_idx = _dl_string_hwcap (name);
 
-  if (hwcap_idx != -1 && ((1 << hwcap_idx) & HWCAP_IMPORTANT))
+  if (hwcap_idx != -1 && ((1 << hwcap_idx) & hwcap_mask))
     return 1;
 
   hwcap_idx = _dl_string_platform (name);
@@ -934,7 +937,17 @@ parse_conf (const char *filename)
   fclose (file);
 }
 
+/* Honour LD_HWCAP_MASK.  */
+static void
+set_hwcap (void)
+{
+  char *mask = getenv ("LD_HWCAP_MASK");
 
+  if (mask)
+    hwcap_mask = strtoul (mask, NULL, 0);
+}
+
+
 int
 main (int argc, char **argv)
 {
@@ -951,6 +964,8 @@ main (int argc, char **argv)
       for (i = remaining; i < argc; ++i)
 	add_dir (argv[i]);
     }
+
+  set_hwcap ();
 
   if (opt_chroot)
     {

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


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