public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gas: Make sure to only add an md5 to a .file when requested.
@ 2020-08-29  0:35 Mark Wielaard
  2020-09-07 11:10 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2020-08-29  0:35 UTC (permalink / raw)
  To: binutils; +Cc: Mark Wielaard

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


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

end of thread, other threads:[~2020-09-07 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29  0:35 [PATCH] gas: Make sure to only add an md5 to a .file when requested Mark Wielaard
2020-09-07 11:10 ` Nick Clifton
2020-09-07 11:16   ` Mark Wielaard
2020-09-07 11:51     ` Nick Clifton

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