This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] LD: Avoid a division by zero page size with SEGMENT_START handling
- From: Maciej W.Rozycki <macro at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 14 Sep 2018 19:24:43 -0000
- Subject: [binutils-gdb] LD: Avoid a division by zero page size with SEGMENT_START handling
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a000f8817b32eadd4aeadf9185634350a59e6649
commit a000f8817b32eadd4aeadf9185634350a59e6649
Author: Maciej W. Rozycki <macro@linux-mips.org>
Date: Fri Sep 14 20:22:56 2018 +0100
LD: Avoid a division by zero page size with SEGMENT_START handling
Avoid a division by zero and thus a linker crash in SEGMENT_START script
builtin function handling, by not checking the value supplied with a
`-T' command-line override against the maximum page size if that has not
been set.
ld/
* ldexp.c (fold_binary): Check that `config.maxpagesize' is
non-zero before using it as a divisor.
Diff:
---
ld/ChangeLog | 5 +++++
ld/ldexp.c | 1 +
2 files changed, 6 insertions(+)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index f1a5506..bda269c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2018-09-14 Maciej W. Rozycki <macro@linux-mips.org>
+
+ * ldexp.c (fold_binary): Check that `config.maxpagesize' is
+ non-zero before using it as a divisor.
+
2018-09-03 Nick Clifton <nickc@redhat.com>
* po/fi.po: Updated Finnish translation.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index e123f0e..4b9676e 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -545,6 +545,7 @@ fold_binary (etree_type *tree)
{
if (!seg->used
&& config.magic_demand_paged
+ && config.maxpagesize != 0
&& (seg->value % config.maxpagesize) != 0)
einfo (_("%P: warning: address of `%s' "
"isn't multiple of maximum page size\n"),