Re: [PATCH V2] libc: deal with aux vect inside __uClibc_main only if !SHARED

2013-05-20 Thread Filippo ARCIDIACONO

On 5/19/2013 7:08 AM, Mike Frysinger wrote:

On Friday 14 December 2012 05:40:05 Filippo ARCIDIACONO wrote:

--- a/libc/misc/elf/dl-support.c
+++ b/libc/misc/elf/dl-support.c
@@ -28,6 +28,7 @@ void (*_dl_init_static_tls) (struct link_map *) =
_dl_nothread_init_static_tls;

  ElfW(Phdr) *_dl_phdr;
  size_t _dl_phnum;
+size_t _dl_pagesize;

  void internal_function _dl_aux_init (ElfW(auxv_t) *av);
  void internal_function _dl_aux_init (ElfW(auxv_t) *av)
@@ -37,6 +38,9 @@ void internal_function _dl_aux_init (ElfW(auxv_t) *av)

 /* Get the number of program headers from the aux vect */
 _dl_phnum = (size_t) av[AT_PHNUM].a_un.a_val;
+
+   /* Get the pagesize from the aux vect */
+   _dl_pagesize = (av[AT_PAGESZ].a_un.a_val) ? (size_t)
av[AT_PAGESZ].a_un.a_val : PAGE_SIZE;

you cannot use PAGE_SIZE.  pretty much every arch has long ago removed that
from their kernel headers exported to userspace.  and indeed, this breaks
building for at least x86:

libc/misc/elf/dl-support.c: In function '_dl_aux_init':
libc/misc/elf/dl-support.c:43:68: error: 'PAGE_SIZE' undeclared (first use in
this function)
 _dl_pagesize = (av[AT_PAGESZ].a_un.a_val) ? (size_t)
av[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
 ^
libc/misc/elf/dl-support.c:43:68: note: each undeclared identifier is reported
only once for each function it appears in
make: *** [libc/misc/elf/dl-support.os] Error 1
-mike


Ok, you are right for x86 the build fails.
What do you think to include bits/uClibc_page.h in dl-support.c to get 
the PAGE_SIZE value?


Filippo.


___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc


Re: [PATCH V2] libc: deal with aux vect inside __uClibc_main only if !SHARED

2013-05-20 Thread Carmelo Amoroso
Il giorno 20/mag/2013 14:38, Filippo ARCIDIACONO 
filippo.arcidiac...@st.com ha scritto:

 On 5/19/2013 7:08 AM, Mike Frysinger wrote:

 On Friday 14 December 2012 05:40:05 Filippo ARCIDIACONO wrote:

 --- a/libc/misc/elf/dl-support.c
 +++ b/libc/misc/elf/dl-support.c
 @@ -28,6 +28,7 @@ void (*_dl_init_static_tls) (struct link_map *) =
 _dl_nothread_init_static_tls;

   ElfW(Phdr) *_dl_phdr;
   size_t _dl_phnum;
 +size_t _dl_pagesize;

   void internal_function _dl_aux_init (ElfW(auxv_t) *av);
   void internal_function _dl_aux_init (ElfW(auxv_t) *av)
 @@ -37,6 +38,9 @@ void internal_function _dl_aux_init (ElfW(auxv_t) *av)

  /* Get the number of program headers from the aux vect */
  _dl_phnum = (size_t) av[AT_PHNUM].a_un.a_val;
 +
 +   /* Get the pagesize from the aux vect */
 +   _dl_pagesize = (av[AT_PAGESZ].a_un.a_val) ? (size_t)
 av[AT_PAGESZ].a_un.a_val : PAGE_SIZE;

 you cannot use PAGE_SIZE.  pretty much every arch has long ago removed
that
 from their kernel headers exported to userspace.  and indeed, this breaks
 building for at least x86:

 libc/misc/elf/dl-support.c: In function '_dl_aux_init':
 libc/misc/elf/dl-support.c:43:68: error: 'PAGE_SIZE' undeclared (first
use in
 this function)
  _dl_pagesize = (av[AT_PAGESZ].a_un.a_val) ? (size_t)
 av[AT_PAGESZ].a_un.a_val : PAGE_SIZE;
  ^
 libc/misc/elf/dl-support.c:43:68: note: each undeclared identifier is
reported
 only once for each function it appears in
 make: *** [libc/misc/elf/dl-support.os] Error 1
 -mike


 Ok, you are right for x86 the build fails.
 What do you think to include bits/uClibc_page.h in dl-support.c to get
the PAGE_SIZE value?

 Filippo.


... But this is not exposed when NPTL is enabled because to the include
chain PAGE_SIZE gets to be defined, so this explains why it was not failing
to us.

I think filippo's proposal is fine.

Cheers
Carmelo



 ___
 uClibc mailing list
 uClibc@uclibc.org
 http://lists.busybox.net/mailman/listinfo/uclibc
___
uClibc mailing list
uClibc@uclibc.org
http://lists.busybox.net/mailman/listinfo/uclibc