PHDRS command in the kernel linker script

Alan Modra amodra@bigpond.net.au
Tue Jan 2 02:09:00 GMT 2007


On Tue, Dec 19, 2006 at 04:38:59PM +0100, Bernhard Walle wrote:
> Hello,
> 
> I think here are the right persons to answer my question. Here's the
> linker script I'm talking about:
> 
>         http://www.bwalle.de/temp/vmlinux.lds.S
> 
> With this linker script, the ld (GNU ld version 2.17.50.0.5 20060927
> (SUSE Linux)) puts all sections starting with .data.init_task until 
> .data_nosave [1] into both, data and data.init.
> 
> So, readelf -l on the resulting binary looks like:
> 
>    00  [...]
>    01     .data .bss .data.cacheline_aligned .data.read_mostly .data.init_task .data.page_aligned .init.text .init.data .init.setup .initcall.init .con_initcall.init .altinstructions .altinstr_replacement .exit.text .init.ramfs .data_nosave 
>    02     .vsyscall_0 .xtime_lock .vxtime .wall_jiffies .sys_tz .sysctl_vsyscall .xtime .jiffies .vsyscall_1 .vsyscall_2 .vsyscall_3 
>    03     .data.init_task .data.page_aligned .init.text .init.data .init.setup .initcall.init .con_initcall.init .altinstructions .altinstr_replacement .exit.text .init.ramfs .data_nosave 
>    04     
> 
> If CONFIG_XEN is defined, which means the BSS section is put in the
> end, it works as expected.
> 
> So: Can somebody explain me the reason for this and give me possibly a
> solution? Thanks a lot!

Section to segment mapping isn't actually stored anywhere in an ELF
file, so the seeming duplicate assignment of sections in segments
might just be readelf getting confused.  You would need to analyse the
program headers and section headers yourself to be sure.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list