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

* Re: [PATCH] gas: Make sure to only add an md5 to a .file when requested.
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2020-09-07 11:10 UTC (permalink / raw)
  To: Mark Wielaard, binutils

Hi Mark,

> 	* dwarf2dbg.c (dwarf2_directive_filename): Initialize with_md5 to
> 	FALSE.
> 	* gas/testsuite/gas/elf/dwarf-5-file0.s: Add a random bignum.

Approved and applied.

I had to make one small change for the SH targets:  I deleted the ".word 0"
line before the ".octa xxxx" line, so that it was the first value in the
.text section.  This ensures that the section has the necessary alignment
and stops the SH targets from complaining about mis-aligned data.

Cheers
  Nick


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

* Re: [PATCH] gas: Make sure to only add an md5 to a .file when requested.
  2020-09-07 11:10 ` Nick Clifton
@ 2020-09-07 11:16   ` Mark Wielaard
  2020-09-07 11:51     ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Wielaard @ 2020-09-07 11:16 UTC (permalink / raw)
  To: Nick Clifton, binutils

On Mon, 2020-09-07 at 12:10 +0100, Nick Clifton wrote:
> > 	* dwarf2dbg.c (dwarf2_directive_filename): Initialize with_md5 to
> > 	FALSE.
> > 	* gas/testsuite/gas/elf/dwarf-5-file0.s: Add a random bignum.
> 
> Approved and applied.

Thanks.

> I had to make one small change for the SH targets:  I deleted the ".word 0"
> line before the ".octa xxxx" line, so that it was the first value in the
> .text section.  This ensures that the section has the necessary alignment
> and stops the SH targets from complaining about mis-aligned data.

Sorry, I hadn't seen that issue. I do configure with --enable-
targets=all. What else do I need to catch such issues?

Cheers,

Mark

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

* Re: [PATCH] gas: Make sure to only add an md5 to a .file when requested.
  2020-09-07 11:16   ` Mark Wielaard
@ 2020-09-07 11:51     ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2020-09-07 11:51 UTC (permalink / raw)
  To: Mark Wielaard, binutils

Hi Mark,

>> I had to make one small change for the SH targets: 

> Sorry, I hadn't seen that issue. I do configure with --enable-
> targets=all. What else do I need to catch such issues?

The targets=all configuration will catch most architecture-specific
linker problems, but unfortunately it does not work so well with
assembler issues.  The only real way is to have a whole slew of
different configurations set up and ready to rebuild and retest
once a patch is applied.  Which takes up a lot of disk space and a
lot of time...  

I have such a set up since I see as part of my job as a maintainer 
for the binutils, but I would not expect individual contributors to
go to such lengths.  That is one of the reasons why I try to test
generic-code-affecting patches in my local farm before approving them.

Cheers
  Nick



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