[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMe9rOri61BL=uUgC8FVCs0peGR=KKRh629rOsRtbzMs8N=MrA@mail.gmail.com>
Date: Thu, 7 May 2015 09:21:53 -0700
From: "H.J. Lu" <hjl.tools@...il.com>
To: Jan Beulich <JBeulich@...e.com>
Cc: Andy Lutomirski <luto@...capital.net>,
Binutils <binutils@...rceware.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Avoiding unnecessary jump relocations in gas?
On Thu, May 7, 2015 at 4:52 AM, Jan Beulich <JBeulich@...e.com> wrote:
>>>> On 07.05.15 at 08:02, <luto@...capital.net> wrote:
>> 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've been running with the below changes (taken off of a bigger set
> of changes, so the line numbers may look a little odd) for the last
> couple of years. I never tried to submit this change because so far
> I couldn't find the time to check whether this would have any
> unwanted side effects on cases I don't normally use.
>
This is the patch I checked in.
Thanks.
--
H.J.
---
Branches to global non-weak symbols defined in the same segment with
non-default visibility can be optimized the same way as branches to
local symbols.
gas/
* config/tc-i386.c (elf_symbol_resolved_in_segment_p): New.
(md_estimate_size_before_relax): Use it.
gas/testsuite/
* gas/i386/i386.exp: Run relax-3 and x86-64-relax-2.
* gas/i386/relax-3.d: New file.
* gas/i386/relax-3.s: Likewise.
* gas/i386/x86-64-relax-2.d: Likewise.
View attachment "0001-Optimize-branches-to-non-weak-symbols-with-visibilit.patch" of type "text/x-patch" (7688 bytes)
Powered by blists - more mailing lists