Computing .long .L123-.L100

Kazu Hirata kazu@cs.umass.edu
Wed Jan 21 20:03:00 GMT 2004


Hi,

I have a question about computing the difference of two labels at
assembly time.  Does gas/tc-<target>.c have to do something special?
I thought defining DIFF_EXPR_OK would do the job, but it doesn't seem
to.

Is a difference of two labels computed as soon as the values of both
labels become available?  While assembling the following piece of code
on sh-elf, which does support the difference of two labels, I found
that the value of .L3-.L9 seems to be computed from colon () in
symbols.c.

	.text
	.global	_foo
	.type	_foo, @function
_foo:
	nop
	nop
.L9:
	.long	.L3-.L9
	nop
.L3:
	nop

Another related question is that sh_cons_fix_new() outputs a reloc for
.long .L3-.L9., but the disassembly of the resulting object file does
not contain the reloc anymore.  Where is such a reloc deleted?

Thanks in advance,

Kazu Hirata



More information about the Binutils mailing list