This is the mail archive of the binutils@sourceware.org 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: RFC: PATCH: PR gas/12049: Unnecessary relaxation


On Sun, Oct 17, 2010 at 6:32 PM, Alan Modra <amodra@gmail.com> wrote:
> On Sat, Oct 16, 2010 at 03:28:50PM -0700, H.J. Lu wrote:
>> 1. Set address for each frag.
>> 2. Relax and update address for each frag. ?For rs_machine_dependent
>> frag, if its size grows with forward reference, update fr_address for
>> all successive frags.
>> 3. If stretched, goto 2.
>>
>> Does it make any senses?
>
> No it does not. ?The frag loop here is already two deep in loops (loop
> until nothing changed this segment, and loop until nothing changed in
> all segments). ?You've just made the innermost loop over frags
> O(n**2). ?I think that is way too expensive.

We can limit the new one to the first pass only.

> A possible fix for your testcase is to allow relax_frag to shrink
> rs_machine_dependent frags, rather than just grow them as it does at
> the moment.
>

I tried it and it doesn't work. The problem is

       .fill 14, 1, 0x90
       jmp     .LBB1_23   <- frag 1
       .fill 14, 1, 0x90
       jmp     .LBB1_23  <- frag 2
       .fill 18, 1, 0x90
       .align  16, 0x90    <- frag 3
       .fill 96, 1, 0x90
.LBB1_23:

After frag 1 is grown by 4 bytes, we may not
shrink frag 2 unless the address of frag 3
is adjusted first, which is what my patch does.

-- 
H.J.


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