Re: [PATCH v5 03/19] x86, boot: Simplify run_size calculation
From: Yinghai Lu
Date: Mon Mar 23 2015 - 03:12:26 EST
On Sun, Mar 22, 2015 at 8:25 PM, Baoquan He <bhe@xxxxxxxxxx> wrote:
>
> This may not be correct. In commit e602336
> runsize = offset(.bss) + size(.bss) + size(.brk), why this formula comes
> out can be checked from discussion between Kees and Junjie:
> https://lkml.org/lkml/2014/10/30/612
>
> And in my one kernel build the related values are:
> -) objdump -h vmlinux
> vmlinux: file format elf64-x86-64
>
> Sections:
> Idx Name Size VMA LMA File off
> Algn
> 27 .bss 00167000 ffffffff81e92000 0000000001e92000 01292000
> 2**12
> ALLOC
> 28 .brk 00027000 ffffffff81ff9000 0000000001ff9000 01292000
> 2**0
> ALLOC
>
> run_size on old calculation is
> 0x01292000+0x00167000+0x00027000=0x1420000
>
> -) nm vmlinux
> ffffffff81000000 T _text
> ffffffff82020000 B _end
>
> run_size on your method is 0x82020000 - 0x81000000 = 0x1020000
>
> So if output_len which is the length of vmlinux.bin + vmlinux.relocs is
> between the old run_size and your new run_size, the problem Junjie tried
> to fix will happen again.
no. We should not use file offset in the elf for run_size.
when the section can not fill 2M, use file offset will get not needed
extra size.
parse_elf will move sections forward according to program headers.
Thanks
Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/