Browse Source

create a hidden internal pagesize symbol for libc usage

Mike Frysinger 19 years ago
parent
commit
4cb63ab6d1
2 changed files with 7 additions and 5 deletions
  1. 4 2
      libc/misc/internals/__uClibc_main.c
  2. 3 3
      libc/sysdeps/linux/common/getpagesize.c

+ 4 - 2
libc/misc/internals/__uClibc_main.c

@@ -82,7 +82,9 @@ strong_alias (__progname_full, program_invocation_name)
 char **__environ = 0;
 weak_alias(__environ, environ)
 
+/* TODO: don't export __pagesize; we cant now because libpthread uses it */
 size_t __pagesize = 0;
+hidden_strong_alias(__pagesize,__pagesize_internal)
 
 #ifndef O_NOFOLLOW
 # define O_NOFOLLOW	0
@@ -150,7 +152,7 @@ void __uClibc_init(void)
 
     /* Setup an initial value.  This may not be perfect, but is
      * better than  malloc using __pagesize=0 for atexit, ctors, etc.  */
-    __pagesize = PAGE_SIZE;
+    __pagesize_internal = PAGE_SIZE;
 
 #ifdef __UCLIBC_HAS_THREADS__
     /* Before we start initializing uClibc we have to call
@@ -247,7 +249,7 @@ __uClibc_main(int (*main)(int, char **, char **), int argc,
 
 #ifdef __ARCH_HAS_MMU__
     /* Make certain getpagesize() gives the correct answer */
-    __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
+    __pagesize_internal = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
 
     /* Prevent starting SUID binaries where the stdin. stdout, and
      * stderr file descriptors are not already opened. */

+ 3 - 3
libc/sysdeps/linux/common/getpagesize.c

@@ -19,14 +19,14 @@
 #include <unistd.h>
 #include <features.h>
 #include <sys/param.h>
-extern size_t __pagesize;
+extern size_t __pagesize_internal attribute_hidden;
 
 /* Return the system page size.  */
 /* couldn't make __getpagesize hidden, because shm.h uses it in a macro */
 int attribute_hidden __getpagesize_internal(void)
 {
-  if (__pagesize != 0)
-    return __pagesize;
+  if (__pagesize_internal != 0)
+    return __pagesize_internal;
 
 #ifdef	EXEC_PAGESIZE
   return EXEC_PAGESIZE;