mmap64: use INLINE_SYSCALL() helper fails for ppc
Bernhard Reutner-Fischer
rep.dot.nop at gmail.com
Wed Apr 25 15:35:28 UTC 2012
On 25 April 2012 17:27, Mike Frysinger <vapier at gentoo.org> wrote:
> On Thursday 12 April 2012 19:43:44 Mike Frysinger wrote:
>> On Thursday 12 April 2012 19:38:08 Khem Raj wrote:
>> > I am seeing build failure on ppc
>> >
>> > | libc/libc_so.a(mmap64.os): In function `mmap64':
>> > |
>> > | /home/kraj/work/openembedded-core/build/tmp-uclibc/work/ppc603e-oe-linu
>> > | x-
>>
>> uclibc/uclibc-0.9.33+gitra7c4e889e9c36fc19198654ada229aaa11955ee6-
>>
>> r6.0/git/libc/sysdeps/linux/common/mmap64.c:60:
>> > undefined reference to `__illegally_sized_syscall_arg6'
>> >
>> > | collect2: error: ld returned 1 exit status
>> >
>> > It could be related to
>> >
>> > Author: Mike Frysinger <vapier at gentoo.org>
>> > Date: Wed Apr 11 16:05:08 2012 -0400
>> >
>> > mmap64: use INLINE_SYSCALL() helper
>>
>> i was assuming INLINE_SYSCALL() would implicitly cast down the sizes, but i
>> guess this is kind of better ... it forces you to add casts when you know
>> it's ok, but errors out when you missed something.
>>
>> i'll commit a fix shortly (just to case it down to 32bits).
>
> how about this ? not sure if there is a native type laying around to do what
> i want ...
That should work. Khem?
thanks,
> -mike
>
> --- a/libc/sysdeps/linux/common/mmap64.c
> +++ b/libc/sysdeps/linux/common/mmap64.c
> @@ -50,6 +50,16 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t
>
> __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t offset)
> {
> + /*
> + * Some arches check the size in INLINE_SYSCALL() and barf if it's
> + * too big (i.e. a 64bit value getting truncated to 32bit).
> + */
> +# if __WORDSIZE == 32
> + uint32_t sys_offset;
> +# else
> + uint64_t sys_offset;
> +# endif
> +
> if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
> __set_errno(EINVAL);
> return MAP_FAILED;
> @@ -61,8 +71,10 @@ __ptr_t mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd, __off64_t
> * sign extend things and pass in the wrong value. So cast it to
> * an unsigned 64-bit value before doing the shift.
> */
> + sys_offset = (uint64_t)offset >> MMAP2_PAGE_SHIFT;
> +
> return (__ptr_t) INLINE_SYSCALL(mmap2, 6, addr, len, prot, flags, fd,
> - ((uint64_t)offset >> MMAP2_PAGE_SHIFT));
> + sys_offset);
> }
>
> # endif
More information about the uClibc
mailing list