This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PHDRS command in the kernel linker script


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]