[PATCH 2/7] utimes: Export utimensat based utimes

Vineet Gupta Vineet.Gupta1 at synopsys.com
Tue Mar 12 08:14:10 UTC 2013


On Monday 11 March 2013 10:26 PM, Markos Chandras wrote:
> On 11 March 2013 13:21, Vineet Gupta <Vineet.Gupta1 at synopsys.com> wrote:
>> sys/time.h has libc_hidden_proto(utimes) which generates the hidden
>> "__GI_utimes" symbol reference, and common/utimes.c has a
>> libc_hidden_def(utimes) which generates the exported "utimes" alias.
>>
>> As part of no-legacy-syscall kernel ABI, Commit 80dc2ed05
>> "utimes: Use utimensat if arch does not have the utimes syscall"
>> introduced a new wrapper, but missed the corresponding libc_hidden_def,
>> causing Busybox (1.20.0) link to fail (for ARC).
>>
>> ---------------->8-------------------
>> ....
>> touch.c:(.text.touch_main+0xdc): undefined reference to `utimes'
>> touch.c:(.text.touch_main+0x114): undefined reference to `utimes'
>> libbb/lib.a(copy_file.o): In function `copy_file':
>> copy_file.c:(.text.copy_file+0x446): undefined reference to `utimes'
>> collect2: ld returned 1 exit status
>> ---------------->8-------------------
>>
>> Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
>> Cc: Markos Chandras <markos.chandras at imgtec.com>
>> ---
>>  libc/sysdeps/linux/common/utimes.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/libc/sysdeps/linux/common/utimes.c b/libc/sysdeps/linux/common/utimes.c
>> index a459d15..b5e76cc 100644
>> --- a/libc/sysdeps/linux/common/utimes.c
>> +++ b/libc/sysdeps/linux/common/utimes.c
>> @@ -51,6 +51,6 @@ int utimes(const char *file, const struct timeval tvp[2])
>>  }
>>  #endif
>>
>> -#if defined __NR_utimes || defined __NR_utime
>> +#if defined __NR_utimensat || defined __NR_utimes || defined __NR_utime
>>  libc_hidden_def(utimes)
>>  #endif
>> --
>> 1.7.4.1
>>
>> _______________________________________________
>> uClibc mailing list
>> uClibc at uclibc.org
>> http://lists.busybox.net/mailman/listinfo/uclibc
> 
> Well, yeah your fix is correct but the linking problem is not because
> we don't have libc_hidden_def(utimes) for new arches. You most likely
> build uClibc without __UCLIBC_HAS_STUBS__ and this is why you are
> seeing the linking problems. We currently have the following code in
> libc/sysdeps/linux/common/stubs.c
> 
> #if !defined __NR_utime && !defined __NR_utimes
> /*make_stub(utime) obsoleted */
> make_stub(utimes)
> #endif
> 
> So, if __UCLIBC_HAS_STUBS__ is enabled, you will have a utimes symbol
> in your libc but it will actually return ENOSYS. So whilst we provide
> a utimes function for new architectures, we never actually use it and
> we create a stub instead. This is wrong so I believe your patch needs
> to fix the libc/sysdeps/linux/common/stubs.c entry as well.
> 

Thanks for reviewing Markos. I'll fix up the patch per above. Any chance you can
comment on the other couple patches so that I can re-spin the full v2 series.

Also per another discussion on lkml yesterday
(http://www.spinics.net/lists/kernel/msg1496470.html), the no-legacy-abi need not
send IPC_64 to kernel. I see that you fixed it with 6c2fa3451f35f8 + fix to metag
to define it's own version - but I think a better solution is to do that within
libc/misc/sysvipc/ipc.h using __ARCH_HAS_DEPRECATED_SYSCALLS__

Yet another change I'm thinking it to make the align64 optional - as it is not a
hard requirement for all arches (e.g. ARC) and leads to bit of space wastage.

-Vineet


More information about the uClibc mailing list