From: David Daney <ddaney.cavm@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: David Daney <ddaney.cavm@gmail.com>,
Ralf Baechle <ralf@linux-mips.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
x86@kernel.org, Linus Torvalds <torvalds@linux-foundation.org>,
Michal Marek <mmarek@suse.cz>,
linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] scripts: Make sortextable handle relocations.
Date: Fri, 20 Apr 2012 16:14:05 -0700 [thread overview]
Message-ID: <4F91EDBD.4030700@gmail.com> (raw)
In-Reply-To: <4F91EA5B.4000803@zytor.com>
On 04/20/2012 03:59 PM, H. Peter Anvin wrote:
> On 04/20/2012 03:41 PM, David Daney wrote:
>> From: David Daney<david.daney@cavium.com>
>>
>> If there are relocations on the __ex_table section, they must be fixed
>> up after the table is sorted.
>>
>> Also use the unaligned safe accessors from tools/{be,le}_byteshift.h
>>
>> Signed-off-by: David Daney<david.daney@cavium.com>
>> ---
>>
>> This should address HPA's concerns about the i386 relocations. The
>> i386 kernel still boots after the sort, but I don't know how to test
>> the relocations, but they sure do look nice! My MIPS64 kernels still
>> boot too, so that is also good.
>>
>
> Hi...
>
> This works for absolute relocations of the REL type, but not for
> relocations of the RELA type nor for non-absolute relocations (moving
> those changes the meaning.)
The program explicitly only handles MIPS and x86.
x86_64 and MIPS never have relocations, and x86_32 is always REL, so
that is handled
Also x86_32 is only emitting R_386_32 and those are handled.
>
> I think Linus is right and the right thing to do is to switch to using
> relative entries in the exception table; I am currently testing a
> patchset to do exactly that (on x86). It also has the benefit of making
> the table half the size on x86-64. Then we can just zero out the
> .rel[a]__ex_table section and be done with it.
That's fine.
In any event we want to do build time sorting, this patch improves the
original sortextable, so may be worthwhile as purely a cleanup. I
wanted to fix the relocation breakage, even if the eventual solution
needs to be somewhat different.
>
> The trick, of course, is that sorting a relative table is slightly
> different than sorting an absolute table -- the way I'm doing it for the
> in-kernel sorter (still needed for modules) is to add the intra-section
> offset to each entry (both sides) before sorting, then doing a *signed*
> sort, then denormalize again. Alpha does it differently, with custom
> compare and swap routines.
>
> -hpa
>
next prev parent reply other threads:[~2012-04-20 23:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-20 22:41 [PATCH] scripts: Make sortextable handle relocations David Daney
2012-04-20 22:59 ` H. Peter Anvin
2012-04-20 23:14 ` David Daney [this message]
2012-04-20 23:17 ` H. Peter Anvin
2012-04-21 1:38 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F91EDBD.4030700@gmail.com \
--to=ddaney.cavm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mingo@redhat.com \
--cc=mmarek@suse.cz \
--cc=ralf@linux-mips.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox