This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Fix the relax finalize pass


On Thu, May 15, 2003 at 09:23:47AM +0930, Alan Modra wrote:
> On Wed, May 14, 2003 at 04:28:38PM -0700, H. J. Lu wrote:
> > On Thu, May 15, 2003 at 08:52:15AM +0930, Alan Modra wrote:
> > > On Wed, May 14, 2003 at 03:53:46PM -0700, H. J. Lu wrote:
> > > > The problem is linker keeps changing data segment address after the
> > > > relax finalize pass starts. It makes the GP calculation in the relax
> > > > finalize pass invalid. This patch tries to avoid it.
> > > 
> > > Huh?  When relax_finalize is set, you shouldn't be changing the size
> > > of any sections.
> > > 
> > 
> > That is what my patch tries to do. When the relax finalize is about to
> > start, exp_data_seg.phase may be set to exp_dataseg_adjust during the
> > last iteration. As the result, the data segment address may change.
> > Also relax_finalize is not checked by lang_size_sections which will
> > try to save a page whenever it has a chance.
> 
> My point was that the backend shouldn't be changing sizes during
> relax_finalize.  If it does, then of course the generic parts of the
> linker will also change sizes.
> 

The ia64 backend does reduce got size in this case. But it is not
the problem here. The problem is lang_process something like

loop:
	lang_reset_memory_regions
	lang_do_assignments
	lang_size_sections
	...
	goto looop

lang_size_sections may set exp_data_seg.phase to exp_dataseg_adjust
so that in the next iteration, fold_binary does

	if (exp_data_seg.phase != exp_dataseg_adjust)
	...
	else if (commonepage < maxpage)
	  adjust data segment address

If exp_data_seg.phase is exp_dataseg_adjust when the relax finalize 
is about to start, the data segment address may be changed by
fold_binary.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]