RFC: PATCH: PR gas/12049: Unnecessary relaxation
H.J. Lu
hjl.tools@gmail.com
Mon Oct 18 03:36:00 GMT 2010
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.
More information about the Binutils
mailing list