Messages in this thread | | | From | Andy Lutomirski <> | Date | Wed, 6 May 2015 23:02:10 -0700 | Subject | Avoiding unnecessary jump relocations in gas? |
| |
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
| |