lkml.org 
[lkml]   [2009]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Absolute symbols in vmlinux_64.lds.S
Sam Ravnborg <sam@ravnborg.org> writes:

> On Mon, Mar 09, 2009 at 06:23:55PM -0700, Yinghai Lu wrote:
>> Jeremy Fitzhardinge wrote:
>> > Why does vmlinux_64.lds.S use absolute symbols for things like
>> > __bss_start/stop:
>> >
>> > __bss_start = .; /* BSS */
>> > .bss : AT(ADDR(.bss) - LOAD_OFFSET) {
>> > *(.bss.page_aligned)
>> > *(.bss)
>> > }
>> > __bss_stop = .;
>> >
>> >
>> > vmlinux_32.lds.S puts __bss_start/stop into the .bss section itself. Is
>> > there some particular reason they need to be absolute symbols
>> > (relocation?).
>> >
>>
>> they are the same.
>
> Thats depends on the value of '.' where you assign __bss_start.
> We have had several bugs where the symbol assinged outside the
> section was less than expected because the linker aling the
> start of the section equal to the lrgest alignment requirement
> of a member in the section.
>
> So in this case if '.' equals to 0xabcd and the lagest
> alignment requirement inside the block is 0x1000 and we have
> __bss_start1 = .;
> .bss : {
> __bss_start2 = .;
> *(.bss.page_aligned)
> }
>
> Then you would see that:
> __bss_start1 equals 0xabcd
> __bss_start2 equals 0xb000
>
> Which may result in unexpected behaviour.
>
> The case I have in mind prevented the kernel from booting!
> So unless there are specific reasons (which should be documented)
> then always move the assignmnets inside the {} block.

I have no complaint with that. I believe the symbols are absolute
simply because they were originally coded that way and the relocatable
kernel work on x86_64 didn't need them to change.

Eric


\
 
 \ /
  Last update: 2009-03-10 06:51    [W:0.065 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site