This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
kernel header usage fix needed on ppc
- To: Franz dot Sirl-kernel at lauterbach dot com, geoffk at cygnus dot com, drepper at redhat dot com, libc-alpha at sources dot redhat dot com
- Subject: kernel header usage fix needed on ppc
- From: Jack Howarth <howarth at bromo dot med dot uc dot edu>
- Date: Sat, 21 Oct 2000 12:17:00 -0700 (PDT)
Hi,
As I said before, Paul Mackerras <paulus@linuxcare.com>, has decided
to wrap the asm-ppc kernel headers in Linux 2.4 tightly with an
#ifdef __KERNEL__/#endif /* __KERNEL__ */ wrapper. This is because
we have been told that all kernel header usage by userland should be
considered as breakage. That being the case, I have found that glibc
2.1.95 has a build problem on linuxppc against these new strict kernel
headers. The file sysdeps/unix/sysv/linux/powerpc/mmap64.c has
asm/page.h included which now under the current bitkeeper linuxppc_2_3
tree no longer provides the needed declarations. I have managed to build
glibc 2.1.95 with the following patch...
--- glibc-2.1.95/sysdeps/unix/sysv/linux/powerpc/mmap64.c Tue Sep 19 12:55:38 2000
+++ glibc-2.1.95.new/sysdeps/unix/sysv/linux/powerpc/mmap64.c Sat Oct 21 14:15:55 2000
@@ -25,8 +25,12 @@
#include <sys/syscall.h>
#include <bp-checks.h>
-#include <asm/page.h>
#include "kernel-features.h"
+
+/* PAGE_SHIFT determines the page size */
+#define PAGE_SHIFT 12
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
#ifdef __NR_mmap2
extern void *__unbounded __syscall_mmap2(void *__unbounded, size_t,
...It is unclear to me if we can do this in a better way using
getpagesize to calculate this stuff as in this test program...
--------------------------------------------------------------
#include <stdio.h>
#include <sys/shm.h>
#define PAGE_SHIFT 12
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
int i,pagesize,pageshift,pagemask;
main()
{
pagesize=__getpagesize();
for(i=1; i <= 8*sizeof(int); i++) {
if( pagesize & (1UL << i)) {
pageshift += i;
}
}
pagemask=(~(pagesize-1));
printf("pagesize is %d\n",pagesize);
printf("pagesize is %d\n",PAGE_SIZE);
printf("pageshift is %d\n",pageshift);
printf("pageshift is %d\n",PAGE_SHIFT);
printf("pagemask is %x\n",pagemask);
printf("pagemask is %x\n",PAGE_MASK);
}
------------------------------------------------------
I am afraid to try this because it seems that perhaps
getpagesize uses mmap64.c and we will create a recursive
loop. I would appreciate if someone could either add
this change or create a better fix.
Jack Howarth