aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-08-09 06:14:09 +0000
committerIan Lance Taylor <ian@airs.com>1999-08-09 06:14:09 +0000
commitfe9edd22759e68387d4617742f1373fbf5a66c62 (patch)
tree565775cb9a3a02f5da52d2d7c0afdddc6013e48a /ld
parent91d3970e7deae6622b5b13cdb5367c4bd91b706c (diff)
downloadgdb-fe9edd22759e68387d4617742f1373fbf5a66c62.zip
gdb-fe9edd22759e68387d4617742f1373fbf5a66c62.tar.gz
gdb-fe9edd22759e68387d4617742f1373fbf5a66c62.tar.bz2
From Wally Iimura <iimura@microunity.com>:
* ldlang.c (lang_size_sections): When checking whether an address is within a region, don't get confused by wrapping around at the end of the address space.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog7
-rw-r--r--ld/ldlang.c18
2 files changed, 20 insertions, 5 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 5d80834..8f68eff 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,10 @@
+1999-08-09 Ian Lance Taylor <ian@zembu.com>
+
+ From Wally Iimura <iimura@microunity.com>:
+ * ldlang.c (lang_size_sections): When checking whether an address
+ is within a region, don't get confused by wrapping around at the
+ end of the address space.
+
1999-08-08 Ian Lance Taylor <ian@zembu.com>
* ldlang.c (wild_doit): Update for renaming of SEC_SHORT to
diff --git a/ld/ldlang.c b/ld/ldlang.c
index c447f6d..acdd31f 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2740,14 +2740,22 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
overall size in memory. */
if (os->region != (lang_memory_region_type *) NULL
&& (bfd_get_section_flags (output_bfd, os->bfd_section)
- & (SEC_ALLOC | SEC_LOAD)))
+ & (SEC_ALLOC | SEC_LOAD)))
{
os->region->current = dot;
- /* Make sure this isn't silly. */
- if (os->region->current < os->region->origin
- || (os->region->current - os->region->origin
- > os->region->length))
+ /* Make sure the new address is within the region. We
+ explicitly permit the current address to be at the
+ exact end of the region when the VMA is non-zero,
+ in case the region is at the end of addressable
+ memory and the calculation wraps around. */
+ if ((os->region->current < os->region->origin
+ || (os->region->current - os->region->origin
+ > os->region->length))
+ && ((os->region->current
+ != os->region->origin + os->region->length)
+ || os->bfd_section->vma == 0))
+
{
if (os->addr_tree != (etree_type *) NULL)
{