This is the mail archive of the
mailing list for the binutils project.
Re: [PATCH, MIPS] Relax alignment check for LDPC
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Matthew Fortune <Matthew dot Fortune at imgtec dot com>
- Cc: "binutils\ at sourceware dot org" <binutils at sourceware dot org>
- Date: Fri, 19 Dec 2014 12:39:08 +0000
- Subject: Re: [PATCH, MIPS] Relax alignment check for LDPC
- Authentication-results: sourceware.org; auth=none
- References: <6D39441BF12EF246A7ABCE6654B0235320F882C9 at LEMAIL01 dot le dot imgtec dot org> <87oar3fhln dot fsf at googlemail dot com> <6D39441BF12EF246A7ABCE6654B0235320F88AD0 at LEMAIL01 dot le dot imgtec dot org>
Matthew Fortune <Matthew.Fortune@imgtec.com> writes:
> Richard Sandiford <email@example.com> writes:
>> only safe if the target has 8-byte alignment at assembly time. I.e. the
>> section that the target is in should have at least 8 bytes alignment and
>> the symbol itself should have an offset that's divisible by 8.
>> So I think we should either check S_GET_VALUE (fx_addsy) + fx_offset is
>> aligned or (probably better, if it works) check that the low 3 bits of
>> *valP are the same as the low three bits of:
>> fixP->fx_where + fixP->fx_frag->fr_address
> OK. I almost did something like this but essentially wasn't confident enough.
> I'm not sure I follow on the low three bits matching part?
It should have been the low 3 bits of -*valP. I just thought that any
"misalignment" from 8 bytes could only come directly from the address
of the LDPC itself. I'm happy with not doing that though.
> So the extra questions are is it OK that:
> LD <Reg>,<off>($pc) requires 'off' to be a multiple of 8 and the calculation
> here is ($pc&~7 + off).
2> LDPC <reg>, <4-byte-aligned-label>+<4-byte-multiple-offset> is
> meaningless and will break for REL.
> Personally I think the former is not overly harmful but I suspect some would
> prefer the latter to raise an error rather than silently lose bits.
Yeah. I take the point about n32 and n64 being RELA, but we also have
o64 and 64-bit EABI, both of which are REL. How about requiring the
symbol and offset to be individually aligned?