This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] microMIPS/GAS: Avoid relocation overflow with forced 16-bit branches
"Maciej W. Rozycki" <macro@codesourcery.com> writes:
> On Thu, 25 Oct 2012, Richard Sandiford wrote:
>> > Overall it looks to me the whole idea of using fixp->fx_size to check for
>> > relocatable field overflows is missing the point, at least for the MIPS
>> > target and relocations in text, where the size of the fixup reflects the
>> > width of the instruction a relocation is applied to and has little to do
>> > with the range supported.
>> >
>> > Anyway, to fix this immediate problem I have gladly accepted Chao-ying's
>> > proposal.
>> >
>> > No regressions in testing across the usual MIPS targets. OK to apply?
>> >
>> > 2012-10-24 Chao-ying Fu <fu@mips.com>
>> >
>> > gas/
>> > * config/tc-mips.c (append_insn): Set fx_no_overflow for 16-bit
>> > microMIPS branch relocations.
>> >
>> > gas/testsuite/
>> > * gas/mips/micromips-b16.d: New test.
>> > * gas/mips/micromips-b16.s: New test source.
>> > * gas/mips/mips.exp: Run the new test.
>>
>> I take your point about the write.c check (been hit by that before too),
>> but I suppose the obvious question is: do we still report branches that
>> genuinely overflow?
>
> Of course we do, for symbols resolved at the assembly time GAS does that
> and for all the others the linker does:
OK, OK, it was a genuine question :-) Thanks for the example though.
>> Would be nice to have a test for that too, if we don't already.
>
> We do have some tests, but only for BPOSGE32. ;) And for the linker we
> check some other relocations, but we don't check the branch ones. I'll
> see what I can do, but I hope that is not a prerequisite for this bug fix,
> I'd like to tick it off.
Nope, not a prerequisite. Patch is OK, thanks.
Richard