From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8710B3852A5B for ; Thu, 15 Dec 2022 17:01:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8710B3852A5B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671123660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AG+occLlee+riOxH7vlL1iyb7KCVdyRQElvBJTxIdJY=; b=f0gGnrItp/aMKvgxrVFVDI1MDYiFX42AnylpAyWI1neJFXfLZbAnrQvlGjjbwfJ6c1lZai Vp0UjNTPE952UjdRlOtcz+xRdLVQrmNiTRFOa7Mq2S8gsDGDjz/wo9TIuigC/LMI1tCbO+ NtRIXg84sf/BTyZoRsCnnUe1ch0PPtA= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-265-fZMDPSuLNQ2PG5wCYjHuRQ-1; Thu, 15 Dec 2022 12:00:52 -0500 X-MC-Unique: fZMDPSuLNQ2PG5wCYjHuRQ-1 Received: by mail-wr1-f72.google.com with SMTP id c21-20020adfa315000000b002425bf67a87so826308wrb.19 for ; Thu, 15 Dec 2022 09:00:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cQUpwDgsFb4Ty/b1WkFmelsww9NqQ28oKBTaKjD6xds=; b=hJqvcjUlcdwqOsqJOPkhQwDY7CUyZklIua3Ojo6cWSRoXofTCIwonbH19XvH9tjvtQ thicJ56sMlevWL4LRaKbF6vZr4knHh3QCmEIjLSTuu3sdJpD2aXFFGO1r3xTqIx2k3Rx pSpSDercshlLuIobG+VKelQxiDn978QkKQaA17kgZSw+OwKdz4ZK7g6h/PydRz3oWx8B mdCTnqv/8ydMcIbiciWrBA88D1pJiOJ9h+M108f+jz4MIkODUB+xOWo8jYKA+kTw5fEY b6RRtK2JZ4HmPHOWwsalr8HK9LuVUGuQyTUOB9VQbBAAd4nCDLmnInh56YR12BBsFJcI mMtQ== X-Gm-Message-State: ANoB5pmNvPjQjvGJOEKCYwAvpRAGvjuI5Xh4zmGoNFz4/2bbFcSiP0eJ BiQRFBdAREg8aL74hnUY60ZLh7maMSJpOAD/nHugNDuW1b0wQwA8xEGwDhXVYObPBnbfR0Nb3tF yvSG/VpdSpBChueQeCg== X-Received: by 2002:a05:600c:3c95:b0:3cf:e7c8:494 with SMTP id bg21-20020a05600c3c9500b003cfe7c80494mr22814842wmb.29.1671123649798; Thu, 15 Dec 2022 09:00:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf5rjvv1ZmwopPpGjN+LW1g7oYkSwez4F9EY9eOiFr0+48ff+aH+kcT4YsZArhU4Knzb6fC8CQ== X-Received: by 2002:a05:600c:3c95:b0:3cf:e7c8:494 with SMTP id bg21-20020a05600c3c9500b003cfe7c80494mr22814830wmb.29.1671123649609; Thu, 15 Dec 2022 09:00:49 -0800 (PST) Received: from localhost ([31.111.84.238]) by smtp.gmail.com with ESMTPSA id j26-20020a05600c1c1a00b003d1ee3a6542sm7695867wms.47.2022.12.15.09.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 09:00:49 -0800 (PST) From: Andrew Burgess To: Jan Beulich , Luis Machado Cc: Binutils Subject: Re: [PATCH v2 2/2] gas: re-work line number tracking for macros and their expansions In-Reply-To: References: <1d528267-9450-12c7-4c4c-fe4deb3b0617@suse.com> <8eff1de6-871d-24cc-8804-9af7da0a86cf@suse.com> <87edt20ycr.fsf@redhat.com> <87a63p2a81.fsf@redhat.com> Date: Thu, 15 Dec 2022 17:00:48 +0000 Message-ID: <87len8zjnj.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Jan Beulich writes: > On 14.12.2022 17:58, Andrew Burgess wrote: >> Anyway, hopefully the reproducer helps track down the problem. > > It did indeed. Below the patch that addresses the issue for me, > but before committing I will want to run this through the full set > of tests (after extending the testcase which didn't catch the issue). > > Jan Can confirm that the patch below fixes the gdb.asm/asm-source.exp test failure that I was seeing. Thanks, Andrew > > gas: restore Dwarf info generation after macro diagnostic adjustments > > While 6fdb723799e2 ("gas: re-work line number tracking for macros and > their expansions") was meant to leave generated Dwarf as is, it really > didn't (and the testcase intended to catch that wasn't covering the case > which broke). Its adjustment to buffer_and_nest() didn't go far enough, > leading to the "linefile" directive inserted at the top to also be > processed later in the PR=C2=A0gas/16908 workaround (which clearly isn't > intended - it's being put there for processing during macro expansion > only). That unnoticed flaw in turn led me to worked around it by a > (suspicious to me already at the time) conditional in as_where(). > > --- a/gas/input-scrub.c > +++ b/gas/input-scrub.c > @@ -564,9 +564,6 @@ as_where (unsigned int *linep) > =20 > do > =09{ > -=09 if (!saved->is_linefile) > -=09 break; > - > =09 if (expansion !=3D expanding_macro) > =09 /* Nothing. */; > =09 else if (saved->logical_input_file !=3D NULL > --- a/gas/macro.c > +++ b/gas/macro.c > @@ -120,8 +120,7 @@ buffer_and_nest (const char *from, const > size_t from_len; > size_t to_len =3D strlen (to); > int depth =3D 1; > - size_t line_start =3D ptr->len; > - size_t more =3D get_line (ptr); > + size_t line_start, more; > =20 > if (to_len =3D=3D 4 && strcasecmp (to, "ENDR") =3D=3D 0) > { > @@ -147,6 +146,8 @@ buffer_and_nest (const char *from, const > xfree (linefile); > } > =20 > + line_start =3D ptr->len; > + more =3D get_line (ptr); > while (more) > { > /* Try to find the first pseudo op on the line. */