* Regarding the p_align Elf_Phdr structure variable.
@ 2006-05-30 10:28 vamsi krishna
2006-05-30 11:06 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: vamsi krishna @ 2006-05-30 10:28 UTC (permalink / raw)
To: binutils
Dear All,
I have a question regarding the program header structure variable p_align.
o If the program header states the segment type as PT_LOAD and
phr.p_vaddr and phdr.p_paddr both set to a virtual address
'0x0000ac00' and I have a global variable(say a char) whose virtual
address is '0x0000ac0f' (assume this is program header which is
having the .data section).
o Now if the value of the p_align is set to some 2^x will it change
the virtual address my variable after the loader does the mmaping? of
the segment??
When do we need to set the p_align flag? I'am trying to create a elf
file with out p_align , does it have any impact on loaders
performance, I dont find any details on how OS loader uses this
p_align while mmaping my program header.
Really thankful for you comments.
Best,
Vamsi.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Regarding the p_align Elf_Phdr structure variable.
2006-05-30 10:28 Regarding the p_align Elf_Phdr structure variable vamsi krishna
@ 2006-05-30 11:06 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2006-05-30 11:06 UTC (permalink / raw)
To: vamsi krishna; +Cc: binutils
On Mon, May 29, 2006 at 12:23:32AM +0530, vamsi krishna wrote:
> Dear All,
>
> I have a question regarding the program header structure variable p_align.
>
> o If the program header states the segment type as PT_LOAD and
> phr.p_vaddr and phdr.p_paddr both set to a virtual address
> '0x0000ac00' and I have a global variable(say a char) whose virtual
> address is '0x0000ac0f' (assume this is program header which is
> having the .data section).
>
> o Now if the value of the p_align is set to some 2^x will it change
> the virtual address my variable after the loader does the mmaping? of
> the segment??
No, but changing p_align independently of other segment header fields
may result in an executable that gives loader errors. You must have
p_offset mod p_align == p_vaddr mod p_align to support demand paging.
> When do we need to set the p_align flag? I'am trying to create a elf
> file with out p_align , does it have any impact on loaders
> performance, I dont find any details on how OS loader uses this
> p_align while mmaping my program header.
p_align is used to calculate the base address of the executable or
shared library, and in a similar calculation for TLS segments. p_align
must be at least as large as disk and memory page size to support demand
paged executables. See glibc sources for all the details.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-29 0:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-30 10:28 Regarding the p_align Elf_Phdr structure variable vamsi krishna
2006-05-30 11:06 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).