From 9af0dba9fd2bfa1a90d37e2120c2c310dc1c3fd3 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 31 Oct 2001 01:12:26 +0000 Subject: [PATCH] * ldlang.c (lang_size_sections): Keep a valid output_offset field for padding statements. --- ld/ChangeLog | 9 +++++++-- ld/ldlang.c | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 4fe4a54cac..e1dc13232d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2001-10-31 David Heine + + * ldlang.c (lang_size_sections): Keep a valid output_offset field + for padding statements. + 2001-10-30 Hans-Peter Nilsson * configure.tgt (mmix-*-*): New target. @@ -8,7 +13,7 @@ scripttempl/mmo.sc: New files. * gen-doc.texi: @set MMIX. * ld.texinfo: Ditto. - [MMIX] Add MMIX node. + [MMIX] Add MMIX node. * Makefile.in: Regenerate. 2001-10-29 Kazu Hirata @@ -48,7 +53,7 @@ * pe-dll.c (autofilter_objectlist): Add startup objects for profiling. (auto-export): Constify char * p. - Extract file basename and use strcmp rather than ststr + Extract file basename and use strcmp rather than ststr for object lookup. 2001-10-18 Chris Demetriou diff --git a/ld/ldlang.c b/ld/ldlang.c index 014c791c12..40f109a94c 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: -- 2.11.0