[binutils-gdb] gas: check section size against entry size
Jan Beulich
jbeulich@sourceware.org
Fri Aug 1 07:19:15 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=85cced8e9b9942d223b3a54757d879000fc04b38
commit 85cced8e9b9942d223b3a54757d879000fc04b38
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri Aug 1 09:16:19 2025 +0200
gas: check section size against entry size
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.
Diff:
---
gas/write.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gas/write.c b/gas/write.c
index c56ad28ea51..9d304455338 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -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
More information about the Binutils-cvs
mailing list