public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Alan Modra <amodra@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/2][RS6000] .gnu.attribute Tag_GNU_Power_ABI_FP
Date: Wed, 28 Sep 2016 08:48:00 -0000	[thread overview]
Message-ID: <20160928083657.GF30477@gate.crashing.org> (raw)
In-Reply-To: <20160928011145.GF3336@bubble.grove.modra.org>

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

  parent reply	other threads:[~2016-09-28  8:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28  1:20 Alan Modra
2016-09-28  1:26 ` [PATCH 2/2] Disable .gnu_attribute tags in compatibility-ldbl.o Alan Modra
2016-09-28  2:49   ` Joseph Myers
2016-09-28  4:41     ` Alan Modra
2016-09-28 17:34       ` Joseph Myers
2016-09-28  9:04   ` Segher Boessenkool
2016-09-28  2:00 ` [PATCH 1/2][RS6000] .gnu.attribute Tag_GNU_Power_ABI_FP Joseph Myers
2016-09-28  4:38   ` Alan Modra
2016-09-28  8:48 ` Segher Boessenkool [this message]
2016-09-29  0:57   ` Alan Modra
2016-09-29 15:14 David Edelsohn
2016-09-29 22:05 ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160928083657.GF30477@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=amodra@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).