Matthew Fortune <matthew.fort...@imgtec.com> writes: > Moore, Catherine <catherine_mo...@mentor.com> writes: > > > -----Original Message----- > > > From: Steve Ellcey [mailto:sell...@mips.com] > > > Sent: Friday, August 08, 2014 3:42 PM > > > To: Moore, Catherine; matthew.fort...@imgtec.com; echri...@gmail.com; > > > > > > 2014-08-08 Steve Ellcey <sell...@mips.com> > > > > > > * config/mips/mips.h (ASM_SPEC): Pass float options to assembler. > > > > > > diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index > > > 8d7a09f..9a15287 100644 > > > --- a/gcc/config/mips/mips.h > > > +++ b/gcc/config/mips/mips.h > > > @@ -1187,6 +1187,8 @@ struct mips_cpu_info { %{mshared} %{mno- > > > shared} \ %{msym32} %{mno-sym32} \ %{mtune=*} \ > > > +%{mhard-float} %{msoft-float} \ > > > +%{msingle-float} %{mdouble-float} \ > > > %(subtarget_asm_spec)" > > > > > > /* Extra switches sometimes passed to the linker. */ > > > > > > > Hi Steve, > > The patch itself looks okay, but perhaps a question for Matthew. > > Does the fact that the assembler requires -msoft-float even if .set > > softfloat is present in the .s file deliberate behavior? > > The assembler requires -msoft-float if .gnu_attribute 4,3 is given. I.e. > the > overall module options must match the ABI which has been specified. .set > directives can still be used to override the 'current' options and be > inconsistent with the overall module and/or .gnu_attribute setting. > > > I don't have a problem with passing along the *float* options to gas, but > > would hope that the .set options were honored as well. > > Yes they should be.
I forgot to add that there will be some side effects to this patch which are not ideal but also unavoidable. The main one I know of is the MIPS Linux kernel which is compiled as soft-float as there must be an absolute guarantee that there is no floating point register usage. However, there is assembly code which uses the floating-point registers for context switches and these modules have not been set up to use .set hardfloat. This means that all existing kernel releases will not build with the new compiler. I have asked some of the MIPS kernel developers to apply fixes to the relevant files and back-port to any supported release. The code has always been notionally wrong but never detected as the assembler did not know that it was assembling soft-float code so allowed FP instructions. The fixed code will build with old and new tools. Similar issues will arise if anything is compiled as single-float but is using double-precision instructions currently. The fixes are simple and it is arguably an improvement to such code bases to find these issues and add appropriate .set directives to account for the special usage. Matthew