aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-11-01 04:15:07 +0000
committerAlan Modra <amodra@gmail.com>2012-11-01 04:15:07 +0000
commitaa4c331959a9b4fed648e7b98de13b93dd9b455a (patch)
treecc03bc37a2922fc4c612ab369d34d00b01ae426e /ld/ldlang.c
parent6e1f115e7a0c01ff89a0f954030421e30a68e30f (diff)
downloadgdb-aa4c331959a9b4fed648e7b98de13b93dd9b455a.zip
gdb-aa4c331959a9b4fed648e7b98de13b93dd9b455a.tar.gz
gdb-aa4c331959a9b4fed648e7b98de13b93dd9b455a.tar.bz2
* ldlang.c (insert_pad): Correct output section size calculation.
(lang_size_sections_1): Likewise for lang_data_statement and lang_reloc_statement.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 0c97898..6802211 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -4594,7 +4594,8 @@ insert_pad (lang_statement_union_type **ptr,
}
pad->padding_statement.output_offset = dot - output_section->vma;
pad->padding_statement.size = alignment_needed;
- output_section->size += alignment_needed;
+ output_section->size = TO_SIZE (dot + TO_ADDR (alignment_needed)
+ - output_section->vma);
}
/* Work out how much this section will move the dot point. */
@@ -5159,7 +5160,9 @@ lang_size_sections_1
if (size < TO_SIZE ((unsigned) 1))
size = TO_SIZE ((unsigned) 1);
dot += TO_ADDR (size);
- output_section_statement->bfd_section->size += size;
+ output_section_statement->bfd_section->size
+ = TO_SIZE (dot - output_section_statement->bfd_section->vma);
+
}
break;
@@ -5173,7 +5176,8 @@ lang_size_sections_1
output_section_statement->bfd_section;
size = bfd_get_reloc_size (s->reloc_statement.howto);
dot += TO_ADDR (size);
- output_section_statement->bfd_section->size += size;
+ output_section_statement->bfd_section->size
+ = TO_SIZE (dot - output_section_statement->bfd_section->vma);
}
break;