public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-help@sourceware.org
Subject: Re: 32bit builds broken by gettime64 vDSO patches
Date: Tue, 10 Dec 2019 21:56:00 -0000	[thread overview]
Message-ID: <71fa27ba-2362-d0d1-d7f8-789bd9266dcc@linaro.org> (raw)
In-Reply-To: <CAOLZvyHVorx6YS6X6iYZ0UQPi5+hkBz6T4tvwtg1uTLq=JTxvA@mail.gmail.com>



On 10/12/2019 09:16, Manuel Lauss wrote:
> Hello,
> 
> 32bit builds of latest git head  (tested x86, MIPS o32, ARM, SH4)
> break on my system; 64 bit (arm64, x86_64) builds are fine.
> Reverting Alistair Francis' 2 clock_gettime64 patches fixes that.
> 
[...]
> 
> glibc is configured thusly:
> configure --enable-stack-protector=no
> --enable-stackguard-randomization --disable-cet --enable-kernel=5.2.0
> --without-selinux --without-cvs --disable-werror --enable-bind-now
> --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --disable-profile
> --without-gd --with-headers=/usr/include --prefix=/usr
> --sysconfdir=/etc --localstatedir=/var --libdir=$(prefix)/lib
> --mandir=$(prefix)/share/man --infodir=$(prefix)/share/info
> --libexecdir=$(libdir)/misc/glibc
> --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion=Gentoo
> 2.30-r3 p4 --enable-crypt --disable-systemtap --disable-nscd
> --disable-timezone-tools

Sigh... it looks like I forgot to take in consideration that the
scenario 10. from [1] might also occur with for 32-bit with
--enable-kernel=5.2.0.  In this case INLINE_VSYSCALL will try
to use the vDSO regardless HAVE_CLOCK_GETTIME64_VSYSCALL is set
or not.

It seems we will need to add even more pre-processor handling to
work this:

diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 875c4fe905..10bb6c5d16 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -34,11 +34,17 @@ int
 __clock_gettime64 (clockid_t clock_id, struct __timespec64 *tp)
 {
 #ifdef __ASSUME_TIME64_SYSCALLS
-# ifndef __NR_clock_gettime64
-#  define __NR_clock_gettime64   __NR_clock_gettime
-#  define __vdso_clock_gettime64 __vdso_clock_gettime
+# if defined HAVE_CLOCK_GETTIME64_VSYSCALL
+  return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
+# elif defined HAVE_CLOCK_GETTIME_VSYSCALL && !defined __NR_clock_gettime64
+  return INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp);
+# else
+#  ifndef __NR_clock_gettime64
+#   define __NR_clock_gettime64   __NR_clock_gettime
+#   define __vdso_clock_gettime64 __vdso_clock_gettime
+#  endif
+  return INLINE_SYSCALL_CALL (clock_gettime, clock_id, tp);
 # endif
-   return INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);
 #else
 # if defined HAVE_CLOCK_GETTIME64_VSYSCALL
   int ret64 = INLINE_VSYSCALL (clock_gettime64, 2, clock_id, tp);

This code is becoming highly convoluted and hard to understand,
I will check it this is the correct fix for all options and work
towards on my vDSO refactor to simplify this.

[1] https://sourceware.org/ml/libc-alpha/2019-12/msg00142.html

  reply	other threads:[~2019-12-10 21:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 12:17 Manuel Lauss
2019-12-10 21:56 ` Adhemerval Zanella [this message]
2019-12-13 14:05 ` Lukasz Majewski
2019-12-13 16:58   ` Manuel Lauss

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=71fa27ba-2362-d0d1-d7f8-789bd9266dcc@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-help@sourceware.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).