aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-01-12 15:41:22 +1030
committerAlan Modra <amodra@gmail.com>2022-01-13 14:12:43 +1030
commit0ae1246717ffbabda5d54be8def95f4424147c0f (patch)
tree491789fa1c6ec38fda5b8527a34c07620cda1118 /bfd/elflink.c
parente31cf164b4c78246f59922a9122585dc4e23e860 (diff)
downloadbinutils-0ae1246717ffbabda5d54be8def95f4424147c0f.zip
binutils-0ae1246717ffbabda5d54be8def95f4424147c0f.tar.gz
binutils-0ae1246717ffbabda5d54be8def95f4424147c0f.tar.bz2
Re: Set SEC_ELF_REVERSE_COPY earlier
Let's not rely on .init/.fini having relocs for the size sanity check. This is mainly to squash reports of "my fuzzed object made ld hang".
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 1074802..4529f83 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11834,9 +11834,10 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
{
/* Reverse-copy input section to output. */
- if (o->reloc_count != 0
- && (o->size * bed->s->int_rels_per_ext_rel
- != o->reloc_count * address_size))
+ if ((o->size & (address_size - 1)) != 0
+ || (o->reloc_count != 0
+ && (o->size * bed->s->int_rels_per_ext_rel
+ != o->reloc_count * address_size)))
{
_bfd_error_handler
/* xgettext:c-format */