GAS .fpu directive

Nicholas Clifton nickc@redhat.com
Wed Aug 20 15:44:00 GMT 2014


Hi Renato,

> It seems GAS accepts .fpu anywhere in the file, and the meaning is
> that it can change the FPU type mid-way through an assembly file, or
> even in a block.

> Is that intentional?

No.

> Is there any real usage for this kind of thing?

Yes.

> I naively assumed that .cpu / .fpu were like .eabi_attribute flags
> that would tell what the *file* is, because normally one assembly
> won't run on different machines at the same time.

Correct.

> The only use case I can think of is if there is a conditional jump
> based on the existence of instructions, so a block that has neon is
> only executed if there's no exception, but that still doesn't need a
> .fpu vfp somewhere else.

Right.  Basically such an sceanario is theoretically possible, but it is 
unlikely that it will ever turn up in real code.  The real reason why 
the directive is accepted anywhere is that it was just too much bother 
to write additional code to make sure that it is only used once, and 
then only in an appropriate place.  Much easier to just let it be 
accepted anywhere and to rely upon the assembler programmer or the 
compiler to only generate one instance of the directive.

Cheers
   Nick




More information about the Binutils mailing list