Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 2003d1abfa0c20ee77815f0da33e2c1c > files > 170

glibc-2.5-49.el5_5.5.src.rpm

--- libc/fedora/glibc_post_upgrade.c	3 Aug 2006 18:17:21 -0000	1.1.2.9
+++ libc/fedora/glibc_post_upgrade.c	25 Aug 2007 19:15:32 -0000	1.1.2.10
@@ -27,6 +27,39 @@ __attribute__((noinline)) void sayn (lon
 __attribute__((noinline)) void message (char *const path[]);
 __attribute__((noinline)) int check_elf (const char *name);
 
+#ifdef __i386__
+static int
+is_ia64 (void)
+{
+  unsigned int fl1, fl2;
+
+  /* See if we can use cpuid.  */
+  __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
+	   "pushl %0; popfl; pushfl; popl %0; popfl"
+	   : "=&r" (fl1), "=&r" (fl2)
+	   : "i" (0x00200000));
+  if (((fl1 ^ fl2) & 0x00200000) == 0)
+    return 0;
+
+  /* Host supports cpuid.  See if cpuid gives capabilities, try
+     CPUID(0).  Preserve %ebx and %ecx; cpuid insn clobbers these, we
+     don't need their CPUID values here, and %ebx may be the PIC
+     register.  */
+  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+	   : "=a" (fl1) : "0" (0) : "edx", "cc");
+  if (fl1 == 0)
+    return 0;
+
+  /* Invoke CPUID(1), return %edx; caller can examine bits to
+     determine what's supported.  */
+  __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+	   : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
+  return (fl2 & (1 << 30)) != 0;
+}
+#else
+#define is_ia64() 0
+#endif
+
 int
 main (void)
 {
@@ -122,9 +155,16 @@ main (void)
 #ifndef ICONVCONFIG
 #define ICONVCONFIG "/usr/sbin/iconvconfig"
 #endif
+      const char *iconv_cache = GCONV_MODULES_DIR"/gconv-modules.cache";
+      const char *iconv_dir = GCONV_MODULES_DIR;
+      if (is_ia64 ())
+	{
+	  iconv_cache = "/emul/ia32-linux"GCONV_MODULES_DIR"/gconv-modules.cache";
+	  iconv_dir = "/emul/ia32-linux"GCONV_MODULES_DIR;
+	}
       verbose_exec (113, ICONVCONFIG, "/usr/sbin/iconvconfig",
-		    "-o", GCONV_MODULES_DIR"/gconv-modules.cache",
-		    "--nostdlib", GCONV_MODULES_DIR);
+		    "-o", iconv_cache,
+		    "--nostdlib", iconv_dir);
     }
 
   /* Check if telinit is available and the init fifo as well.  */