From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 0DC963857C55 for ; Sat, 29 Aug 2020 00:35:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0DC963857C55 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id BD84B30278CD; Sat, 29 Aug 2020 02:35:36 +0200 (CEST) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id A9779470866E; Sat, 29 Aug 2020 02:35:36 +0200 (CEST) From: Mark Wielaard To: binutils@sourceware.org Cc: Mark Wielaard Subject: [PATCH] gas: Make sure to only add an md5 to a .file when requested. Date: Sat, 29 Aug 2020 02:35:24 +0200 Message-Id: <20200829003524.16684-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Aug 2020 00:35:39 -0000 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 + + * 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 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