lkml.org 
[lkml]   [2011]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/2] jump label: update for .39
* Steven Rostedt (rostedt@goodmis.org) wrote:
> On Thu, 2011-03-10 at 16:14 -0500, Mathieu Desnoyers wrote:
>
> > > Just insert a long "Reserved" word.
> >
> > I agree that this solution can work, but it's only because the
> > "object" definition is done in assembly in this case (and not in C, like
> > we did for trace event and tracepoints). Padding to power of 2 multiples
> > should make the linker happy. There should be a nice comment beside
> > these padding elements though.
>
> Rereading what David and even what you wrote just now, I don't think
> this is even needed. As you said. The issue with us is that we had
> defined structs in C as static which lost all bets. Not to mention,
> these structures were not natural word aligned.
>
> The linker should not be adding holes more than natural word alignment.
> Why waste space?

Here is what I am concerned about (maybe wongly, we'll see):

if we take a few objects, chosen arbitrarily, which will end up being
linked together, e.g.

in kernel/

Sections:
Idx Name Size VMA LMA File off Algn

objdump -h *.o |grep jump
28 __jump_table 000007e0 0000000000000000 0000000000000000 000ba614 2**0
5 __jump_table 00000030 0000000000000000 0000000000000000 0000077c 2**0
6 __jump_table 00000048 0000000000000000 0000000000000000 000027d8 2**0
9 __jump_table 00000048 0000000000000000 0000000000000000 00002788 2**0
3 __jump_table 000000c0 0000000000000000 0000000000000000 00000f60 2**0
3 __jump_table 00000048 0000000000000000 0000000000000000 0000092c 2**0
6 __jump_table 00000018 0000000000000000 0000000000000000 000008db 2**0
8 __jump_table 00000018 0000000000000000 0000000000000000 00002744 2**0
5 __jump_table 00000030 0000000000000000 0000000000000000 000008ea 2**0
6 __jump_table 00000078 0000000000000000 0000000000000000 000066ad 2**0
7 __jump_table 00000018 0000000000000000 0000000000000000 000023f0 2**0
13 __jump_table 00000120 0000000000000000 0000000000000000 00010c9a 2**0
7 __jump_table 00000060 0000000000000000 0000000000000000 00005126 2**0
5 __jump_table 00000138 0000000000000000 0000000000000000 000020f4 2**0
6 __jump_table 00000180 0000000000000000 0000000000000000 000045c6 2**0
10 __jump_table 00000078 0000000000000000 0000000000000000 00005060 2**0

We see here that the section alignment is 2**0 for each object (that is
for a 2.6.38-rc7-tip kernel). Now as long as the alignment stays like
this, it's OK, because the linker won't add padding between the
sections. So my question is: is there any guarantee that the linker will
keep this alignment to 2**0, or is there a possibility that it bumps it
to an higher value ?

For instance, if we have two objects linked together in a first linking
phase, thus generating a resulting object that uses the 8-byte alignment
specified by the linker script, and then we have a second link phase
that uses this intermediate object and links it into the kernel, this
might add such a whole on a 32-bit architecture, no ? (e.g. see the
e1000e Makefile, it seems to use this 2-steps method when built as =Y).

Thanks,

Mathieu

--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com


\
 
 \ /
  Last update: 2011-03-10 23:05    [W:0.103 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site