[lkml]   [2012]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] scripts: Make sortextable handle relocations.
On 04/20/2012 03:41 PM, David Daney wrote:
> From: David Daney <>
> 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 <>
> ---
> 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.


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.)

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.

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.


 \ /
  Last update: 2012-04-21 01:03    [W:0.050 / U:2.236 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site