This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
elflint: (zero sized section) alloc flag set but section not in any loaded segment
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Thu, 26 Apr 2012 11:58:52 +0200
- Subject: elflint: (zero sized section) alloc flag set but section not in any loaded segment
Hi,
Against development versions of gcc/binutils elflint gives some
complaints like:
section [24] '.tm_clone_table': alloc flag set but section not in any
loaded segment
This is because that section's size is zero. So it is somewhat
reasonable IMHO that the linker doesn't put it in any segment.
Is the following patch to elflint OK?
Thanks,
Mark
commit e4b786145aac6de17b84c77ddf2db40629cca9ee
Author: Mark Wielaard <mjw@redhat.com>
Date: Thu Apr 26 11:45:47 2012 +0200
elflint: Don't check zero sized sections are loaded in any segment.
diff --git a/src/ChangeLog b/src/ChangeLog
index cae5e6b..6252686 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-26 Mark Wielaard <mjw@redhat.com>
+
+ * elflint (check_sections): Don't check zero sized sections are
+ loaded in any segment.
+
2012-04-24 Mark Wielaard <mjw@redhat.com>
* readelf.c (print_ops): Add DW_OP_GNU_push_tls_address,
diff --git a/src/elflint.c b/src/elflint.c
index a03caac..09daef7 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -3701,7 +3701,8 @@ section [%2zu] '%s' is both executable and writable\n"),
cnt, section_name (ebl, cnt));
}
- if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0)
+ if (ehdr->e_type != ET_REL && (shdr->sh_flags & SHF_ALLOC) != 0
+ && shdr->sh_size != 0)
{
/* Make sure the section is contained in a loaded segment
and that the initialization part matches NOBITS sections. */