فهرست منبع

Fix build on amd64 linux

Keno Fischer 12 سال پیش
والد
کامیت
87ce7cedda
9فایلهای تغییر یافته به همراه24 افزوده شده و 16 حذف شده
  1. 6 4
      amd64/bsd_fpu.h
  2. 1 3
      amd64/fenv.c
  3. 2 2
      amd64/fenv.h
  4. 2 2
      i387/fenv.h
  5. 5 0
      include/fenv.h
  6. 1 1
      include/types-compat.h
  7. 2 1
      test/.gitignore
  8. 3 3
      test/Makefile
  9. 2 0
      test/libm-test.c

+ 6 - 4
amd64/bsd_fpu.h

@@ -41,6 +41,8 @@
 #ifndef _X86_FPU_H_
 #define	_X86_FPU_H_
 
+#include "types-compat.h"
+
 /* Environment information of floating point unit. */
 struct env87 {
 	int32_t		en_cw;		/* control word (16bits) */
@@ -128,7 +130,7 @@ struct savexmm {
 	} sv_fp[8];
 	struct xmmacc		sv_xmm[8];
 	uint8_t			sv_pad[224];
-} __aligned(16);
+} __attribute__ ((aligned(16)));
 
 #ifdef __i386__
 union savefpu {
@@ -145,7 +147,7 @@ struct savefpu {
 	} sv_fp[8];
 	struct xmmacc		sv_xmm[16];
 	uint8_t			sv_pad[96];
-} __aligned(16);
+} __attribute__ ((aligned(16)));
 #endif
 
 struct xstate_hdr {
@@ -168,7 +170,7 @@ struct savexmm_ymm {
 	struct xmmacc		sv_xmm[16];
 	uint8_t			sv_pad[96];
 	struct savexmm_xstate	sv_xstate;
-} __aligned(64);
+} __attribute__ ((aligned(16)));
 
 struct savefpu_xstate {
 	struct xstate_hdr	sx_hd;
@@ -184,7 +186,7 @@ struct savefpu_ymm {
 	struct xmmacc		sv_xmm[16];
 	uint8_t			sv_pad[96];
 	struct savefpu_xstate	sv_xstate;
-} __aligned(64);
+} __attribute__ ((aligned(64)));
 
 #undef __envxmm32
 #undef __envxmm64

+ 1 - 3
amd64/fenv.c

@@ -26,11 +26,9 @@
  * $FreeBSD: src/lib/msun/amd64/fenv.c,v 1.8 2011/10/21 06:25:31 das Exp $
  */
 
-#include <sys/cdefs.h>
-#include <sys/types.h>
 #include "bsd_fpu.h"
 
-#define	__fenv_static
+#define _fenv_static
 #include "fenv.h"
 
 #ifdef __GNUC_GNU_INLINE__

+ 2 - 2
amd64/fenv.h

@@ -93,7 +93,7 @@ extern const fenv_t	__fe_dfl_env;
 #define	__ldmxcsr(__csr)	__asm __volatile("ldmxcsr %0" : : "m" (__csr))
 #define	__stmxcsr(__csr)	__asm __volatile("stmxcsr %0" : "=m" (*(__csr)))
 
-__fenv_static inline int
+__fenv_static __attribute__((always_inline)) inline int
 feclearexcept(int __excepts)
 {
 	fenv_t __env;
@@ -126,7 +126,7 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts)
 int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
 int feraiseexcept(int __excepts);
 
-__fenv_static inline int
+__fenv_static __attribute__((always_inline)) inline int
 fetestexcept(int __excepts)
 {
 	uint32_t __mxcsr;

+ 2 - 2
i387/fenv.h

@@ -29,8 +29,8 @@
 #ifndef	_FENV_H_
 #define	_FENV_H_
 
-#include "include/cdefs-compat.h"
-#include "include/types-compat.h"
+#include "cdefs-compat.h"
+#include "types-compat.h"
 
 #ifndef	__fenv_static
 #define	__fenv_static	static

+ 5 - 0
include/fenv.h

@@ -0,0 +1,5 @@
+#ifdef __LP64
+#include "../amd64/fenv.h"
+#else
+#include "../i387/fenv.h"
+#endif

+ 1 - 1
include/types-compat.h

@@ -15,7 +15,7 @@
 #endif
 
 #ifdef __WIN32__
-/* Not sure what to do about __pure2 on linux */
+/* Not sure what to do about __pure2 on windows */
 #define __pure2 
 typedef uint8_t               u_int8_t;
 typedef uint16_t              u_int16_t;

+ 2 - 1
test/.gitignore

@@ -1,2 +1,3 @@
 /test-float
-/test-double
+/test-float-system
+/test-double-system

+ 3 - 3
test/Makefile

@@ -1,13 +1,13 @@
 OPENLIBM_HOME=$(abspath ..)
 include ../Make.inc
 
-all: test-double test-float test-double-system
+all: test-double test-float test-double-system test-float-system
 
 test-double: test-double.c libm-test.c
-	$(CC) -g $< -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
+	$(CC) -g $@.c -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
 
 test-float: test-float.c libm-test.c
-	$(CC) -g $< -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
+	$(CC) -g $@.c -D__BSD_VISIBLE -I ../include -I../src ../libopenlibm.a -o $@
 
 test-double-system: test-double.c libm-test.c
 	$(CC) -g $< -DSYS_MATH_H -lm -o $@

+ 2 - 0
test/libm-test.c

@@ -224,11 +224,13 @@ static FLOAT max_error, real_max_error, imag_max_error;
 #define MANT_DIG CHOOSE ((LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1),  \
                          (LDBL_MANT_DIG-1), (DBL_MANT_DIG-1), (FLT_MANT_DIG-1))
 
+#ifndef SYS_MATH_H
 void FUNC(sincos) (int n, FLOAT *s, FLOAT *c)
 {
 	*s = FUNC(sin) ( *s );
 	*c = FUNC(cos) ( *c );
 }
+#endif
 
 static void
 init_max_error (void)