[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[committed] Handle .bss at same offset as .debug_pubnames
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)
{