From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32086 invoked by alias); 29 May 2006 00:35:47 -0000 Received: (qmail 32077 invoked by uid 22791); 29 May 2006 00:35:46 -0000 X-Spam-Check-By: sourceware.org Received: from CPE-144-136-172-108.sa.bigpond.net.au (HELO grove.modra.org) (144.136.172.108) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 29 May 2006 00:35:44 +0000 Received: by bubble.grove.modra.org (Postfix, from userid 500) id 7D44E1DCF03; Mon, 29 May 2006 10:05:40 +0930 (CST) Date: Tue, 30 May 2006 11:06:00 -0000 From: Alan Modra To: vamsi krishna Cc: binutils@sourceware.org Subject: Re: Regarding the p_align Elf_Phdr structure variable. Message-ID: <20060529003539.GM25824@bubble.grove.modra.org> Mail-Followup-To: vamsi krishna , binutils@sourceware.org References: <3faf05680605281153r1f4181f7s78e7a4a100a43d2a@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3faf05680605281153r1f4181f7s78e7a4a100a43d2a@mail.gmail.com> User-Agent: Mutt/1.4i X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00493.txt.bz2 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