Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2018 07:30:15 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r329859 - in head: contrib/compiler-rt/lib/builtins include stand sys/arm/include sys/arm64/include sys/mips/include sys/powerpc/include sys/riscv/include sys/sparc64/include sys/sys sy...
Message-ID:  <CANCZdfp0L7-VL3Y7maYL7nXmkr--BHSbr7TnmODeOs2Jd_Ru4w@mail.gmail.com>
In-Reply-To: <20180223170403.I1331@besplex.bde.org>
References:  <201802230404.w1N44PiD053834@repo.freebsd.org> <20180223170403.I1331@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 22, 2018 at 11:12 PM, Bruce Evans <brde@optusnet.com.au> wrote:

> On Fri, 23 Feb 2018, Warner Losh wrote:
>
> Log:
>>  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.
>>
>
> This unimproves all the _types.h headers, probably for no benefits for lua.
>
> Modified: head/sys/arm/include/_types.h
>> ============================================================
>> ==================
>> --- head/sys/arm/include/_types.h       Fri Feb 23 04:04:18 2018
>> (r329858)
>> +++ head/sys/arm/include/_types.h       Fri Feb 23 04:04:25 2018
>> (r329859)
>> @@ -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;
>>
>
> __types.h headers exist to avoid ifdefs like this.  They only define types
> in the implementation namespace.  Nothing except <math.h> should use
> __double_t or __float_t directly.  There is only a problem if some option
> like -fno-float turns off floating point completely, so that 'float' is
> a syntax error.


Right. Except, there's no longer a -fno-float option. Then again, these
should almost certainly be in sys/_types instead because they are identical
on every platform and will almost certainly never ever be anything other
than what they are.

For the boot loader, I spiked double and float definitions so that we don't
touch floating point types at all. We do this in the Makefile by
intentionally creating syntax errors. I don't think this is undefined
behavior, I think it is well defined behavior: A syntax error is a syntax
error. We're using a restricted set of C for the loader anyway. It's mostly
to prevent accidental use of floating point.

If we ever support floats and such in the boot loader, I'll revert. This
helps us catch accidents like one of the lua files being compiled
incorrectly, leading to stray references to float/double on arm which
caused float stuff to be referenced and pulled in due to inlining. That's
the real bug, and that's been fixed. Until we need float/double in the
loader, I'll keep this in place to prevent a recurrence.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfp0L7-VL3Y7maYL7nXmkr--BHSbr7TnmODeOs2Jd_Ru4w>