aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2025-08-01 09:16:19 +0200
committerJan Beulich <jbeulich@suse.com>2025-08-01 09:16:19 +0200
commit85cced8e9b9942d223b3a54757d879000fc04b38 (patch)
tree3cd27ce0eed407031b051a77694f69c0159ae98e
parent2666c0cecf4930421d89c8610456c5147489fc17 (diff)
downloadbinutils-85cced8e9b9942d223b3a54757d879000fc04b38.zip
binutils-85cced8e9b9942d223b3a54757d879000fc04b38.tar.gz
binutils-85cced8e9b9942d223b3a54757d879000fc04b38.tar.bz2
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.
-rw-r--r--gas/write.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gas/write.c b/gas/write.c
index c56ad28..9d30445 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