Fix build on amd64 linux

This commit is contained in:
Keno Fischer 2012-08-19 04:14:18 -04:00
parent 52dd430ac8
commit 87ce7cedda
9 changed files with 24 additions and 16 deletions

View file

@ -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

View file

@ -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__

View file

@ -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;

View file

@ -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
include/fenv.h Normal file
View file

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

View file

@ -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;

3
test/.gitignore vendored
View file

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

View file

@ -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 $@

View file

@ -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)