public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: binutils@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] gas: Make sure to only add an md5 to a .file when requested.
Date: Sat, 29 Aug 2020 02:35:24 +0200	[thread overview]
Message-ID: <20200829003524.16684-1-mark@klomp.org> (raw)

In dwarf2_directive_filename with_md5 is always TRUE. But since if no
md5 is actually given generic_bignum is normally all zeros. Which still
means no md5. But if gas has just parsed a bignum that value will be used
as md5 value. Fix that by initializing with_md5 to FALSE, so that it is
only true when the file directive contains an md5 string.

Add a random bignum value to the dwarf-5-file0.s testcase so that it
fails before this path, but succeeds after.

	* dwarf2dbg.c (dwarf2_directive_filename): Initialize with_md5 to
	FALSE.
	* gas/testsuite/gas/elf/dwarf-5-file0.s: Add a random bignum.
---
 gas/ChangeLog                         | 6 ++++++
 gas/dwarf2dbg.c                       | 2 +-
 gas/testsuite/gas/elf/dwarf-5-file0.s | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 9bdbb4b172f..452bb03a105 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2020-08-28  Mark Wielaard  <mark@klomp.org>
+
+	* dwarf2dbg.c (dwarf2_directive_filename): Initialize with_md5 to
+	FALSE.
+	* gas/testsuite/gas/elf/dwarf-5-file0.s: Add a random bignum.
+
 2020-08-28  Alan Modra  <amodra@gmail.com>
 
 	PR 26460
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index e4ba56d82ba..8a840d0cbf1 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -1014,7 +1014,7 @@ dwarf2_emit_label (symbolS *label)
 char *
 dwarf2_directive_filename (void)
 {
-  bfd_boolean with_md5 = TRUE;
+  bfd_boolean with_md5 = FALSE;
   valueT num;
   char *filename;
   const char * dirname = NULL;
diff --git a/gas/testsuite/gas/elf/dwarf-5-file0.s b/gas/testsuite/gas/elf/dwarf-5-file0.s
index 2792ba8c441..9fc07b5441c 100644
--- a/gas/testsuite/gas/elf/dwarf-5-file0.s
+++ b/gas/testsuite/gas/elf/dwarf-5-file0.s
@@ -10,6 +10,8 @@
 	.text
 	.word 0
 
+	.octa 0x12345678901234567890123456789012
+
 	.file 1 "secondary directory/secondary source file"
 	.line 2
 	.word 2
-- 
2.18.4


             reply	other threads:[~2020-08-29  0:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-29  0:35 Mark Wielaard [this message]
2020-09-07 11:10 ` Nick Clifton
2020-09-07 11:16   ` Mark Wielaard
2020-09-07 11:51     ` Nick Clifton

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=20200829003524.16684-1-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=binutils@sourceware.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).