This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH v2 1/2] LD: Avoid a division by zero page size with SEGMENT_START handling
- From: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: Alan Modra <amodra at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 14 Sep 2018 00:41:15 +0100 (BST)
- Subject: [PATCH v2 1/2] LD: Avoid a division by zero page size with SEGMENT_START handling
- References: <alpine.LFD.2.21.1809132337450.16413@eddie.linux-mips.org>
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.
---
New in v2.
---
ld/ldexp.c | 1 +
1 file changed, 1 insertion(+)
binutils-ld-segment-start-maxpagesize.diff
Index: src/ld/ldexp.c
===================================================================
--- src.orig/ld/ldexp.c
+++ src/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"),