dubious use of O_subtract in gas/config/tc-ia64.c

James E Wilson wilson@specifixinc.com
Mon Mar 7 21:46:00 GMT 2005


On Mon, 2005-02-28 at 03:19, Jan Beulich wrote:
> Even with the recent pcrel patch applied I still see problems with
> this: The checks there prohibit more complex expressions than just a
> simple subtract, e.g. (with symbol1 and symbol2 in the same section)

Sure, the current O_subtract stuff has problems.  I didn't mean to
suggest it was correct.  I was just giving examples showing what the
original author was thinking.

Just removing the checks doesn't work.  We have to accept the operand,
and generate a reloc for it somehow.  I'm not sure what change you are
proposing.  I don't recall seeing a patch, and I am having trouble
coming up with one while I am sick.  I can do a test against the linux
kernel to make sure we aren't breaking it, but I need a patch to test.

There is one obvious difference between the data case and the
instruction case.  In the data case, we know the operand size.  In the
instruction case, we may not know the operand size.  If we have a
constant, we can know for sure whether an operand is OK, but if we don't
have a constant we have to guess.  We probably just have to accept
anything which isn't a constant, and then rely on later code that tries
to resolve relocations to give an error if appropriate.

A possible exception might be instructions with multiple operand sizes,
like move, in which case it might be useful to pick the large one, and
then relax to a smaller one.  Or maybe we just make it an error if movl
is required and the movl mnemonic wasn't used.  Your original example
seems to imply that you expect the latter case.

Also, we don't have PC-relative relocs for all instruction operand
sizes, which may constrain what we can do, but I don't know if that is
relevant to the immediate problem.  Presumably we just get an error when
resolving relocs which is what you expect.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com




More information about the Binutils mailing list