about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/dl-machine.h17
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h157
-rw-r--r--sysdeps/i386/fpu/fraiseexcpt.c23
3 files changed, 103 insertions, 94 deletions
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index e517cff0ff..213060ba84 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -57,20 +57,12 @@ static inline Elf32_Addr __attribute__ ((unused))
 elf_machine_load_address (void)
 {
   Elf32_Addr addr;
-  asm ("	call .Lhere\n"
-       ".Lhere:	popl %0\n"
-       "	subl $.Lhere, %0"
+  asm ("	call 1f\n"
+       "1:	popl %0\n"
+       "	subl 1b@GOT(%%ebx), %0"
        : "=r" (addr));
   return addr;
 }
-/* The `subl' insn above will contain an R_386_32 relocation entry
-   intended to insert the run-time address of the label `.Lhere'.
-   This will be the first relocation in the text of the dynamic linker;
-   we skip it to avoid trying to modify read-only text in this early stage.  */
-#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
-  ++(const Elf32_Rel *) (dynamic_info)[DT_REL]->d_un.d_ptr; \
-  (dynamic_info)[DT_RELSZ]->d_un.d_val -= sizeof (Elf32_Rel);
-
 
 #ifndef PROF
 /* We add a declaration of this function here so that in dl-runtime.c
@@ -132,6 +124,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
 # define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
 	.globl _dl_runtime_resolve
 	.type _dl_runtime_resolve, @function
+	.align 16
 _dl_runtime_resolve:
 	pushl %eax		# Preserve registers otherwise clobbered.
 	pushl %ecx
@@ -147,6 +140,7 @@ _dl_runtime_resolve:
 
 	.globl _dl_runtime_profile
 	.type _dl_runtime_profile, @function
+	.align 16
 _dl_runtime_profile:
 	pushl %eax		# Preserve registers otherwise clobbered.
 	pushl %ecx
@@ -167,6 +161,7 @@ _dl_runtime_profile:
 	.globl _dl_runtime_profile
 	.type _dl_runtime_resolve, @function
 	.type _dl_runtime_profile, @function
+	.align 16
 _dl_runtime_resolve:
 _dl_runtime_profile:
 	pushl %eax		# Preserve registers otherwise clobbered.
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index c6b9331f9a..17f62a080f 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -73,6 +73,10 @@
 #ifdef	__GNUC__
 #if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
 
+/* The gcc, version 2.7 or below, has problems with all this inlining
+   code.  So disable it for this version of the compiler.  */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7)
+
 #ifdef __cplusplus
 # define __MATH_INLINE __inline
 #else
@@ -154,6 +158,80 @@
   }
 
 
+/* Miscellaneous functions */
+
+__inline_mathcode (__sgn, __x, \
+  return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0))
+
+__inline_mathcode (__pow2, __x, \
+  register long double __value;						      \
+  register long double __exponent;					      \
+  long int __p = (long int) __x;					      \
+  if (__x == (long double) __p)						      \
+    {									      \
+      __asm __volatile__						      \
+	("fscale"							      \
+	 : "=t" (__value) : "0" (1.0), "u" (__x));			      \
+      return __value;							      \
+    }									      \
+  __asm __volatile__							      \
+    ("fldl	%%st(0)\n\t"						      \
+     "frndint			# int(x)\n\t"				      \
+     "fxch\n\t"								      \
+     "fsub	%%st(1)		# fract(x)\n\t"				      \
+     "f2xm1			# 2^(fract(x)) - 1\n\t"			      \
+     : "=t" (__value), "=u" (__exponent) : "0" (__x));			      \
+  __value += 1.0;							      \
+  __asm __volatile__							      \
+    ("fscale"								      \
+     : "=t" (__value) : "0" (__value), "u" (__exponent));		      \
+  return __value)
+
+#define __sincos_code \
+  register long double __cosr;						      \
+  register long double __sinr;						      \
+  __asm __volatile__							      \
+    ("fsincos\n\t"							      \
+     "fnstsw	%%ax\n\t"						      \
+     "testl	$0x400, %%eax\n\t"					      \
+     "jz	1f\n\t"							      \
+     "fldpi\n\t"							      \
+     "fadd	%%st(0)\n\t"						      \
+     "fxch	%%st(1)\n\t"						      \
+     "2: fprem1\n\t"							      \
+     "fnstsw	%%ax\n\t"						      \
+     "testl	$0x400, %%eax\n\t"					      \
+     "jnz	2b\n\t"							      \
+     "fstp	%%st(1)\n\t"						      \
+     "fsincos\n\t"							      \
+     "1:"								      \
+     : "=t" (__cosr), "=u" (__sinr) : "0" (__x));			      \
+  *__sinx = __sinr;							      \
+  *__cosx = __cosr
+
+__MATH_INLINE void __sincos (double __x, double *__sinx, double *__cosx);
+__MATH_INLINE void
+__sincos (double __x, double *__sinx, double *__cosx)
+{
+  __sincos_code;
+}
+
+__MATH_INLINE void __sincosf (float __x, float *__sinx, float *__cosx);
+__MATH_INLINE void
+__sincosf (float __x, float *__sinx, float *__cosx)
+{
+  __sincos_code;
+}
+
+__MATH_INLINE void __sincosl (long double __x, long double *__sinx,
+			      long double *__cosx);
+__MATH_INLINE void
+__sincosl (long double __x, long double *__sinx, long double *__cosx)
+{
+  __sincos_code;
+}
+
+
 /* Optimized inline implementation, sometimes with reduced precision
    and/or argument range.  */
 
@@ -278,10 +356,10 @@ __inline_mathop (sqrt, "fsqrt")
 __inline_mathop_ (long double, __sqrtl, "fsqrt")
 
 #if defined __GNUC__ && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 8)
-__inline_mathcode_ (fabs, __x, return __builtin_fabs (__x))
-__inline_mathcode_ (fabsf, __x, return __builtin_fabsf (__x))
-__inline_mathcode_ (fabsl, __x, return __builtin_fabsl (__x))
-__inline_mathcode_ (__fabsl, __x, return __builtin_fabsl (__x))
+__inline_mathcode_ (double, fabs, __x, return __builtin_fabs (__x))
+__inline_mathcode_ (float, fabsf, __x, return __builtin_fabsf (__x))
+__inline_mathcode_ (long double, fabsl, __x, return __builtin_fabsl (__x))
+__inline_mathcode_ (long double, __fabsl, __x, return __builtin_fabsl (__x))
 #else
 __inline_mathop (fabs, "fabs")
 __inline_mathop_ (long double, __fabsl, "fabs")
@@ -356,7 +434,7 @@ ldexp (double __x, int __y)
 /* Optimized versions for some non-standardized functions.  */
 #if defined __USE_ISOC9X || defined __USE_MISC
 
-__inline_mathop_decl (log2, "fyl2x", "u" (1.0), "0" (__x) : "st(1)")
+__inline_mathop(log2, "fld1; fxch; fyl2x")
 
 __inline_mathcode (expm1, __x, __expm1_code)
 
@@ -443,15 +521,12 @@ __finite (double __x)
     ("orl	$0x800fffff, %0\n\t"
      "incl	%0\n\t"
      "shrl	$31, %0"
-     : "=q" (__result) : "0" (((int *) &__x)[1]));
+     : "=q" (__result) : "0" (((int *) &__x)[1]) : "cc");
   return __result;
 }
 
 /* Miscellaneous functions */
 
-__inline_mathcode (__sgn, __x, \
-  return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0))
-
 __inline_mathcode (__coshm1, __x, \
   register long double __exm1 = __expm1l (__fabsl (__x));		      \
   return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1)
@@ -459,69 +534,6 @@ __inline_mathcode (__coshm1, __x, \
 __inline_mathcode (__acosh1p, __x, \
   return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)))
 
-__inline_mathcode (__pow2, __x, \
-  register long double __value;						      \
-  register long double __exponent;					      \
-  long int __p = (long int) __x;					      \
-  if (__x == (long double) __p)						      \
-    return ldexpl (1.0, __p);						      \
-  __asm __volatile__							      \
-    ("fldl	%%st(0)\n\t"						      \
-     "frndint			# int(x)\n\t"				      \
-     "fxch\n\t"								      \
-     "fsub	%%st(1)		# fract(x)\n\t"				      \
-     "f2xm1			# 2^(fract(x)) - 1\n\t"			      \
-     : "=t" (__value), "=u" (__exponent) : "0" (__x));			      \
-  __value += 1.0;							      \
-  __asm __volatile__							      \
-    ("fscale"								      \
-     : "=t" (__value) : "0" (__value), "u" (__exponent));		      \
-  return __value)
-
-#define __sincos_code \
-  register long double __cosr;						      \
-  register long double __sinr;						      \
-  __asm __volatile__							      \
-    ("fsincos\n\t"							      \
-     "fnstsw	%%ax\n\t"						      \
-     "testl	$0x400, %%eax\n\t"					      \
-     "jz	1f\n\t"							      \
-     "fldpi\n\t"							      \
-     "fadd	%%st(0)\n\t"						      \
-     "fxch	%%st(1)\n\t"						      \
-     "2: fprem1\n\t"							      \
-     "fnstsw	%%ax\n\t"						      \
-     "testl	$0x400, %%eax\n\t"					      \
-     "jnz	2b\n\t"							      \
-     "fstp	%%st(1)\n\t"						      \
-     "fsincos\n\t"							      \
-     "1:"								      \
-     : "=t" (__cosr), "=u" (__sinr) : "0" (__x));			      \
-  *__sinx = __sinr;							      \
-  *__cosx = __cosr
-
-__MATH_INLINE void __sincos (double __x, double *__sinx, double *__cosx);
-__MATH_INLINE void
-__sincos (double __x, double *__sinx, double *__cosx)
-{
-  __sincos_code;
-}
-
-__MATH_INLINE void __sincosf (float __x, float *__sinx, float *__cosx);
-__MATH_INLINE void
-__sincosf (float __x, float *__sinx, float *__cosx)
-{
-  __sincos_code;
-}
-
-__MATH_INLINE void __sincosl (long double __x, long double *__sinx,
-			      long double *__cosx);
-__MATH_INLINE void
-__sincosl (long double __x, long double *__sinx, long double *__cosx)
-{
-  __sincos_code;
-}
-
 #endif /* __USE_MISC  */
 
 /* Undefine some of the large macros which are not used anymore.  */
@@ -530,6 +542,7 @@ __sincosl (long double __x, long double *__sinx, long double *__cosx)
 #undef __atan2_code
 #undef __sincos_code
 
+#endif /* Not gcc <= 2.7.  */
 #endif /* __NO_MATH_INLINES  */
 #endif /* __GNUC__  */
 
diff --git a/sysdeps/i386/fpu/fraiseexcpt.c b/sysdeps/i386/fpu/fraiseexcpt.c
index 0af8c71ddc..d468449873 100644
--- a/sysdeps/i386/fpu/fraiseexcpt.c
+++ b/sysdeps/i386/fpu/fraiseexcpt.c
@@ -34,7 +34,7 @@ feraiseexcept (int excepts)
     {
       /* One example of a invalid operation is 0.0 / 0.0.  */
       double d;
-      __asm__ ("fldz; fdiv %%st, %%st(0); fwait" : "=t" (d));
+      __asm__ __volatile__ ("fldz; fdiv %%st, %%st(0); fwait" : "=t" (d));
       (void) &d;
     }
 
@@ -42,7 +42,8 @@ feraiseexcept (int excepts)
   if ((FE_DIVBYZERO & excepts) != 0)
     {
       double d;
-      __asm__ ("fldz; fld1; fdivp %%st, %%st(1); fwait" : "=t" (d));
+      __asm__ __volatile__ ("fldz; fld1; fdivp %%st, %%st(1); fwait"
+			    : "=t" (d));
       (void) &d;
     }
 
@@ -55,16 +56,16 @@ feraiseexcept (int excepts)
 
       /* Bah, we have to clear selected exceptions.  Since there is no
 	 `fldsw' instruction we have to do it the hard way.  */
-      __asm__ ("fnstenv %0" : "=m" (*&temp));
+      __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
 
       /* Set the relevant bits.  */
       temp.status_word |= FE_OVERFLOW;
 
       /* Put the new data in effect.  */
-      __asm__ ("fldenv %0" : : "m" (*&temp));
+      __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
 
       /* And raise the exception.  */
-	__asm__ ("fwait");
+      __asm__ __volatile__ ("fwait");
     }
 
   /* Next: underflow.  */
@@ -76,16 +77,16 @@ feraiseexcept (int excepts)
 
       /* Bah, we have to clear selected exceptions.  Since there is no
 	 `fldsw' instruction we have to do it the hard way.  */
-      __asm__ ("fnstenv %0" : "=m" (*&temp));
+      __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
 
       /* Set the relevant bits.  */
       temp.status_word |= FE_UNDERFLOW;
 
       /* Put the new data in effect.  */
-      __asm__ ("fldenv %0" : : "m" (*&temp));
+      __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
 
       /* And raise the exception.  */
-	__asm__ ("fwait");
+      __asm__ __volatile__ ("fwait");
     }
 
   /* Last: inexact.  */
@@ -97,15 +98,15 @@ feraiseexcept (int excepts)
 
       /* Bah, we have to clear selected exceptions.  Since there is no
 	 `fldsw' instruction we have to do it the hard way.  */
-      __asm__ ("fnstenv %0" : "=m" (*&temp));
+      __asm__ __volatile__ ("fnstenv %0" : "=m" (*&temp));
 
       /* Set the relevant bits.  */
       temp.status_word |= FE_INEXACT;
 
       /* Put the new data in effect.  */
-      __asm__ ("fldenv %0" : : "m" (*&temp));
+      __asm__ __volatile__ ("fldenv %0" : : "m" (*&temp));
 
       /* And raise the exception.  */
-	__asm__ ("fwait");
+      __asm__ __volatile__ ("fwait");
     }
 }