SH @(expr,pc) fix-ups broken

Alexandre Oliva aoliva@redhat.com
Thu Jan 31 02:30:00 GMT 2002


This patch contains part of a test that Hans-Peter Nilsson wrote while
contracting with Red Hat, and a fix for the bug it currently exposes.
I'm not convinced the test is correct, and I couldn't find any
rationale behind the `-4' (perhaps it just worked like that at that
time? :-).  H-P?

IMO, the `-4' should be taken out, and the newly-introduced
A_DISP_PC_ABS fix-ups should be emitted with a +4 correction such
that, when we subtract 4 at the time of emitting the opcode or
generating a relocation, we get the correct result.  Compare, for
example, the use of an immediate, that gets the exact given value into
the objdump output (even though the immediate operand is that minus
4), with the use of an expression that results a constant, that
ends up encoding the value of the expression in the opcode, such that
it references the wrong word.

Anyway, if H-P's test is justifiably correct, this patch fixes the bug
and introduces a testcase.  Otherwise, I'd rather remove the `-4' from
the expressions and adjust parse_at such that it uses A_DISP_PC_ABS
for both literal constants and expressions, and it adds 4 to
X_add_number to compensate for the PC offset.

Comments?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sh-gas-pcrel.patch
Type: text/x-patch
Size: 4787 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20020131/743f9356/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


More information about the Binutils mailing list