[PATCH] Change logic to select mmap system call in _dl_mmap

Nicolas Bellido ml at acolin.be
Wed Feb 22 08:24:36 UTC 2006


On Wednesday 22 February 2006 02:20, Mike Frysinger wrote:
> On Tuesday 21 February 2006 16:55, Nicolas Bellido wrote:
> > On Tuesday 21 February 2006 15:20, Mike Frysinger wrote:
> > > On Tuesday 21 February 2006 04:15, Nicolas Bellido wrote:
> > > > Before submitting a patch, I would like to understand the rationale
> > > > behind 'use mmap first before trying to use mmap2' ? Is this
> > > > something required by some other architectures ?
> > >
> > > the rationale is 'use a straight mmap syscall before anything else
> > > because it's the smallest code size'
> > >
> > > should be trivial to change the logic to try and do:
> > >  - mmap 6 arg syscall
> > >  - mmap2 syscall
> > >  - mmap 1 arg syscall
> > > so if you want to submit a patch to do this, i'd prob merge it ...
> >
> > This patch implements what you suggested. I'm not sure whether
> > __UCLIBC_MMAP_HAS_6_ARGS__ can be defined even if __NR_mmap is not
> > available, so I test for both.
>
> __UCLIBC_MMAP_HAS_6_ARGS__ is defined regardless of what syscall #'s are
> available
>
> > This patch modifies the logic used to select the appropriate mmap, as
> > suggested by Mike Frysinger:
> > 	. first, check if mmap 6 args syscall is available
> > 	. if not, check mmap2 syscall
> > 	. if not, check mmap 1 arg syscall
>
> sync up and try current svn please

Tested ok.

Note that I still have to apply the patch below, as pointed by Joseph, to avoid:

~/work/eabi/custom/build/uClibc $ make

Current kernel version is 2.6.16

Using kernel headers from 2.6.16 for architecture 'arm'
        provided in directory /home/nicolas/work/eabi/custom/build/linux-2.6.16-rc4

  CC ldso/ldso/ldso.oS
  AS ldso/ldso/arm/resolve.oS
  STRIP -x -R .note -R .comment ldso/ldso/ld-uClibc_so.a
  AR cr ldso/ldso/ld-uClibc_so.a
  LD ld-uClibc-0.9.28.so
/home/nicolas/work/eabi/custom/install/lib/gcc/arm-linux-uclibceabi/4.1.0/libgcc.a(_dvmd_lnx.o): In function `__div0':/home/nicolas/work/eabi/custom/src/csl_sourcerygxx-4_1/gcc/config/arm/lib1funcs.asm:1000: undefined reference to `raise'


Index: uClibc/ldso/include/dl-string.h
===================================================================
--- uClibc.orig/ldso/include/dl-string.h
+++ uClibc/ldso/include/dl-string.h
@@ -234,7 +234,9 @@ static __always_inline char * _dl_simple
 		char temp;
 		do_rem(temp, i, 10);
 		*--p = '0' + temp;
-		i /= 10;
+		i -= temp;
+		i /= 2;
+		i *= -(-1ul / 5ul);
 	} while (i > 0);
 	return p;
 }


> -mike

Thanks,

Nicolas



More information about the uClibc mailing list