From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122592 invoked by alias); 5 Jul 2019 17:15:31 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 122578 invoked by uid 89); 5 Jul 2019 17:15:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=nobits, NOBITS X-Spam-Status: No, score=-26.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Handle .bss at same offset as .debug_pubnames Message-ID: <20190705171524.GA30116@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q3/txt/msg00042.txt.bz2 Hi, when running make CC=clang check on ubuntu 18.04, we get: ... $ make CC=clang check ... dwz: Allocatable section in 1.debug after non-allocatable ones FAIL: /home/vries/dwz/dwz.git/testsuite/dwz.tests/eu-strip-unstrip.sh ... The trigger is that the 1.debug file (generated using eu-strip -f) contains a .bss section with the same offset as the .debug_pubnames section. ... [Nr] Name Type Address Offset Size EntSize Flags Link Info Align ... [23] .bss NOBITS 0000000000601030 00000260 0000000000000008 0000000000000000 WA 0 0 1 [24] .comment NOBITS 0000000000000000 00000260 0000000000000061 0000000000000001 MS 0 0 1 [25] .debug_pubnames PROGBITS 0000000000000000 00000260 000000000000001b 0000000000000000 0 0 1 ... The problem is here in write_dso: ... else if (!last_shoff && (dso->shdr[j].sh_offset < min_shoff || (dso->shdr[j].sh_offset == min_shoff && dso->shdr[j].sh_size == 0))) continue; else if ((dso->shdr[j].sh_flags & SHF_ALLOC) != 0) { error (0, 0, "Allocatable section in %s after " "non-allocatable ones", dso->filename); return 1; } ... For the .bss section, "dso->shdr[j].sh_offset == min_shoff" holds, but "dso->shdr[j].sh_size == 0" doesn't hold, so it won't get skipped. Fix this by testing for sh_type == SHT_NOBITS in addition to sh_size == 0. Committed to trunk. Thanks, - Tom Handle .bss at same offset as .debug_pubnames 2019-07-05 Tom de Vries * dwz.c (write_dso): Handle NOBITS allocatable section. --- dwz.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwz.c b/dwz.c index f959ffb..98f6f53 100644 --- a/dwz.c +++ b/dwz.c @@ -10683,7 +10683,8 @@ write_dso (DSO *dso, const char *file, struct stat *st) else if (!last_shoff && (dso->shdr[j].sh_offset < min_shoff || (dso->shdr[j].sh_offset == min_shoff - && dso->shdr[j].sh_size == 0))) + && (dso->shdr[j].sh_size == 0 + || dso->shdr[j].sh_type & SHT_NOBITS)))) continue; else if ((dso->shdr[j].sh_flags & SHF_ALLOC) != 0) {