From ef1fcaf0f5bf501986c4c3d5c260c020eec57a92 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 23 Feb 2018 04:04:25 +0000 Subject: [PATCH] Do not include float interfaces when using libsa. We don't support float in the boot loaders, so don't include interfaces for float or double in systems headers. In addition, take the unusual step of spiking double and float to prevent any more accidental seepage. --- contrib/compiler-rt/lib/builtins/int_types.h | 4 ++++ include/time.h | 2 ++ stand/defs.mk | 3 +++ stand/lua.mk | 1 - sys/arm/include/_types.h | 2 ++ sys/arm64/include/_types.h | 2 ++ sys/mips/include/_types.h | 2 ++ sys/powerpc/include/_types.h | 2 ++ sys/powerpc/include/pcb.h | 2 ++ sys/riscv/include/_types.h | 2 ++ sys/sparc64/include/_types.h | 2 ++ sys/sys/_types.h | 2 ++ sys/x86/include/_types.h | 4 ++++ 13 files changed, 29 insertions(+), 1 deletion(-) diff --git a/contrib/compiler-rt/lib/builtins/int_types.h b/contrib/compiler-rt/lib/builtins/int_types.h index a92238c5b73..95a65827a61 100644 --- a/contrib/compiler-rt/lib/builtins/int_types.h +++ b/contrib/compiler-rt/lib/builtins/int_types.h @@ -114,6 +114,7 @@ static __inline tu_int make_tu(du_int h, du_int l) { #endif /* CRT_HAS_128BIT */ +#ifndef _STANDALONE typedef union { su_int u; @@ -125,6 +126,7 @@ typedef union udwords u; double f; } double_bits; +#endif typedef struct { @@ -137,6 +139,7 @@ typedef struct #endif /* _YUGA_LITTLE_ENDIAN */ } uqwords; +#ifndef _STANDALONE typedef union { uqwords u; @@ -160,5 +163,6 @@ typedef struct { long double real, imaginary; } Lcomplex; #define COMPLEX_REAL(x) (x).real #define COMPLEX_IMAGINARY(x) (x).imaginary #endif +#endif #endif /* INT_TYPES_H */ diff --git a/include/time.h b/include/time.h index cacb7f2f26e..52c95918f11 100644 --- a/include/time.h +++ b/include/time.h @@ -146,7 +146,9 @@ __BEGIN_DECLS char *asctime(const struct tm *); clock_t clock(void); char *ctime(const time_t *); +#ifndef _STANDALONE double difftime(time_t, time_t); +#endif /* XXX missing: getdate() */ struct tm *gmtime(const time_t *); struct tm *localtime(const time_t *); diff --git a/stand/defs.mk b/stand/defs.mk index 27993650b05..b067ed4830e 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -51,6 +51,9 @@ CFLAGS+= -I${BOOTOBJ}/libsa .endif CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} +# Spike the floating point interfaces +CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=boaty-mcboatface + # GELI Support, with backward compat hooks (mostly) .if defined(HAVE_GELI) diff --git a/stand/lua.mk b/stand/lua.mk index cea0fa71a8c..711d95e48ba 100644 --- a/stand/lua.mk +++ b/stand/lua.mk @@ -3,5 +3,4 @@ # Common flags to build lua related files CFLAGS+= -I${LUASRC} -I${LDRSRC} -I${LIBLUASRC} -# CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=poison-shake -D__OMIT_FLOAT CFLAGS+= -DLUA_FLOAT_TYPE=LUA_FLOAT_INT64 diff --git a/sys/arm/include/_types.h b/sys/arm/include/_types.h index 0871adc778b..14ab76c5fbd 100644 --- a/sys/arm/include/_types.h +++ b/sys/arm/include/_types.h @@ -70,8 +70,10 @@ typedef unsigned long long __uint64_t; */ typedef __uint32_t __clock_t; /* clock()... */ typedef __int32_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int32_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int32_t __intptr_t; diff --git a/sys/arm64/include/_types.h b/sys/arm64/include/_types.h index 1019b3bc7a5..b54a17d2502 100644 --- a/sys/arm64/include/_types.h +++ b/sys/arm64/include/_types.h @@ -56,8 +56,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; diff --git a/sys/mips/include/_types.h b/sys/mips/include/_types.h index 31cdb640935..385280b1ea4 100644 --- a/sys/mips/include/_types.h +++ b/sys/mips/include/_types.h @@ -75,8 +75,10 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __int32_t __clock_t; /* clock()... */ +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif #ifdef __mips_n64 typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; diff --git a/sys/powerpc/include/_types.h b/sys/powerpc/include/_types.h index 83293a60e7d..7915f562757 100644 --- a/sys/powerpc/include/_types.h +++ b/sys/powerpc/include/_types.h @@ -74,8 +74,10 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __uint32_t __clock_t; /* clock()... */ +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif #ifdef __LP64__ typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; diff --git a/sys/powerpc/include/pcb.h b/sys/powerpc/include/pcb.h index ecddc3fddb2..8c378807f16 100644 --- a/sys/powerpc/include/pcb.h +++ b/sys/powerpc/include/pcb.h @@ -39,6 +39,7 @@ #include +#ifndef _STANDALONE struct pcb { register_t pcb_context[20]; /* non-volatile r14-r31 */ register_t pcb_cr; /* Condition register */ @@ -81,6 +82,7 @@ struct pcb { } booke; } pcb_cpu; }; +#endif #ifdef _KERNEL diff --git a/sys/riscv/include/_types.h b/sys/riscv/include/_types.h index 0c4b6c775ab..50b80af4c63 100644 --- a/sys/riscv/include/_types.h +++ b/sys/riscv/include/_types.h @@ -56,8 +56,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; diff --git a/sys/sparc64/include/_types.h b/sys/sparc64/include/_types.h index bd956b1ac77..9d71fefc52e 100644 --- a/sys/sparc64/include/_types.h +++ b/sys/sparc64/include/_types.h @@ -58,8 +58,10 @@ typedef unsigned long __uint64_t; */ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int64_t __intptr_t; diff --git a/sys/sys/_types.h b/sys/sys/_types.h index 8ecf9d05923..22a37c53389 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -104,7 +104,9 @@ typedef __uint_least32_t __char32_t; typedef struct { long long __max_align1 __aligned(_Alignof(long long)); +#ifndef _STANDALONE long double __max_align2 __aligned(_Alignof(long double)); +#endif } __max_align_t; typedef __uint64_t __dev_t; /* device number */ diff --git a/sys/x86/include/_types.h b/sys/x86/include/_types.h index b459951d0ef..2c7301dd857 100644 --- a/sys/x86/include/_types.h +++ b/sys/x86/include/_types.h @@ -74,15 +74,19 @@ typedef unsigned long long __uint64_t; #ifdef __LP64__ typedef __int32_t __clock_t; /* clock()... */ typedef __int64_t __critical_t; +#ifndef _STANDALONE typedef double __double_t; typedef float __float_t; +#endif typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; #else typedef unsigned long __clock_t; typedef __int32_t __critical_t; +#ifndef _STANDALONE typedef long double __double_t; typedef long double __float_t; +#endif typedef __int32_t __intfptr_t; typedef __int32_t __intptr_t; #endif