From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98744 invoked by alias); 16 Mar 2016 16:40:30 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 98722 invoked by uid 89); 16 Mar 2016 16:40:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_50,SPF_PASS autolearn=ham version=3.3.2 spammy=0xff, run_dump_test, X_add_number, x_add_number X-HELO: prv-mh.provo.novell.com Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 16 Mar 2016 16:40:19 +0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Wed, 16 Mar 2016 10:40:17 -0600 Message-Id: <56E99A7F02000078000DD4E5@prv-mh.provo.novell.com> Date: Wed, 16 Mar 2016 16:40:00 -0000 From: "Jan Beulich" To: Subject: Ping: [PATCH] gas: fix bogus error on .org involving expression References: <56D6DCAB02000078000D845A@prv-mh.provo.novell.com> In-Reply-To: <56D6DCAB02000078000D845A@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-SW-Source: 2016-03/txt/msg00229.txt.bz2 Ping??? >>> On 02.03.16 at 12:29, wrote: > For years I have been carrying this change, and it was long forgotten > what it was originally meant to deal with, hence I've never submitted > it. Until I came across an issue with Linux kernel like alternative > instruction patching, where the space needed to hold the replacement > instruction was allocated using .org. Things built fine for me (since > I had the patch in place), and things also built fine on 2.20. But > assemblers from at least 2.22 onwards produce an undefined symbol > warning for the "orig" label in the new test case, followed by an > error complaining that .org would be moving backwards (which is a > logical consequence of the undefined symbol getting replaced by plain > zero). >=20 > gas/ > 2016-03-02 Jan Beulich >=20 > * expr.c (expr): Set retval to expr_section for expressions > involving symbols, which cannot be resolved right away. >=20 > gas/testsuite/ > 2016-03-02 Jan Beulich >=20 > * expr-org.s, expr.org.d: New. > * gas.exp: Run new test. >=20 > --- 2016-03-02/gas/expr.c > +++ 2016-03-02/gas/expr.c > @@ -1998,7 +1998,11 @@ expr (int rankarg, /* Larger # is highe > retval =3D absolute_section; > rightseg =3D absolute_section; > } > + else > + retval =3D expr_section; > } > + else > + retval =3D expr_section; > } > else > { > @@ -2010,17 +2014,18 @@ expr (int rankarg, /* Larger # is highe > resultP->X_add_number =3D 0; > resultP->X_unsigned =3D 1; > resultP->X_extrabit =3D 0; > + retval =3D expr_section; > } >=20=20 > if (retval !=3D rightseg) > { > - if (retval =3D=3D undefined_section) > + if (retval =3D=3D expr_section) > ; > - else if (rightseg =3D=3D undefined_section) > + else if (rightseg =3D=3D expr_section) > retval =3D rightseg; > - else if (retval =3D=3D expr_section) > + else if (retval =3D=3D undefined_section) > ; > - else if (rightseg =3D=3D expr_section) > + else if (rightseg =3D=3D undefined_section) > retval =3D rightseg; > else if (retval =3D=3D reg_section) > ; > --- 2016-03-02/gas/testsuite/gas/all/expr-org.d > +++ 2016-03-02/gas/testsuite/gas/all/expr-org.d > @@ -0,0 +1,11 @@ > +#objdump: -s -j .data -j .alt > +#name: .org with expression (with forward reference) > + > +.*: .* > + > +Contents of section \.data: > + 0000 [0f][0f]ffff[0f][0f] 01 [ .]* > + > +Contents of section \.alt: > + 0000 00000000 [ .]* > +#pass > --- 2016-03-02/gas/testsuite/gas/all/expr-org.s > +++ 2016-03-02/gas/testsuite/gas/all/expr-org.s > @@ -0,0 +1,10 @@ > + .data > +orig: > + .byte 0 > + .org orig + (alt_end - alt_begin), 0xff > + .pushsection .alt, "a", @progbits > +alt_begin: > + .long 0 > +alt_end: > + .popsection > + .byte 1 > --- 2016-03-02/gas/testsuite/gas/all/gas.exp > +++ 2016-03-02/gas/testsuite/gas/all/gas.exp > @@ -371,6 +371,7 @@ if { ([istarget "i*86-*-*pe*"] && ![ist > if { ![istarget "bfin-*-*"] && ![istarget "nds32*-*-*"] } then { > run_dump_test assign > } > +run_dump_test expr-org > run_dump_test sleb128 > run_dump_test sleb128-2 > run_dump_test sleb128-3