This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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: MIPS: getpagesize, PAGE_SHIFT, and PAGE_SIZE


On Fri, 26 Nov 2010, Richard Henderson wrote:

> > Also, PAGE_SHIFT (and by extension PAGE_SIZE) are defined as constants
> > on MIPS. This is clearly wrong, as MIPS supports multiple pagesizes.
> > What can we do about this?
> 
> Delete the relevant entries?  That's what ia64, sparc, powerpc seem to do.

 At the point I was fiddling with this code it did not rely on the kernel 
macros; in fact I built the library with the macros deliberately 
undefined, i.e. using unconfigured kernel headers by means of a recipe 
like this:

$ make -C linux distclean include/linux/version.h
$ ln -s asm-mips linux/include/asm
$ echo "#define AUTOCONF_INCLUDED" > linux/include/linux/autoconf.h

during the build and then installed in $includedir for further use -- that 
leaves all the kernel's CONFIG_PAGE_SIZE_* macros undefined and hence 
there's no PAGE_SHIFT definition to catch buggy software.

 It was many years ago though and things may have got broken meanwhile of 
course, but the version around the time I submitted dl-static.c should be 
a good starting point.  For one you'll need to adjust paths for the 
changed location of the asm headers in the Linux tree these days.

 Note I'm considering the C library only here -- if any piece of user code 
bypasses libc interfaces and goes straight through down to the kernel 
macros, then it deserves its fate.  The PAGE_SHIFT and PAGE_SIZE macros 
are not a part of the user API; the getpagesize() function is (it's up to 
the C library implementation for a given port to define it as a static 
inline function returning a constant if applicable).

  Maciej


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