Hi Alan,

On Wed, Sep 28, 2016 at 10:41:45AM +0930, Alan Modra wrote:
> Extend this attribute to cover long double ABIs, for 64-bit too.  The
> idea is that the linker should warn if you are linking object files
> with incompatible ABIs, for example IEEE128 long double with IBM long
> double.  It's only a warning, and doesn't catch everything.  In
> particular, global data mismatches.  ie. initialised global variables
> in one format can be used by code that expects a different format
> without warning.  Also, a function returning "sizeof (long double)"
> or similar won't cause an object file to be tagged.  Oh, and you need
> a new linker to see long double warnings.
> 
> The patch also corrects an error that crept in to code setting
> rs6000_passes_float.  See the added comment.  Passing IEEE128 values
> in vsx regs ought to set both Tag_GNU_Power_ABI_FP and
> Tag_GNU_Power_ABI_Vector.
> 
> I've also added a new option, default on, that disables output of
> .gnu_attribute tags.  That's needed because this patch alone
> introduces libstdc++ testsuite regressions, fixed by the next patch.

>  #ifdef HAVE_AS_GNU_ATTRIBUTE
> +  /* ??? The value emitted depends on options active at file end.
> +     Assume anyone using #pragma or attributes that might change
> +     options knows what they are doing.  */
> +  if ((TARGET_64BIT || DEFAULT_ABI == ABI_V4)
> +      && rs6000_passes_float)
> +    fprintf (asm_out_file, "\t.gnu_attribute 4, %d\n",
> +          ((TARGET_DF_FPR | TARGET_DF_SPE ? 1
> +            : TARGET_SF_FPR | TARGET_SF_SPE ? 3
> +            : 2)
> +           | (!rs6000_passes_long_double ? 0
> +              : !TARGET_LONG_DOUBLE_128 ? 2 * 4
> +              : TARGET_IEEEQUAD ? 3 * 4
> +              : 1 * 4)));

This will become much more readable if you expand it to a few statements,
using a temp var perhaps.

> @@ -37085,6 +37117,9 @@ static struct rs6000_opt_var const rs6000_opt_vars[] =
>    { "warn-cell-microcode",
>      offsetof (struct gcc_options, x_rs6000_warn_cell_microcode),
>      offsetof (struct cl_target_option, x_rs6000_warn_cell_microcode), },
> +  { "gnu-attr",
> +    offsetof (struct gcc_options, x_rs6000_gnu_attr),
> +    offsetof (struct cl_target_option, x_rs6000_gnu_attr), },
>  };

Please spell out "gnu-attribute" for the option name.

> +      if test "$gcc_cv_gld_major_version" -eq 2 -a 
> "$gcc_cv_gld_minor_version" -ge 28 -o "$gcc_cv_gld_major_version" -gt 2; then

That line is a little long.

> +      AC_DEFINE(HAVE_LD_PPC_GNU_ATTR, 1,
> +    [Define if your PowerPC linker has .gnu_attribute long double support.])

"LD" didn't make me think "long double" ;-)  Maybe use a better name?

Okay for trunk with those thing fixed, and Joseph's comments taken care
of of course.

Thanks,


Segher

Reply via email to