public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcc/109540] New: Y2038: GCC gthr-posix.h weakref symbol invoking function has impact on time values
@ 2023-04-18  7:59 punitb20 at gmail dot com
  2023-04-18  8:01 ` [Bug libgcc/109540] " punitb20 at gmail dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: punitb20 at gmail dot com @ 2023-04-18  7:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109540

            Bug ID: 109540
           Summary: Y2038: GCC gthr-posix.h weakref symbol invoking
                    function has impact on time values
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: punitb20 at gmail dot com
  Target Milestone: ---

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.

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-04-08 22:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18  7:59 [Bug libgcc/109540] New: Y2038: GCC gthr-posix.h weakref symbol invoking function has impact on time values punitb20 at gmail dot com
2023-04-18  8:01 ` [Bug libgcc/109540] " punitb20 at gmail dot com
2023-04-18 10:15 ` redi at gcc dot gnu.org
2023-04-18 10:19 ` punitb20 at gmail dot com
2023-04-18 11:12 ` redi at gcc dot gnu.org
2023-04-18 11:19 ` redi at gcc dot gnu.org
2023-04-18 12:59 ` punitb20 at gmail dot com
2023-04-19  6:24 ` punitb20 at gmail dot com
2023-04-20  7:19 ` punitb20 at gmail dot com
2023-04-20 11:04 ` redi at gcc dot gnu.org
2023-04-20 11:11 ` redi at gcc dot gnu.org
2023-04-20 11:12 ` redi at gcc dot gnu.org
2023-04-20 14:16 ` punitb20 at gmail dot com
2023-05-05 11:46 ` fw at gcc dot gnu.org
2024-04-08 22:11 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).