public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* dwarf2 sub-section test
@ 2021-09-22  1:02 Alan Modra
  2021-09-22  6:15 ` Delivery delayed:dwarf2 " postmaster
  2021-09-24 21:47 ` Committed: gas/testsuite/ld-elf/dwarf2-21.d: Pass -W (was: dwarf2 sub-section test) Hans-Peter Nilsson
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Modra @ 2021-09-22  1:02 UTC (permalink / raw)
  To: binutils

This is a testcase for the bug fixed by commit 5b4846283c3d.  When
running the testcase on ia64 targets I found timeouts along with lots
of memory being consumed, due to ia64 gas not tracking text
sub-sections.  Trying to add nops for ".nop 16" in ".text 1" resulting
in them being added to subsegment 0, with no increase to subsegment 1
size.  This patch also fixes that problem.

Note that the testcase fails on ft32-elf, mn10200-elf, score-elf,
tic5x-elf, and xtensa-elf.  The first two are relocation errors, the
last three appear to be the .nop directive failing to emit the right
number of nops.  I didn't XFAIL any of them.

	* config/tc-ia64.c (md): Add last_text_subseg.
	(ia64_flush_insns, dot_endp): Use last_text_subseg.
	(ia64_frob_label, md_assemble): Set last_text_subseg.
	* testsuite/gas/elf/dwarf2-21.d,
	* testsuite/gas/elf/dwarf2-21.s: New test.
	* testsuite/gas/elf/elf.exp: Run it.

diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 4fc0c5610dc..4fa7f767f12 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -306,6 +306,7 @@ static struct
     slot[NUM_SLOTS];
 
     segT last_text_seg;
+    subsegT last_text_subseg;
 
     struct dynreg
       {
@@ -952,7 +953,7 @@ ia64_flush_insns (void)
   saved_seg = now_seg;
   saved_subseg = now_subseg;
 
-  subseg_set (md.last_text_seg, 0);
+  subseg_set (md.last_text_seg, md.last_text_subseg);
 
   while (md.num_slots_in_use > 0)
     emit_one_bundle ();		/* force out queued instructions */
@@ -4410,7 +4411,7 @@ dot_endp (int dummy ATTRIBUTE_UNUSED)
     {
       symbolS *proc_end;
 
-      subseg_set (md.last_text_seg, 0);
+      subseg_set (md.last_text_seg, md.last_text_subseg);
       proc_end = expr_build_dot ();
 
       start_unwind_section (saved_seg, SPECIAL_SECTION_UNWIND);
@@ -7767,6 +7768,7 @@ ia64_frob_label (struct symbol *sym)
   if (bfd_section_flags (now_seg) & SEC_CODE)
     {
       md.last_text_seg = now_seg;
+      md.last_text_subseg = now_subseg;
       fix = XOBNEW (&notes, struct label_fix);
       fix->sym = sym;
       fix->next = CURR_SLOT.label_fixups;
@@ -10854,6 +10856,7 @@ md_assemble (char *str)
     insn_group_break (1, 0, 0);
 
   md.last_text_seg = now_seg;
+  md.last_text_subseg = now_subseg;
 
  done:
   input_line_pointer = saved_input_line_pointer;
diff --git a/gas/testsuite/gas/elf/dwarf2-21.d b/gas/testsuite/gas/elf/dwarf2-21.d
new file mode 100644
index 00000000000..16fa317be66
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-21.d
@@ -0,0 +1,18 @@
+#name: DWARF2 21
+#as: -gdwarf-2
+#readelf: -wL
+# Note that non-zero view numbers are allowed here.  This doesn't really
+# make much sense, but DW_LNS_fixed_advance_pc is defined to not set the
+# view back to zero in contrast with all other changes in PC.  A number
+# of targets always use DW_LNS_fixed_advance_pc in their gas-generated
+# line info.
+
+Contents of the \.debug_line section:
+
+CU: (.*/elf/dwarf2-21|tmpdir/asm)\.s:
+File name +Line number +Starting address +View +Stmt
+(dwarf2-21|asm)\.s +2 +0 +x
+(dwarf2-21|asm)\.s +4 +0x10(| +1) +x
+(dwarf2-21|asm)\.s +8 +0x20(| +2) +x
+(dwarf2-21|asm)\.s +6 +0x30(| +3) +x
+(dwarf2-21|asm)\.s +- +0x40
diff --git a/gas/testsuite/gas/elf/dwarf2-21.s b/gas/testsuite/gas/elf/dwarf2-21.s
new file mode 100644
index 00000000000..8c91043a054
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf2-21.s
@@ -0,0 +1,8 @@
+	.text
+	.nop 16
+	.text 1
+	.nop 16
+	.text 3
+	.nop 16
+	.text 2
+	.nop 16
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 2485008d569..ab862640974 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -296,6 +296,7 @@ if { [is_elf_format] } then {
     run_dump_test "dwarf2-18" $dump_opts
     run_dump_test "dwarf2-19" $dump_opts
     run_dump_test "dwarf2-20" $dump_opts
+    run_dump_test "dwarf2-21" $dump_opts
     run_dump_test "dwarf-5-file0" $dump_opts
     run_dump_test "dwarf-5-file0-2" $dump_opts
     run_dump_test "dwarf-5-dir0" $dump_opts

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Delivery delayed:dwarf2 sub-section test
  2021-09-22  1:02 dwarf2 sub-section test Alan Modra
@ 2021-09-22  6:15 ` postmaster
  2021-09-24 21:47 ` Committed: gas/testsuite/ld-elf/dwarf2-21.d: Pass -W (was: dwarf2 sub-section test) Hans-Peter Nilsson
  1 sibling, 0 replies; 4+ messages in thread
From: postmaster @ 2021-09-22  6:15 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

Delivery is delayed to these recipients or groups:

gary@partis.co.uk<mailto:gary@partis.co.uk>

Subject: dwarf2 sub-section test

This message hasn't been delivered yet. Delivery will continue to be attempted.

The server will keep trying to deliver this message for the next 19 days, 19 hours and 56 minutes. You'll be notified if the message can't be delivered by that time.

[-- Attachment #2: Type: message/delivery-status, Size: 301 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Type: text/rfc822-headers, Size: 5921 bytes --]

Received: from exchange-pop3-connector.com (192.168.0.1) by
 server.partis.co.uk (192.168.0.1) with Microsoft SMTP Server id 14.1.438.0;
 Wed, 22 Sep 2021 03:12:12 +0100
Return-Path: <binutils-bounces+gary=partis.co.uk@sourceware.org>
Delivered-To: postmaster@partis.co.uk
Received: from localhost (unknown [127.0.0.1])	by ezhosts.net (Postfix) with
 ESMTP id 07E45ACF61	for <gary@partis.co.uk>; Wed, 22 Sep 2021 03:03:39 +0200
 (CEST)
X-Virus-Scanned: Debian amavisd-new at 
Authentication-Results: ezhosts.net (amavisd-new); dkim=pass (1024-bit key)
	header.d=sourceware.org
Received: from ezhosts.net ([127.0.0.1])	by localhost (ezhosts.net
 [127.0.0.1]) (amavisd-new, port 10024)	with ESMTP id CMLm-bF0y2eh for
 <gary@partis.co.uk>;	Wed, 22 Sep 2021 03:03:22 +0200 (CEST)
Received: from sourceware.org (unknown [8.43.85.97])	by ezhosts.net (Postfix)
 with ESMTPS id A8F00AD563	for <gary@partis.co.uk>; Wed, 22 Sep 2021 03:03:17
 +0200 (CEST)
Received: from server2.sourceware.org (localhost [IPv6:::1])	by sourceware.org
 (Postfix) with ESMTP id B49E03858411	for <gary@partis.co.uk>; Wed, 22 Sep
 2021 01:03:16 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B49E03858411
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org;
	s=default; t=1632272596;
	bh=cilRJwhBKd2D6WSKQ18xSsYk1A0Q+qLJ3h87YRcGEYk=;
	h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
	 List-Help:List-Subscribe:From:Reply-To:From;
	b=rZfpDsbCCVBqS5P5swuHYM7BDnTqBailUHpNJ+MmcW3axbvB/gApRUnwt9oreev05
	 tJT4dE/YlsUq7IrV/gcihK2nQgX64cWC9rQm+IL60ksGLHfZ9TE1Hm8IxX9Xuw29+S
	 ypisYlJpuR29MzkqsJ3xOAkOf9C1ZsBkyFmsG4jI=
X-Original-To: binutils@sourceware.org
Delivered-To: binutils@sourceware.org
Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com
 [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id
 EE77B3858D39 for <binutils@sourceware.org>; Wed, 22 Sep 2021 01:02:31 +0000
 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EE77B3858D39
Received: by mail-pf1-x42f.google.com with SMTP id w14so1255693pfu.2 for
 <binutils@sourceware.org>; Tue, 21 Sep 2021 18:02:31 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:date:from:to:subject:message-id:mime-version
 :content-disposition;
 bh=cilRJwhBKd2D6WSKQ18xSsYk1A0Q+qLJ3h87YRcGEYk=;
 b=8Nwa7zoox+sBzdz0nTzYEfbiiQWw0zql+9Hef9kXgVoKc6ZgEk9I12sGz/vZqX6ag9
 bnVKkgc5vXtVc6PobSJI1IU6Fvv44vmQIyDAP3mocPqMuCOCfA+NS7nxZO8flxOvw1uo
 7CyL2axfAEILSOSs9OnNHJ2QyWwPAPps9cpDR8veYyKtpKprxw+RBlnlmLB+3YncdQYz
 F+pFem4N236403Yg5C4bqmjIoalCtdsc9mxvhF8hbIsQTfzQWv1o2SP13T3oVffQoTMT
 GVp0lDMALvntJwBsUCcSQGmvog1ngwknQ+sqtjFvmjX+6qbXf64WRBWytvK2s0NtCFyT
 QJzA==
X-Gm-Message-State: AOAM532vIBKPewa+6GiHwLMhysT/+mHd1hfcGOqDSEkWxPoPKs+ZkOFo
 0ZSqvg3+GN07JRhEhgZsyoT/WaelzqY=
X-Google-Smtp-Source: ABdhPJw5aouwL7dB2UrL7uTVV8hHijlL3e8gvdjoiLWJkkyLQFA4uo/CTYLP602MrkmSravq1H/M3g==
X-Received: by 2002:a65:51c7:: with SMTP id i7mr30682941pgq.300.1632272550573; 
 Tue, 21 Sep 2021 18:02:30 -0700 (PDT)
Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au.
 [58.96.106.158]) by smtp.gmail.com with ESMTPSA id
 a11sm304800pfo.31.2021.09.21.18.02.29 for <binutils@sourceware.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Sep 2021
 18:02:30 -0700 (PDT)
Received: by squeak.grove.modra.org (Postfix, from userid 1000) id
 12E491140185; Wed, 22 Sep 2021 10:32:27 +0930 (ACST)
Date: Wed, 22 Sep 2021 10:32:27 +0930
To: <binutils@sourceware.org>
Subject: dwarf2 sub-section test
Message-ID: <YUqAo27NcL2LScsV@squeak.grove.modra.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
X-BeenThere: binutils@sourceware.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Binutils mailing list <binutils.sourceware.org>
List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>,
 <mailto:binutils-request@sourceware.org?subject=unsubscribe>
List-Archive: <https://sourceware.org/pipermail/binutils/>
List-Post: <mailto:binutils@sourceware.org>
List-Help: <mailto:binutils-request@sourceware.org?subject=help>
List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>,
 <mailto:binutils-request@sourceware.org?subject=subscribe>
From: Alan Modra via Binutils <binutils@sourceware.org>
Reply-To: Alan Modra <amodra@gmail.com>
Errors-To: binutils-bounces+gary=partis.co.uk@sourceware.org
Sender: Binutils <binutils-bounces+gary=partis.co.uk@sourceware.org>
X-MS-Exchange-Organization-OriginalArrivalTime: 22 Sep 2021 02:12:12.9618
 (UTC)
X-MS-Exchange-Forest-ArrivalHubServer: SERVER.partis.local
X-MS-Exchange-Organization-OriginalClientIPAddress: 8.43.85.97
X-MS-Exchange-Organization-OriginalServerIPAddress: 127.0.0.1
X-MS-Exchange-Organization-AuthSource: SERVER.partis.local
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-MessageDirectionality: Incoming
X-MS-Exchange-Organization-Cross-Premises-Headers-Processed: SERVER.partis.local
X-MS-Exchange-Organization-PRD: sourceware.org
X-MS-Exchange-Organization-SenderIdResult: Pass
Received-SPF: Pass (SERVER.partis.local: domain of
 binutils-bounces+gary=partis.co.uk@sourceware.org designates 8.43.85.97 as
 permitted sender) receiver=SERVER.partis.local; client-ip=8.43.85.97;
 helo=exchange-pop3-connector.com;
X-MS-Exchange-Organization-SCL: 0
X-MS-Exchange-Organization-PCL: 2
X-MS-Exchange-Organization-Antispam-Report: DV:3.3.16631.866;SID:SenderIDStatus
 Pass;TIME:TimeBasedFeatures;OrigIP:8.43.85.97
X-MS-Exchange-Organization-OriginalSize: 8599
X-MS-Exchange-Forest-MessageScope: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Organization-MessageScope: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Organization-HygienePolicy: Standard
X-MS-Exchange-Organization-Recipient-Limit-Verified: True
X-MS-Exchange-Organization-Processed-By-Journaling: Journal Agent

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Committed: gas/testsuite/ld-elf/dwarf2-21.d: Pass -W (was: dwarf2 sub-section test)
  2021-09-22  1:02 dwarf2 sub-section test Alan Modra
  2021-09-22  6:15 ` Delivery delayed:dwarf2 " postmaster
@ 2021-09-24 21:47 ` Hans-Peter Nilsson
  2021-09-25  1:20   ` Alan Modra
  1 sibling, 1 reply; 4+ messages in thread
From: Hans-Peter Nilsson @ 2021-09-24 21:47 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

> From: Alan Modra via Binutils <binutils@sourceware.org>
> Date: Wed, 22 Sep 2021 03:02:27 +0200

> diff --git a/gas/testsuite/gas/elf/dwarf2-21.d b/gas/testsuite/gas/elf/dwarf2-21.d
> new file mode 100644
> index 00000000000..16fa317be66
> --- /dev/null
> +++ b/gas/testsuite/gas/elf/dwarf2-21.d
> @@ -0,0 +1,18 @@
> +#name: DWARF2 21
> +#as: -gdwarf-2
> +#readelf: -wL
...
> +CU: (.*/elf/dwarf2-21|tmpdir/asm)\.s:

You (or perhaps I, running my autotester using a long-enough
source-path, where this test fails) got bitten by readelf
non-wide default re. "CU:" output.  The same thing happened
to H.J. 2020-12-02; see referred commit and back-and-forth
email traffic at the time.

Now, can we drop the readelf non-"-W" functionality
completely?  People can just truncate the output manually.
("Script compatibility" you say?  They should be using -W!)

Or at least just make -W the default?

Or at least drop the quoted "|| strlen (directory) < 76"
conditional in binutils/dwarf.c?


The following was committed as obvious.
-----------
Required for the expected "CU:" to be emitted for long
source-paths.  See binutils/dwarf.c:

 if (do_wide || strlen (directory) < 76)
   printf (_("CU: %s/%s:\n"), directory, file_table[0].name);
 else
   printf ("%s:\n", file_table[0].name);

See also commit 5f410aa50ce2c, "testsuite/ld-elf/pr26936.d:
Pass -W."

gas/ChangeLog:
	* testsuite/ld-elf/dwarf2-21.d: Pass -W.
---
 gas/testsuite/gas/elf/dwarf2-21.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/testsuite/gas/elf/dwarf2-21.d b/gas/testsuite/gas/elf/dwarf2-21.d
index 16fa317be664..66cd5a95ad13 100644
--- a/gas/testsuite/gas/elf/dwarf2-21.d
+++ b/gas/testsuite/gas/elf/dwarf2-21.d
@@ -1,6 +1,6 @@
 #name: DWARF2 21
 #as: -gdwarf-2
-#readelf: -wL
+#readelf: -wL -W
 # Note that non-zero view numbers are allowed here.  This doesn't really
 # make much sense, but DW_LNS_fixed_advance_pc is defined to not set the
 # view back to zero in contrast with all other changes in PC.  A number
-- 
2.11.0

brgds, H-P

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Committed: gas/testsuite/ld-elf/dwarf2-21.d: Pass -W (was: dwarf2 sub-section test)
  2021-09-24 21:47 ` Committed: gas/testsuite/ld-elf/dwarf2-21.d: Pass -W (was: dwarf2 sub-section test) Hans-Peter Nilsson
@ 2021-09-25  1:20   ` Alan Modra
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Modra @ 2021-09-25  1:20 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

On Fri, Sep 24, 2021 at 11:47:36PM +0200, Hans-Peter Nilsson wrote:
> Or at least just make -W the default?

Changing readelf output often requires quite a bit of editing in our
testsuites.  If you're willing to do the work, and brave enough to
take any flak, I'll OK a patch.

> Or at least drop the quoted "|| strlen (directory) < 76"
> conditional in binutils/dwarf.c?

I'll even preapprove this one.

> The following was committed as obvious.
> -----------
> Required for the expected "CU:" to be emitted for long
> source-paths.  See binutils/dwarf.c:

Thanks for that.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-25  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  1:02 dwarf2 sub-section test Alan Modra
2021-09-22  6:15 ` Delivery delayed:dwarf2 " postmaster
2021-09-24 21:47 ` Committed: gas/testsuite/ld-elf/dwarf2-21.d: Pass -W (was: dwarf2 sub-section test) Hans-Peter Nilsson
2021-09-25  1:20   ` Alan Modra

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).