From: Jan Beulich Date: Fri, 1 Aug 2025 07:16:19 +0000 (+0200) Subject: gas: check section size against entry size X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85cced8e9b9942d223b3a54757d879000fc04b38;p=thirdparty%2Fbinutils-gdb.git 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 --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