This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Question about elf data segment address adjustment
- From: Nick Clifton <nickc at redhat dot com>
- To: Douglas B Rupp <rupp at adacore dot com>, binutils at sourceware dot org
- Date: Thu, 19 Oct 2017 10:44:23 +0100
- Subject: Re: Question about elf data segment address adjustment
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=nickc at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 384483E2CC
- References: <1c8b2e3e-cba5-c78b-3b20-f050b97e9fc6@adacore.com>
Hi Douglas,
> In ld/scripttempl/elf.sc about line 562 there's a comment that pre-dates the 1999 sourceware import, so I can't track it down.
Searching through the old CVS logs, I found this:
revision 1.32
date: 1996/02/15 20:28:54; author: ian; state: Exp; lines: +2 -14
* scripttempl/elf.sc: Don't skip a page in virtual memory space if
the text segment ends exactly on a page boundary.
> The adjustment described by the comment sometimes leads to an attempted out of range load of a system global variable.
Could you be more specific about this please ? Is there an example
that we could look at ?
> The comment is:
>
> /* Adjust the address for the data segment. We want to adjust up to
> the same address within the page on the next page up. */
Note - there is a similar comment, and adjustment, for the .rodata section as well.
> What is the reason for this adjustment to the data segment starting address?
> Why not, for example, adjust up to the next multiple of 0x10000?
Because we do not want to waste pages of memory if the page size is small.
Cheers
Nick