Needless relocations in mn10300-elf

Alexandre Oliva aoliva@redhat.com
Tue Sep 25 01:51:00 GMT 2001


When we have something like this in AM33 assembly:

.long .Lfoo - .Lbar
[...] # no .section changes here
.Lbar:
[...] # there may be .section changes here
.Lfoo:
[...]

We emit the difference between .Lfoo and .Lbar as an adjusted PCREL32
relocation, so that, if there are linker relaxations between the two
labels, we still have a chance to adjust the offset.

However, if the difference is in a difference section, say:

.section .rodata
.long .Lfoo - .Lbar
.text
.Lbar:
[...]
.Lfoo:
[...]

A PC-relative relocation doesn't work, so we end up computing the
offset between the symbols and emitting an *ABS*+offset 32-bit
relocation.  It's pointless to emit such a relocation, though: it will
not help linker relaxations, which was the reason we emitted them in
the first place, so we may as well just apply the relocation
immediately and be done with it.  This is what this patch
accomplishes.  I'm checking it in, approved by Nick Clifton.



More information about the Binutils mailing list