Darwin multilibs

Stan Shebs shebs@apple.com
Tue May 27 05:40:00 GMT 2003


Michael Meissner wrote:

>On Mon, May 26, 2003 at 09:39:05AM -0400, Stan Shebs wrote:
>
>>Geoff Keating wrote:
>>
>>
>>>Dara Hazeghi <dhazeghi@yahoo.com> writes:
>>>
>>>
>>>
>>>>Hello,
>>>>
>>>>is there any reason we're still building soft-float libs on Darwin
>>>>still? Stan Shebs mentioned in a message back in November
>>>>(http://gcc.gnu.org/ml/gcc/2002-04/msg01549.html) that multilibs
>>>>weren't strictly necessary on Darwin. Would a patch disabling them
>>>>then be welcome? Thanks,
>>>>
>>>>
>>>I believe that soft-float is used for the kernel and drivers.
>>>
>>>
>>>
>>The reason I was doubtful about the right thing to do is that kernel
>>and kexts aren't supposed to be using floating point at all, and
>>-msoft-float is just used to prevent float reg refs from getting in
>>by accident.  What I think kernel folks would most like is a libgcc
>>where adddf3 etc is not defined at all, so that mistaken references
>>show up as a link error, but that's a pretty unusual variant of
>>multilib.
>>
>
>Note, at least when I was PowerPC maintainer several years ago, the register
>allocator would often times use floating point registers for memory to memory
>copies (particularly for block move operations), since it avoids extra spills.
>Some Linux crashes were attributed to these optimizations in the kernel in code
>run during interrupt handling (when the GPRs were saved, but not the FPRs), and
>Linux started building with -msoft-float to prevent this.  I would imagine
>Darwin has similar issues.
>
>So, it is not to just prevent errant programmers from using floating point, but
>also to suppress an optimization that is not valid in the kernel context.
>
Yes, that is also the real reason for using -msoft-float on Darwin.
The explanation from a kernel developer is usually accompanied with
mild histrionics about how expensive it would be to save and restore
fprs on context switches. :-)

Stan




More information about the Gcc mailing list