[prev in list] [next in list] [prev in thread] [next in thread]
List: binutils
Subject: Re: [patch] MIPS: Use the right offset for LO16 in add_got_offset_hilo() (ping)
From: Richard Sandiford <rsandifo () redhat ! com>
Date: 2005-02-27 14:30:22
Message-ID: 87ekf2cby9.fsf () firetop ! home
[Download RAW message or body]
"Maciej W. Rozycki" <macro@linux-mips.org> writes:
> @@ -4104,7 +4104,9 @@ add_got_offset_hilo (int dest, expressio
> mips_optimize = 2;
> macro_build_lui (&global, tmp);
> mips_optimize = hold_mips_optimize;
> + local->X_add_number = ((local->X_add_number + 0x8000) & 0xffff) - 0x8000;
> macro_build (local, ADDRESS_ADDI_INSN, "t,r,j", tmp, tmp, BFD_RELOC_LO16);
> + local->X_add_number = global.X_add_number;
> relax_end ();
>
> macro_build (NULL, ADDRESS_ADD_INSN, "d,v,t", dest, dest, tmp);
You asked about this patch in the other thread, so FWIW, I agree that
it does the right thing. Obviously I can't approve it though.
My main concern is that it seems to leave things in a slightly
inconsistent state. In the case of load_got_offset, it's the caller
that adjusts the GOT16 offset:
expr1.X_add_number = offset_expr.X_add_number;
offset_expr.X_add_number =
((offset_expr.X_add_number + 0x8000) & 0xffff) - 0x8000;
load_got_offset (tempreg, &offset_expr);
offset_expr.X_add_number = expr1.X_add_number;
whereas the patch makes the callee adjust the LO16 offset. I had to
stare at the patch for a while before realising that the new code is
compensating for an adjustment made by the _caller_ of load_got_offset,
not load_got_offset itself.
I agree that hiding this adjustment in add_got_offset_hilo is the right
way to go. However, it might be better to move the offset_expr adjustment
into load_got_offset at the same time.
Richard
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic