Re: Y2038: GCC gthr-posix.h weakref symbol invoking function has impact on time values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Apr 2023, 07:54 Andrew Pinski via Gcc-help, <gcc-help@xxxxxxxxxxx>
wrote:

> On Sun, Apr 16, 2023 at 10:41 PM Puneet Kumar Yatnal (QUIC) via
> Gcc-bugs <gcc-bugs@xxxxxxxxxxx> wrote:
> >
> >
> > ++
> > From: Puneet Kumar Yatnal (QUIC)
> > Sent: Monday, April 17, 2023 9:26 AM
> > To: gcc-help@xxxxxxxxxxx
> > Subject: Y2038: GCC gthr-posix.h wekref symbol invoking function has
> impact on time values
>
> First gcc-bugs@ is not the right place to report a bug report as
> gcc-bugs is mainly for automated emails from bugzilla. Please use
> bugzilla first.
>
> >
> > All
> >
> > if we fallowed https://sourceware.org/glibc/wiki/Y2038ProofnessDesign
> for Y2038 fix(where all timer related variable moved to 64 bit instead of
> 32 bit ), pthread_cond_timedwait function from gthr_posix.h is calling
> different function in pthrea_cond_wait.c of glibc(due to weakref of symbol
> pthread_cond_timedwait())  which impacting the time value.
>
> Note libstdc++ does ABI changes too which is NOT part of that ABI design.
> This is where the symbol
> __gthread_cond_timedwait/__gthrw_pthread_cond_timedwait are used. So
> any changes you might do to fix __gthrw_pthread_cond_timedwait is not
> really going to work without wider ABI fixes to libstdc++.
> I don't know any one who is making those changes/fixes. So you should
> file an bug requesting it. And maybe even have a design document ready
> for it. There are many/some classes which have timespec inside them


I don't think that's true. We don't use timespec members, they're just
local variables, and very occasionally function parameters.



and not just the mutex related ones.
>
> Thanks,
> Andrew
>
> >
> > From pthread.h
> > extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond,
> pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict
> __abstime) __asm__ ("" "__pthread_cond_timedwait64")
> >
> > From gthread_posix.h:
> > static __typeof(pthread_cond_timedwait) __gthrw_pthread_cond_timedwait
> __attribute__ ((__weakref__("pthread_cond_timedwait"), __copy__
> (pthread_cond_timedwait)));
> >
> >
> > __gthrw_(pthread_cond_timedwait) --> ___pthread_cond_timedwait
>  invoking in glibc instead of   __pthread_cond_timedwait64 which is
> impacting time value as __pthread_cond_timedwait is converting value from
> 32 bit to 64 bit.
> >
> > normal pthread_cond_timedwait is invoking __pthread_cond_timedwait64
> properly and its working fine.
> >
> > From: pthread_cond_wait.c
> >
> > #if __TIMESIZE == 64
> > strong_alias (___pthread_cond_timedwait64, ___pthread_cond_timedwait)
> > #else
> > strong_alias (___pthread_cond_timedwait64, __pthread_cond_timedwait64)
> > libc_hidden_def (__pthread_cond_timedwait64)
> >
> > int
> > ___pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex,
> >                             const struct timespec *abstime)
> > {
> >   struct __timespec64 ts64 = valid_timespec_to_timespec64 (*abstime);
> >
> >   return __pthread_cond_timedwait64 (cond, mutex, &ts64);
> > }
> > #endif /* __TIMESIZE == 64 */
> > versioned_symbol (libc, ___pthread_cond_timedwait,
> >                   pthread_cond_timedwait, GLIBC_2_3_2);
> > libc_hidden_ver (___pthread_cond_timedwait, __pthread_cond_timedwait)
> > #ifndef SHARED
> > strong_alias (___pthread_cond_timedwait, __pthread_cond_timedwait)
> > #endif
> >
> > if add  #defing GTHREAD_USE_WEAK 0  in libgcc/gthr-posix.h issue is
> resolved but that is not correct way as it disable weakref for all symbol,
> please let me know what is correct way to fix this, this i observed with
>  gcc-9.3.0 gcc and glibc 2.34
> >
> > Regards
> > Puneet
> >
>




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux