PPC: .gnu_attribute ignored?

Wolfgang Denk wd@denx.de
Mon Dec 12 15:16:00 GMT 2011


Hello,

we have a somewhat special requirement: we want to "hide" that we are
using hard-FP code using ".gnu_attribute 4, 2" in the code.  This is
on PPC systems, in bare-metal code (boot loader).

We know what we are doing - the calling code (compiled with
soft-float) doesn't pass to (and doesn't get from) these special
functions floats; there are no functions exported from it either, and
this is the only place where FP code is used ever.

To avoid linker warnings we want to reassure the linker not to worry
about the difference in ABI attributes of linked objects by setting
the 'soft-float' attribute for this specific object file.

This worked well in older versions of the tools (like gcc 4.2.2 with
binutils 2.17.50.0.12), but it fails with more recent versions (like
gcc 4.6.1 with binutils 2.21.1).

It appears that the "-mhard-float" argument given on the compiler
command line now takes precedence over the ".gnu_attribute 4, 2"
setting in the assembler code: "readelf -A" will report "File
Attributes Tag_GNU_Power_ABI_FP: Hard float", and ld will complain
"foo.o uses hard float, bar.o uses soft float".

Is there any way to get rid of the Tag_GNU_Power_ABI_FP tag, either
(preferred) right when compiling the object file, or (if it cannot be
avoided) in a separate step later?

Thanks in advance.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The management question ... is not _whether_ to build a pilot  system
and  throw  it away. You _will_ do that. The only question is whether
to plan in advance to build a throwaway, or to promise to deliver the
throwaway to customers.       - Fred Brooks, "The Mythical Man Month"



More information about the Binutils mailing list