public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Avoiding unnecessary jump relocations in gas?
@ 2015-05-07  6:02 Andy Lutomirski
  2015-05-07 11:52 ` Jan Beulich
  0 siblings, 1 reply; 21+ messages in thread
From: Andy Lutomirski @ 2015-05-07  6:02 UTC (permalink / raw)
  To: binutils, linux-kernel

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-05-20 22:22 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07  6:02 Avoiding unnecessary jump relocations in gas? Andy Lutomirski
2015-05-07 11:52 ` Jan Beulich
2015-05-07 16:21   ` H.J. Lu
2015-05-08  3:23     ` Andy Lutomirski
2015-05-08 12:09       ` H.J. Lu
2015-05-08 20:16         ` H.J. Lu
2015-05-18 19:37           ` Andy Lutomirski
2015-05-18 20:02             ` H.J. Lu
2015-05-18 20:06               ` H. Peter Anvin
2015-05-18 20:25                 ` H.J. Lu
2015-05-18 20:28                   ` H. Peter Anvin
2015-05-18 20:34                     ` H. Peter Anvin
2015-05-20 20:54                       ` Andy Lutomirski
2015-05-20 21:00                         ` H. Peter Anvin
2015-05-20 21:47                           ` Andy Lutomirski
2015-05-20 22:00                             ` H. Peter Anvin
2015-05-20 22:09                             ` H. Peter Anvin
2015-05-20 22:18                               ` Andy Lutomirski
2015-05-20 22:22                                 ` H. Peter Anvin
2015-05-18 20:07             ` H. Peter Anvin
2015-05-18 20:11               ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).