aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2018-09-14 20:22:56 +0100
committerMaciej W. Rozycki <macro@linux-mips.org>2018-09-14 20:22:56 +0100
commita000f8817b32eadd4aeadf9185634350a59e6649 (patch)
tree6a834679a3e5632bff6b92b9f64dbe7e92c932a4 /ld/ldexp.c
parent606cc04085a08f5e04eda6ef67f516bf81b691a1 (diff)
downloadgdb-a000f8817b32eadd4aeadf9185634350a59e6649.zip
gdb-a000f8817b32eadd4aeadf9185634350a59e6649.tar.gz
gdb-a000f8817b32eadd4aeadf9185634350a59e6649.tar.bz2
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.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c1
1 files changed, 1 insertions, 0 deletions
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"),