Hi 研发部淡明杰,
bug description: In my program, expression '$-label' is ok to pass(see attachment
file line 7&8) assemble, but 'lable-$' cannot pass
It is nothing to do with the $ symbol specifically. Any undefined
symbol will give you the same effect. Eg:
$ cat test.s
foo:
nop
.byte undef - foo
.byte foo - undef
% as test.s
foo.s: Assembler messages:
foo.s:4: Error: can't resolve `.text' {.text section} - `undef'
{*UND* section}
This is a known limitation of the assembler/linker. Essentially the
problem is that the linker supports a relocation to compute "symbol -
value" but it does not support a relocation to compute "value - symbol".
So the third line in the example source above is resolved by the
assembler into a zero byte value and a relocation that computes "undef -
1". But the assembler cannot create a relocation to compute "1 - undef"
so it issues the error message.
Cheers
Nick
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils