aboutsummaryrefslogtreecommitdiff
path: root/ld/ldlang.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-10-31 01:12:26 +0000
committerAlan Modra <amodra@gmail.com>2001-10-31 01:12:26 +0000
commit6e814ff88112f40fe06e09ef984caaf59b48884f (patch)
treeb568dbd4bd51c6465158207d7b6d67d155122e09 /ld/ldlang.c
parent2d98304df3e9672b9386b4a6e7edd324973da61c (diff)
downloadfsf-binutils-gdb-6e814ff88112f40fe06e09ef984caaf59b48884f.zip
fsf-binutils-gdb-6e814ff88112f40fe06e09ef984caaf59b48884f.tar.gz
fsf-binutils-gdb-6e814ff88112f40fe06e09ef984caaf59b48884f.tar.bz2
* ldlang.c (lang_size_sections): Keep a valid output_offset field
for padding statements.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r--ld/ldlang.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 014c791..40f109a 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -3156,6 +3156,14 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
padding to shrink. If padding is needed on this pass, it
will be added back in. */
s->padding_statement.size = 0;
+
+ /* Make sure output_offset is valid. If relaxation shrinks
+ the section and this pad isn't needed, it's possible to
+ have output_offset larger than the final size of the
+ section. bfd_set_section_contents will complain even for
+ a pad size of zero. */
+ s->padding_statement.output_offset
+ = dot - output_section_statement->bfd_section->vma;
break;
case lang_group_statement_enum: