summers
Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Hard Float kernel for Rasbrian

Tue Aug 21, 2012 1:23 pm

Noticed something odd last night, when compiling a plain vanilla linux kernel for my panda board. My default gcc is hard float, but passing V=1 to the make command could see -msoft-float was being defined. Turns out its defined that way in arch/arm/Makefile.

So just wondering if the same issue is there for rasbrian kernels - e.g. has it inadvertently been compiled soft float due to the default make file?

Not sure it makes any difference though - are there any floats used in the kernel?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6505
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Hard Float kernel for Rasbrian

Tue Aug 21, 2012 1:41 pm

summers wrote:Not sure it makes any difference though - are there any floats used in the kernel?
No.

kadamski
Posts: 201
Joined: Fri Jun 08, 2012 10:56 pm

Re: Hard Float kernel for Rasbrian

Thu Aug 23, 2012 7:21 am

That's not entirely true. Floats can be used inside of kernel but their usage is discouraged (as there is no good way to do it cross platform) . Also it is used in a very specific way which is independent from the float ABI so it doesn't matter if you are using hardfp or softfp compiler. softfp compiler parameters are forced to be sure no one is using floating point in the way it's used in userspace. Here's quite good explanation of this.

summers
Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Re: Hard Float kernel for Rasbrian

Sat Aug 25, 2012 1:25 pm

Interesting article. Yes I can see why the set -msoft-float now. Logic a bit convoluted. Guess its just strongly encouraging people not to use floats in the kernel, which I guess could be more transparanetly done by one of the coding rules for the kernel.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6505
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Hard Float kernel for Rasbrian

Sat Aug 25, 2012 1:44 pm

Whilst it is possible to use floating point from the kernel, there's no reference to kernel_fpu_begin from the RPi kernel, so I don't believe we do.

kadamski
Posts: 201
Joined: Fri Jun 08, 2012 10:56 pm

Re: Hard Float kernel for Rasbrian

Tue Aug 28, 2012 8:16 am

Yes, greping kernel sources one can find that floats are only used in x86 specific code and raid6 implementation.

Return to “Linux Kernel”