Elimination of all floating point code in the tiny assembler

Christian Groessler chris@groessler.org
Wed Sep 13 13:54:46 GMT 2023


Hello Jacob,


On 9/13/23 13:18, Nick Clifton via Binutils wrote:
>> GAS has its own floating point code in very high precision. This code 
>> is quite cumbersome, and never used. All compilers emit floating point 
>> numbers as 32 or 64 bit integers, so, the directives for reading 
>> floating point numbers go unused.
> 
> Except of course when assembling hand written assembler source code.
> You can bet that there is code out there that relies upon this feature
> of the assembler.
> 
> A second point is that GAS actually has three different versions of the
> text-to-float conversion code: atof-generic.c, atof-ieee.c and atof-vax.c.
> These are to support the requirements of different architectures.  Any
> replacement code would ideally remove all three of these implementations,
> although of course it would have to take care to not break anything.
> 
> Another issue is that the code needs to work when running in a cross
> assembly environment.  So for example it must work when running on a big
> endian host but assembling for a little endian target, or when running
> on a 32-bit host assembling for a 64-bit target.
> 
> All of which is not to say "don't do this".  We absolutely would be
> interested in any patches to improve/simplify the assembler.  Just please
> do consider that the code needs to be portable, paranoid and pleasing.

appending to Nick's response I want to say that it's not so straight 
forward.

There are different reprensations of floating point numbers. So a 
generic "strtoul" doesn't help. It's dependent on the build machine and 
not on the target.

regards,
chris




More information about the Binutils mailing list