From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127149 invoked by alias); 28 Sep 2016 08:37:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 127133 invoked by uid 89); 28 Sep 2016 08:37:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.7 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Sep 2016 08:37:01 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id u8S8awpW028612; Wed, 28 Sep 2016 03:36:58 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id u8S8awgQ028611; Wed, 28 Sep 2016 03:36:58 -0500 Date: Wed, 28 Sep 2016 08:48:00 -0000 From: Segher Boessenkool To: Alan Modra Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH 1/2][RS6000] .gnu.attribute Tag_GNU_Power_ABI_FP Message-ID: <20160928083657.GF30477@gate.crashing.org> References: <20160928011145.GF3336@bubble.grove.modra.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160928011145.GF3336@bubble.grove.modra.org> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg02099.txt.bz2 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