linux-mips
[Top] [All Lists]

Re: [patch] 2.4, head: PAGE_SHIFT changes break glibc

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [patch] 2.4, head: PAGE_SHIFT changes break glibc
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Date: Tue, 25 Nov 2003 16:27:49 +0100 (CET)
Cc: linux-mips@linux-mips.org
In-reply-to: <Pine.LNX.4.55.0311212021420.32551@jurand.ds.pg.gda.pl>
Organization: Technical University of Gdansk
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <Pine.LNX.4.55.0311211550270.32551@jurand.ds.pg.gda.pl> <20031121185035.GC8318@linux-mips.org> <Pine.LNX.4.55.0311212021420.32551@jurand.ds.pg.gda.pl>
Sender: linux-mips-bounce@linux-mips.org
On Fri, 21 Nov 2003, Maciej W. Rozycki wrote:

> > The kernel is already passing AT_PAGESZ to ELF binaries.  Wouldn't that
> > be sufficient?  Currently it's passing the largest supported page size,
> 
>  Well, AFAICS in glibc it's ld.so that is responsible for interpreting the
> auxiliary vector -- see _dl_aux_init() in elf/dl-support.c.  If the
> dynamic linker isn't run (which is the usual case for static binaries,
> although calling dlopen() from them might complicate things), the
> dl_pagesize variable remains set to zero.  Please prove me wrong if I am
> missing anything.
> 
> > that is 64k.  However this constant is always passed even when a smaller
> > page size is configured.
> 
>  Are you sure?  I can see create_elf_tables() in fs/binfmt_elf.c sets 
> AT_PAGESZ to ELF_EXEC_PAGESIZE, which, in turn, is set in 
> include/asm-mips/elf.h to PAGE_SIZE.  Which is the currently used page 
> size and probably the optimal solution.

 After rebuilding glibc (2.2.5) with the patch applied, the following
program:

#include <stdio.h>
#include <unistd.h>

int main(void)
{
        printf("%u\n", getpagesize());
        return 0;
}

prints "4096" if dynamically linked and "65536" if statically linked on my
system, as expected.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

<Prev in Thread] Current Thread [Next in Thread>