From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Handle .bss at same offset as .debug_pubnames
Date: Tue, 01 Jan 2019 00:00:00 -0000 [thread overview]
Message-ID: <20190705171524.GA30116@delia> (raw)
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 <tdevries@suse.de>
* 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)
{
reply other threads:[~2019-07-05 17:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190705171524.GA30116@delia \
--to=tdevries@suse.de \
--cc=dwz@sourceware.org \
--cc=jakub@redhat.com \
/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).