Avoiding unnecessary jump relocations in gas?
From: Andy Lutomirski
Date: Thu May 07 2015 - 02:02:36 EST
AFAICT gas will produce relocations for jumps to global labels in the
same file. This doesn't seem directly harmful to me, except that, on
x86, it forces five-byte jumps instead of two-byte jumps.
This seems especially unfortunate, since even hidden and protected
symbols have this problem.
Given that many users don't want interposition support (especially the
kernel and anyone using .hidden or .protected), it would be nice to
have a command-line option to turn this off and probably also to turn
it off by default for hidden and protected symbols. Can gas do this?
I looked at the code, and this seems to be EXTERN_FORCE_RELOC, which
isn't configurable at runtime.
One safer way to fix this would be to add a new type of relocation
that represents a non-relocatable relative reference. This could be
emitted for short jumps to local symbols, would not actually be
relocated, but would generate an error if a user did something awful
in a linker script that would otherwise generate incorrect linker
output.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/