]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: check section size against entry size
authorJan Beulich <jbeulich@suse.com>
Fri, 1 Aug 2025 07:16:19 +0000 (09:16 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 1 Aug 2025 07:16:19 +0000 (09:16 +0200)
If a section has a non-zero entry size, its total size would generally
better be a multiple of the entry size. Warn if that's not the case.

gas/write.c

index c56ad28ea51c1e4f61d0840b38c6e6d61b886574..9d30445533818d9e5ed6dfff124336818fae6ac6 100644 (file)
@@ -632,6 +632,10 @@ size_seg (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *xxx ATTRIBUTE_UNUSED)
 #ifdef obj_frob_section
   obj_frob_section (sec);
 #endif
+
+  if (sec->entsize && (sec->size % sec->entsize))
+    as_warn (_("section `%s' size (%#" PRIx64 ") is not a multiple of its entry size %#x"),
+            sec->name, (uint64_t) sec->size, sec->entsize);
 }
 
 #ifdef DEBUG2