This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add x32 time


On Tue, May 22, 2012 at 1:37 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> +#define libc_ifunc_vdso1(name, vdsoname) ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
>
> Normal style is to name a subroutine "foo_1", not "foo1".
>
>> + ?extern void *name##_ifunc (void) __asm__ (#name); ? ? ? ? ? ? ? ? ?\
>> + ?void *name##_ifunc (void) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> + ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>> + ? ?PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); ? ? ? ? ? ? ? ? ? ? ? ?\
>> + ? ?return _dl_vdso_vsym (#vdsoname, &linux26); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
>
> This Linux-specific stuff does not belong in libc-symbols.h.
>
>> +/* Macro used for hidden indirection function symbols with vDSO. ?*/
>> +#define libc_ifunc_vdso_hidden(name, vdsoname) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
>> + ?libc_ifunc_vdso1 (__GI_##name, vdsoname)
>
> There's no real reason not to just always define the __GI_foo name and make
> foo an alias, is there? ?It doesn't hurt when __GI_foo is never used.

That is true.

>> +#ifdef SHARED
>> +# include <dl-vdso.h>
>> +libc_ifunc_vdso (__gettimeofday, __vdso_gettimeofday)
>> +#else
>> +# include <errno.h>
>> +# include <sysdep.h>
>> +# include <sys/time.h>
>> +
>> +int
>> +__gettimeofday (struct timeval *tv, struct timezone *tz)
>> +{
>> + ?return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
>> +}
>> +#endif
>> +
>> +weak_alias (__gettimeofday, gettimeofday)
>
> So the case here is .os should get the IFUNC, but .o should get a vanilla
> syscall stub.

Yes.

>> +strong_alias (__gettimeofday, __gettimeofday_internal)
>
> Use INTDEF for this so it's easy to tell why we have it.
>
>> +# undef INLINE_SYSCALL
>> +# define INLINE_SYSCALL(name, nr, args...) \
>
> This lacks comments about why the macro fiddling is necessary.
> It would be better than this to change INLINE_SYSCALL_TYPES to
> take the return type too.
>
>> +#ifdef SHARED
>> +# include <dl-vdso.h>
>> +libc_ifunc_vdso_hidden (time, __vdso_time)
>> +#else
>> +time_t
>> +time (time_t *t)
>> +{
>> + ?return INLINE_SYSCALL (time, 1, t);
>> +}
>> +#endif
>> +
>> +libc_hidden_def (time)
>
> So the case here is .os should get the IFUNC, but .o should get a vanilla
> syscall stub and the syscall's return value is wider than 'long int'.

Yes.

> If the .o were done with assembly code like vanilla syscall stubs are,
> then there is no issue with the return type and these two cases are the same.
> Is that right?

Yes.

> If you don't want to work on make-syscalls.sh, I can do it.
> I think it's the cleaner thing to do.
>

I will appreciate you do it.

Thanks.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]