public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Puneet B <punitb20@gmail.com>
To: gcc-help@gcc.gnu.org, gcc-bugzilla-account-request@gcc.gnu.org
Subject: Y2038: GCC gthr-posix.h weakref symbol invoking function has impact on time values
Date: Mon, 17 Apr 2023 12:01:24 +0530	[thread overview]
Message-ID: <CAABR-Odyxx3iBAt6xBaN7H_r6tPTDQprmwTHzgbBNP7vsFCaPQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2200 bytes --]

All,

Could you please help me create an account for "punitb20@gmai.com" to
report the bug below.

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 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

             reply	other threads:[~2023-04-17  6:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-17  6:31 Puneet B [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-04-17  3:56 Y2038: GCC gthr-posix.h wekref " Puneet Kumar Yatnal (QUIC)
2023-04-17  5:40 ` Y2038: GCC gthr-posix.h weakref " Puneet Kumar Yatnal (QUIC)
2023-04-17  5:53   ` Andrew Pinski
2023-04-17  6:09     ` Puneet Kumar Yatnal
2023-04-17  7:22     ` Jonathan Wakely
2023-04-17  7:27       ` Puneet Kumar Yatnal (QUIC)
2023-04-17  7:35         ` Jonathan Wakely
2023-04-18  2:53           ` Puneet Kumar Yatnal (QUIC)
2023-05-05 11:13             ` Florian Weimer
2023-05-05 11:16               ` Jonathan Wakely
2023-05-05 11:23               ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAABR-Odyxx3iBAt6xBaN7H_r6tPTDQprmwTHzgbBNP7vsFCaPQ@mail.gmail.com \
    --to=punitb20@gmail.com \
    --cc=gcc-bugzilla-account-request@gcc.gnu.org \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).