diff mbox series

[v4] Enable VDSO on x86_64 statically linked programs.

Message ID RGVOvESiWL9rORzqdlMj8F4Z-GPqaLH_b-oN-2Sd9BnVpVwllUDIcl9l0SLea0upmTEAWddbNsnqSWferS9awDUGk6N9yiFkQJCMAQd-5C8=@espindo.la
State New
Headers show
Series [v4] Enable VDSO on x86_64 statically linked programs. | expand

Commit Message

Rafael Ávila de Espíndola Oct. 10, 2018, 4:49 a.m. UTC
All the required code already existed, and some of it was already
running.

AT_SYSINFO_EHDR is processed if NEED_DL_SYSINFO_DSO is defined, but it
looks like it always is. The call to setup_vdso is also unconditional,
so all that was left to do was setup the function pointers and use
them. This patch just deletes some #ifdef to enable that.
---

The only difference from the previous patch is rebasing on top of the
refactoring patch I just emailed.

2018-10-09  Rafael Ávila de Espíndola  <rafael@espindo.la>

        [BZ #19767]
        * Makeconfig: Add -DUSE_VSYSCALL to CPPFLAGS-.os.
        * nptl/Makefile: Add tst-cond11-static to tests-static and tests.
        * nptl/tst-cond11-static.c: New File.
        * sysdeps/unix/sysv/linux/Makefile: Add tst-affinity-static to
          tests-static and tests
        * sysdeps/unix/sysv/linux/sysdep-vdso.h: Use USE_VSYSCALL instead
          of SHARED.
        * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file.
        * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Use USE_VSYSCALL
        instead of SHARED.
        * sysdeps/unix/sysv/linux/x86_64/init-first.c: remove #ifdef SHARED.
        * sysdeps/unix/sysv/linux/x86_64/sysdep.h: define USE_VSYSCALL.

Comments

Rafael Ávila de Espíndola Nov. 12, 2018, 2 a.m. UTC | #1
ping now that the dependencies have been committed.

Cheers,
Rafael




‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, October 9, 2018 9:49 PM, Rafael Avila de Espindola <rafael@espindo.la> wrote:

> All the required code already existed, and some of it was already
> running.
>
> AT_SYSINFO_EHDR is processed if NEED_DL_SYSINFO_DSO is defined, but it
> looks like it always is. The call to setup_vdso is also unconditional,
> so all that was left to do was setup the function pointers and use
> them. This patch just deletes some #ifdef to enable that.
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> The only difference from the previous patch is rebasing on top of the
> refactoring patch I just emailed.
>
> 2018-10-09 Rafael Ávila de Espíndola rafael@espindo.la
>
> [BZ #19767]
> * Makeconfig: Add -DUSE_VSYSCALL to CPPFLAGS-.os.
> * nptl/Makefile: Add tst-cond11-static to tests-static and tests.
> * nptl/tst-cond11-static.c: New File.
> * sysdeps/unix/sysv/linux/Makefile: Add tst-affinity-static to
> tests-static and tests
> * sysdeps/unix/sysv/linux/sysdep-vdso.h: Use USE_VSYSCALL instead
> of SHARED.
> * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file.
> * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Use USE_VSYSCALL
> instead of SHARED.
> * sysdeps/unix/sysv/linux/x86_64/init-first.c: remove #ifdef SHARED.
> * sysdeps/unix/sysv/linux/x86_64/sysdep.h: define USE_VSYSCALL.
>
> diff --git a/Makeconfig b/Makeconfig
> index fbcf69e7c2..61712dc35e 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -999,7 +999,7 @@ ifeq (yes,$(build-shared))
>
> Under --enable-shared, we will build a shared library of PIC objects.
>
> ======================================================================
>
> The PIC object files are named foo.os.
>
> =======================================
>
> object-suffixes += .os
> -CPPFLAGS-.os = -DPIC -DSHARED
> +CPPFLAGS-.os = -DPIC -DSHARED -DUSE_VSYSCALL
> CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
> libtype.os := lib%_pic.a
>
> This can be changed by a sysdep makefile
>
> =========================================
>
> diff --git a/nptl/Makefile b/nptl/Makefile
> index be8066524c..1b384548a1 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -449,9 +449,10 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
> tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
> tst-cancel21-static tst-cancel24-static tst-cond8-static \
> tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
>
> -         tst-sem12-static
>
>
>
> -         tst-sem12-static tst-cond11-static
>
>
> -
>
> tests += tst-cancel21-static tst-cancel24-static \
>
> -   tst-cond8-static
>
> -   tst-cond8-static tst-cond11-static
>     tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static
>     xtests-static += tst-setuid1-static
>
>     diff --git a/nptl/tst-cond11-static.c b/nptl/tst-cond11-static.c
>     new file mode 100644
>     index 0000000000..9bccb8ec8b
>     --- /dev/null
>     +++ b/nptl/tst-cond11-static.c
>     @@ -0,0 +1 @@
>     +#include "tst-cond11.c"
>     diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
>     index d047b61af7..9a006d9917 100644
>     --- a/sysdeps/unix/sysv/linux/Makefile
>     +++ b/sysdeps/unix/sysv/linux/Makefile
>     @@ -145,6 +145,9 @@ sysdep_routines += sched_getcpu oldglob
>
>     tests += tst-affinity tst-affinity-pid
>
>     +tests-static := tst-affinity-static
>     +tests += $(tests-static)
>
> -
>
> CFLAGS-fork.c = $(libio-mtsafe)
> CFLAGS-getpid.o = -fomit-frame-pointer
> CFLAGS-getpid.os = -fomit-frame-pointer
> diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
> index 7f894c5e02..a50844a710 100644
> --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
> +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
> @@ -26,7 +26,7 @@
> funcptr (args)
> #endif
>
> -#if defined SHARED && defined HAVE_VSYSCALL
> +#if defined HAVE_VSYSCALL && defined USE_VSYSCALL
>
> include <libc-vdso.h>
>
> ======================
>
> @@ -84,6 +84,6 @@
>
> define INTERNAL_VSYSCALL(name, err, nr, args...) \
>
> ===================================================
>
>     INTERNAL_SYSCALL (name, err, nr, ##args)
>
>
> -#endif /* defined SHARED && defined HAVE_VSYSCALL/
> +#endif / defined HAVE_VSYSCALL && defined USE_VSYSCALL /
> #endif / SYSDEP_VDSO_LINUX_H */diff --git a/sysdeps/unix/sysv/linux/tst-affinity-static.c b/sysdeps/unix/sysv/linux/tst-affinity-static.c
> new file mode 100644
> index 0000000000..4022ea317a
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/tst-affinity-static.c
> @@ -0,0 +1 @@
> +#include "tst-affinity.c"
> diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> index 6f86073dae..3ea43263fd 100644
> --- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> +++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> @@ -22,7 +22,7 @@
> #include <time.h>
> #include <sys/time.h>
>
> -#ifdef SHARED
> +#ifdef USE_VSYSCALL
>
> include <sysdep-vdso.h>
>
> ========================
>
> diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
> index 2320505804..ad19f4b055 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
> +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
> @@ -16,11 +16,10 @@
> License along with the GNU C Library; if not, see
> http://www.gnu.org/licenses/. */
>
> -#ifdef SHARED
> -# include <time.h>
> -# include <sysdep.h>
> -# include <dl-vdso.h>
> -# include <libc-vdso.h>
> +#include <time.h>
> +#include <sysdep.h>
> +#include <dl-vdso.h>
> +#include <libc-vdso.h>
>
> long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
> attribute_hidden;
> @@ -46,7 +45,6 @@ __vdso_platform_setup (void)
> VDSO_SYMBOL(getcpu) = p;
> }
>
> -# define VDSO_SETUP __vdso_platform_setup
> -#endif
> +#define VDSO_SETUP __vdso_platform_setup
>
> #include <csu/init-first.c>
> diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> index f07eb04962..7b98ed5686 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> @@ -18,6 +18,11 @@
> #ifndef _LINUX_X86_64_SYSDEP_H
> #define _LINUX_X86_64_SYSDEP_H 1
>
> +/* Always enable vsyscalls on x86_64 /
> +#ifndef USE_VSYSCALL
> +#define USE_VSYSCALL
> +#endif
> +
> / There is some commonality. */#include <sysdeps/unix/sysv/linux/sysdep.h>
> #include <sysdeps/unix/x86_64/sysdep.h>
> --
> 2.17.1
Florian Weimer Nov. 12, 2018, 1 p.m. UTC | #2
* Rafael Avila de Espindola:

> diff --git a/Makeconfig b/Makeconfig
> index fbcf69e7c2..61712dc35e 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -999,7 +999,7 @@ ifeq (yes,$(build-shared))
>  # Under --enable-shared, we will build a shared library of PIC objects.
>  # The PIC object files are named foo.os.
>  object-suffixes += .os
> -CPPFLAGS-.os = -DPIC -DSHARED
> +CPPFLAGS-.os = -DPIC -DSHARED -DUSE_VSYSCALL
>  CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
>  libtype.os := lib%_pic.a
>  # This can be changed by a sysdep makefile

This doesn't seem to be the right place to define the macro.  We also
prefer macros that are always defined and which change there value
between 0 and 1.

USE_VSYSCALL seems to be a Linux thing and thus should go into
sysdeps/unix/sysv/linux.

It may be clearer to define

#define USE_VSYSCALL (defined (SHARED) || ALWAYS_USE_VSYSCALL)

and then default ALWAYS_USE_VSYSCALL to 0 and override that to 1 for
x86_64.

Thanks,
Florian
Rafael Ávila de Espíndola Nov. 12, 2018, 10:38 p.m. UTC | #3
> > object-suffixes += .os
> > -CPPFLAGS-.os = -DPIC -DSHARED
> > +CPPFLAGS-.os = -DPIC -DSHARED -DUSE_VSYSCALL
> > CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
> > libtype.os := lib%_pic.a
> >
> > This can be changed by a sysdep makefile
> >
> > =========================================
>
> This doesn't seem to be the right place to define the macro. We also
> prefer macros that are always defined and which change there value
> between 0 and 1.
>
> USE_VSYSCALL seems to be a Linux thing and thus should go into
> sysdeps/unix/sysv/linux.
>
> It may be clearer to define
>
> #define USE_VSYSCALL (defined (SHARED) || ALWAYS_USE_VSYSCALL)
>
> and then default ALWAYS_USE_VSYSCALL to 0 and override that to 1 for
> x86_64.


Thanks. A new version is attached and it uses your suggestion.

The new ChangeLog is

2018-11-12  Rafael Ávila de Espíndola  <rafael@espindo.la>

        [BZ #19767]
        * nptl/Makefile: Add tst-cond11-static to tests-static and tests.
        * nptl/tst-cond11-static.c: New File.
        * sysdeps/unix/sysv/linux/Makefile: Add tst-affinity-static to
          tests-static and tests
        * sysdeps/unix/sysv/linux/sysdep-vdso.h: Use USE_VSYSCALL instead
          of SHARED.
	* sysdeps/unix/sysv/linux/sysdep.h: Define ALWAYS_USE_VSYSCALL and
	  USE_VSYSCALL.
        * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file.
        * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Use USE_VSYSCALL
          instead of SHARED.
        * sysdeps/unix/sysv/linux/x86_64/init-first.c: remove #ifdef SHARED.
        * sysdeps/unix/sysv/linux/x86_64/sysdep.h: define ALWAYS_USE_VSYSCALL.


Cheers,
Rafael
From e035a9e1da87daec5e0b8f735734df42e595646b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?=
 <rafael@espindo.la>
Date: Thu, 8 Nov 2018 23:25:31 -0800
Subject: [PATCH] Enable VDSO on x86_64 statically linked programs.

All the required code already existed, and some of it was already
running.

AT_SYSINFO_EHDR is processed if NEED_DL_SYSINFO_DSO is defined, but it
looks like it always is. The call to setup_vdso is also unconditional,
so all that was left to do was setup the function pointers and use
them. This patch just deletes some #ifdef to enable that.
---
 nptl/Makefile                                 |  5 +++--
 nptl/tst-cond11-static.c                      |  1 +
 sysdeps/unix/sysv/linux/Makefile              |  3 +++
 sysdeps/unix/sysv/linux/sysdep-vdso.h         |  4 ++--
 sysdeps/unix/sysv/linux/sysdep.h              |  7 +++++++
 sysdeps/unix/sysv/linux/tst-affinity-static.c |  1 +
 sysdeps/unix/sysv/linux/x86/libc-vdso.h       |  2 +-
 sysdeps/unix/sysv/linux/x86_64/init-first.c   | 12 +++++-------
 sysdeps/unix/sysv/linux/x86_64/sysdep.h       |  3 +++
 9 files changed, 26 insertions(+), 12 deletions(-)
 create mode 100644 nptl/tst-cond11-static.c
 create mode 100644 sysdeps/unix/sysv/linux/tst-affinity-static.c

diff --git a/nptl/Makefile b/nptl/Makefile
index 49b6faa330..982e43adfa 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -449,9 +449,10 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
 tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
 		tst-cancel21-static tst-cancel24-static tst-cond8-static \
 		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
-		tst-sem12-static
+		tst-sem12-static tst-cond11-static
+
 tests += tst-cancel21-static tst-cancel24-static \
-	 tst-cond8-static
+	 tst-cond8-static tst-cond11-static
 tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static
 xtests-static += tst-setuid1-static
 
diff --git a/nptl/tst-cond11-static.c b/nptl/tst-cond11-static.c
new file mode 100644
index 0000000000..9bccb8ec8b
--- /dev/null
+++ b/nptl/tst-cond11-static.c
@@ -0,0 +1 @@
+#include "tst-cond11.c"
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 72b6b641d5..362cf3b950 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -146,6 +146,9 @@ sysdep_routines += sched_getcpu oldglob
 
 tests += tst-affinity tst-affinity-pid
 
+tests-static := tst-affinity-static
+tests += $(tests-static)
+
 CFLAGS-fork.c = $(libio-mtsafe)
 CFLAGS-getpid.o = -fomit-frame-pointer
 CFLAGS-getpid.os = -fomit-frame-pointer
diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index 7f894c5e02..1ee0657ad3 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -26,7 +26,7 @@
      funcptr (args)
 #endif
 
-#if defined SHARED && defined HAVE_VSYSCALL
+#if USE_VSYSCALL && defined HAVE_VSYSCALL
 
 # include <libc-vdso.h>
 
@@ -84,6 +84,6 @@
 # define INTERNAL_VSYSCALL(name, err, nr, args...) \
    INTERNAL_SYSCALL (name, err, nr, ##args)
 
-#endif /* defined SHARED && defined HAVE_VSYSCALL */
+#endif /* USE_VSYSCALL && defined HAVE_VSYSCALL */
 
 #endif /* SYSDEP_VDSO_LINUX_H  */
diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h
index 4fd0a9bae3..9655436ee4 100644
--- a/sysdeps/unix/sysv/linux/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sysdep.h
@@ -18,6 +18,13 @@
 #include <bits/wordsize.h>
 #include <kernel-features.h>
 
+/* By default only shared builds use vdso. */
+#ifndef ALWAYS_USE_VSYSCALL
+#define ALWAYS_USE_VSYSCALL 0
+#endif
+
+#define USE_VSYSCALL (defined (SHARED) || ALWAYS_USE_VSYSCALL)
+
 /* Set error number and return -1.  A target may choose to return the
    internal function, __syscall_error, which sets errno and returns -1.
    We use -1l, instead of -1, so that it can be casted to (void *).  */
diff --git a/sysdeps/unix/sysv/linux/tst-affinity-static.c b/sysdeps/unix/sysv/linux/tst-affinity-static.c
new file mode 100644
index 0000000000..4022ea317a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-affinity-static.c
@@ -0,0 +1 @@
+#include "tst-affinity.c"
diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
index 6f86073dae..b9b4b93011 100644
--- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
@@ -22,7 +22,7 @@
 #include <time.h>
 #include <sys/time.h>
 
-#ifdef SHARED
+#if USE_VSYSCALL
 
 # include <sysdep-vdso.h>
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index 2320505804..ad19f4b055 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -16,11 +16,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef SHARED
-# include <time.h>
-# include <sysdep.h>
-# include <dl-vdso.h>
-# include <libc-vdso.h>
+#include <time.h>
+#include <sysdep.h>
+#include <dl-vdso.h>
+#include <libc-vdso.h>
 
 long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   attribute_hidden;
@@ -46,7 +45,6 @@ __vdso_platform_setup (void)
   VDSO_SYMBOL(getcpu) = p;
 }
 
-# define VDSO_SETUP __vdso_platform_setup
-#endif
+#define VDSO_SETUP __vdso_platform_setup
 
 #include <csu/init-first.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index f07eb04962..9f49347ce5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -18,6 +18,9 @@
 #ifndef _LINUX_X86_64_SYSDEP_H
 #define _LINUX_X86_64_SYSDEP_H 1
 
+/* Always enable vsyscalls on x86_64 */
+#define ALWAYS_USE_VSYSCALL 1
+
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/x86_64/sysdep.h>
Rafael Ávila de Espíndola Nov. 20, 2018, 2:58 p.m. UTC | #4
Ping

>
> Thanks. A new version is attached and it uses your suggestion.
>
> The new ChangeLog is
>
> 2018-11-12  Rafael Ávila de Espíndola  <rafael@espindo.la>
>
>         [BZ #19767]
>         * nptl/Makefile: Add tst-cond11-static to tests-static and tests.
>         * nptl/tst-cond11-static.c: New File.
>         * sysdeps/unix/sysv/linux/Makefile: Add tst-affinity-static to
>           tests-static and tests
>         * sysdeps/unix/sysv/linux/sysdep-vdso.h: Use USE_VSYSCALL instead
>           of SHARED.
> 	* sysdeps/unix/sysv/linux/sysdep.h: Define ALWAYS_USE_VSYSCALL and
> 	  USE_VSYSCALL.
>         * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file.
>         * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Use USE_VSYSCALL
>           instead of SHARED.
>         * sysdeps/unix/sysv/linux/x86_64/init-first.c: remove #ifdef SHARED.
>         * sysdeps/unix/sysv/linux/x86_64/sysdep.h: define ALWAYS_USE_VSYSCALL.
>
>
> Cheers,
> Rafael
> From e035a9e1da87daec5e0b8f735734df42e595646b Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?=
>  <rafael@espindo.la>
> Date: Thu, 8 Nov 2018 23:25:31 -0800
> Subject: [PATCH] Enable VDSO on x86_64 statically linked programs.
>
> All the required code already existed, and some of it was already
> running.
>
> AT_SYSINFO_EHDR is processed if NEED_DL_SYSINFO_DSO is defined, but it
> looks like it always is. The call to setup_vdso is also unconditional,
> so all that was left to do was setup the function pointers and use
> them. This patch just deletes some #ifdef to enable that.
> ---
>  nptl/Makefile                                 |  5 +++--
>  nptl/tst-cond11-static.c                      |  1 +
>  sysdeps/unix/sysv/linux/Makefile              |  3 +++
>  sysdeps/unix/sysv/linux/sysdep-vdso.h         |  4 ++--
>  sysdeps/unix/sysv/linux/sysdep.h              |  7 +++++++
>  sysdeps/unix/sysv/linux/tst-affinity-static.c |  1 +
>  sysdeps/unix/sysv/linux/x86/libc-vdso.h       |  2 +-
>  sysdeps/unix/sysv/linux/x86_64/init-first.c   | 12 +++++-------
>  sysdeps/unix/sysv/linux/x86_64/sysdep.h       |  3 +++
>  9 files changed, 26 insertions(+), 12 deletions(-)
>  create mode 100644 nptl/tst-cond11-static.c
>  create mode 100644 sysdeps/unix/sysv/linux/tst-affinity-static.c
>
> diff --git a/nptl/Makefile b/nptl/Makefile
> index 49b6faa330..982e43adfa 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -449,9 +449,10 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
>  tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
>  		tst-cancel21-static tst-cancel24-static tst-cond8-static \
>  		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
> -		tst-sem12-static
> +		tst-sem12-static tst-cond11-static
> +
>  tests += tst-cancel21-static tst-cancel24-static \
> -	 tst-cond8-static
> +	 tst-cond8-static tst-cond11-static
>  tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static
>  xtests-static += tst-setuid1-static
>  
> diff --git a/nptl/tst-cond11-static.c b/nptl/tst-cond11-static.c
> new file mode 100644
> index 0000000000..9bccb8ec8b
> --- /dev/null
> +++ b/nptl/tst-cond11-static.c
> @@ -0,0 +1 @@
> +#include "tst-cond11.c"
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 72b6b641d5..362cf3b950 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -146,6 +146,9 @@ sysdep_routines += sched_getcpu oldglob
>  
>  tests += tst-affinity tst-affinity-pid
>  
> +tests-static := tst-affinity-static
> +tests += $(tests-static)
> +
>  CFLAGS-fork.c = $(libio-mtsafe)
>  CFLAGS-getpid.o = -fomit-frame-pointer
>  CFLAGS-getpid.os = -fomit-frame-pointer
> diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
> index 7f894c5e02..1ee0657ad3 100644
> --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
> +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
> @@ -26,7 +26,7 @@
>       funcptr (args)
>  #endif
>  
> -#if defined SHARED && defined HAVE_VSYSCALL
> +#if USE_VSYSCALL && defined HAVE_VSYSCALL
>  
>  # include <libc-vdso.h>
>  
> @@ -84,6 +84,6 @@
>  # define INTERNAL_VSYSCALL(name, err, nr, args...) \
>     INTERNAL_SYSCALL (name, err, nr, ##args)
>  
> -#endif /* defined SHARED && defined HAVE_VSYSCALL */
> +#endif /* USE_VSYSCALL && defined HAVE_VSYSCALL */
>  
>  #endif /* SYSDEP_VDSO_LINUX_H  */
> diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h
> index 4fd0a9bae3..9655436ee4 100644
> --- a/sysdeps/unix/sysv/linux/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/sysdep.h
> @@ -18,6 +18,13 @@
>  #include <bits/wordsize.h>
>  #include <kernel-features.h>
>  
> +/* By default only shared builds use vdso. */
> +#ifndef ALWAYS_USE_VSYSCALL
> +#define ALWAYS_USE_VSYSCALL 0
> +#endif
> +
> +#define USE_VSYSCALL (defined (SHARED) || ALWAYS_USE_VSYSCALL)
> +
>  /* Set error number and return -1.  A target may choose to return the
>     internal function, __syscall_error, which sets errno and returns -1.
>     We use -1l, instead of -1, so that it can be casted to (void *).  */
> diff --git a/sysdeps/unix/sysv/linux/tst-affinity-static.c b/sysdeps/unix/sysv/linux/tst-affinity-static.c
> new file mode 100644
> index 0000000000..4022ea317a
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/tst-affinity-static.c
> @@ -0,0 +1 @@
> +#include "tst-affinity.c"
> diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> index 6f86073dae..b9b4b93011 100644
> --- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> +++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
> @@ -22,7 +22,7 @@
>  #include <time.h>
>  #include <sys/time.h>
>  
> -#ifdef SHARED
> +#if USE_VSYSCALL
>  
>  # include <sysdep-vdso.h>
>  
> diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
> index 2320505804..ad19f4b055 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
> +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
> @@ -16,11 +16,10 @@
>     License along with the GNU C Library; if not, see
>     <http://www.gnu.org/licenses/>.  */
>  
> -#ifdef SHARED
> -# include <time.h>
> -# include <sysdep.h>
> -# include <dl-vdso.h>
> -# include <libc-vdso.h>
> +#include <time.h>
> +#include <sysdep.h>
> +#include <dl-vdso.h>
> +#include <libc-vdso.h>
>  
>  long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
>    attribute_hidden;
> @@ -46,7 +45,6 @@ __vdso_platform_setup (void)
>    VDSO_SYMBOL(getcpu) = p;
>  }
>  
> -# define VDSO_SETUP __vdso_platform_setup
> -#endif
> +#define VDSO_SETUP __vdso_platform_setup
>  
>  #include <csu/init-first.c>
> diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> index f07eb04962..9f49347ce5 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> @@ -18,6 +18,9 @@
>  #ifndef _LINUX_X86_64_SYSDEP_H
>  #define _LINUX_X86_64_SYSDEP_H 1
>  
> +/* Always enable vsyscalls on x86_64 */
> +#define ALWAYS_USE_VSYSCALL 1
> +
>  /* There is some commonality.  */
>  #include <sysdeps/unix/sysv/linux/sysdep.h>
>  #include <sysdeps/unix/x86_64/sysdep.h>
> -- 
> 2.19.1
H.J. Lu Nov. 20, 2018, 5:02 p.m. UTC | #5
On Mon, Nov 12, 2018 at 2:38 PM Rafael Avila de Espindola
<rafael@espindo.la> wrote:
>
> > > object-suffixes += .os
> > > -CPPFLAGS-.os = -DPIC -DSHARED
> > > +CPPFLAGS-.os = -DPIC -DSHARED -DUSE_VSYSCALL
> > > CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
> > > libtype.os := lib%_pic.a
> > >
> > > This can be changed by a sysdep makefile
> > >
> > > =========================================
> >
> > This doesn't seem to be the right place to define the macro. We also
> > prefer macros that are always defined and which change there value
> > between 0 and 1.
> >
> > USE_VSYSCALL seems to be a Linux thing and thus should go into
> > sysdeps/unix/sysv/linux.
> >
> > It may be clearer to define
> >
> > #define USE_VSYSCALL (defined (SHARED) || ALWAYS_USE_VSYSCALL)
> >
> > and then default ALWAYS_USE_VSYSCALL to 0 and override that to 1 for
> > x86_64.
>
>
> Thanks. A new version is attached and it uses your suggestion.
>
> The new ChangeLog is
>
> 2018-11-12  Rafael Ávila de Espíndola  <rafael@espindo.la>
>
>         [BZ #19767]
>         * nptl/Makefile: Add tst-cond11-static to tests-static and tests.
>         * nptl/tst-cond11-static.c: New File.
>         * sysdeps/unix/sysv/linux/Makefile: Add tst-affinity-static to
>           tests-static and tests
>         * sysdeps/unix/sysv/linux/sysdep-vdso.h: Use USE_VSYSCALL instead
>           of SHARED.
>         * sysdeps/unix/sysv/linux/sysdep.h: Define ALWAYS_USE_VSYSCALL and
>           USE_VSYSCALL.
>         * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file.
>         * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Use USE_VSYSCALL
>           instead of SHARED.
>         * sysdeps/unix/sysv/linux/x86_64/init-first.c: remove #ifdef SHARED.
>         * sysdeps/unix/sysv/linux/x86_64/sysdep.h: define ALWAYS_USE_VSYSCALL.
>
>

LGTM.

Thanks.
Rafael Ávila de Espíndola Nov. 20, 2018, 5:25 p.m. UTC | #6
"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Mon, Nov 12, 2018 at 2:38 PM Rafael Avila de Espindola
> <rafael@espindo.la> wrote:
>>
>> > > object-suffixes += .os
>> > > -CPPFLAGS-.os = -DPIC -DSHARED
>> > > +CPPFLAGS-.os = -DPIC -DSHARED -DUSE_VSYSCALL
>> > > CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
>> > > libtype.os := lib%_pic.a
>> > >
>> > > This can be changed by a sysdep makefile
>> > >
>> > > =========================================
>> >
>> > This doesn't seem to be the right place to define the macro. We also
>> > prefer macros that are always defined and which change there value
>> > between 0 and 1.
>> >
>> > USE_VSYSCALL seems to be a Linux thing and thus should go into
>> > sysdeps/unix/sysv/linux.
>> >
>> > It may be clearer to define
>> >
>> > #define USE_VSYSCALL (defined (SHARED) || ALWAYS_USE_VSYSCALL)
>> >
>> > and then default ALWAYS_USE_VSYSCALL to 0 and override that to 1 for
>> > x86_64.
>>
>>
>> Thanks. A new version is attached and it uses your suggestion.
>>
>> The new ChangeLog is
>>
>> 2018-11-12  Rafael Ávila de Espíndola  <rafael@espindo.la>
>>
>>         [BZ #19767]
>>         * nptl/Makefile: Add tst-cond11-static to tests-static and tests.
>>         * nptl/tst-cond11-static.c: New File.
>>         * sysdeps/unix/sysv/linux/Makefile: Add tst-affinity-static to
>>           tests-static and tests
>>         * sysdeps/unix/sysv/linux/sysdep-vdso.h: Use USE_VSYSCALL instead
>>           of SHARED.
>>         * sysdeps/unix/sysv/linux/sysdep.h: Define ALWAYS_USE_VSYSCALL and
>>           USE_VSYSCALL.
>>         * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file.
>>         * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Use USE_VSYSCALL
>>           instead of SHARED.
>>         * sysdeps/unix/sysv/linux/x86_64/init-first.c: remove #ifdef SHARED.
>>         * sysdeps/unix/sysv/linux/x86_64/sysdep.h: define ALWAYS_USE_VSYSCALL.
>>
>>
>
> LGTM.

If you could commit it that would be awesome.

Thanks,
Rafael
Rafael Ávila de Espíndola Nov. 23, 2018, 4:56 p.m. UTC | #7
"Rafael Avila de Espindola" <rafael@espindo.la> writes:

>> LGTM.
>
> If you could commit it that would be awesome.

Ping.

Cheers,
Rafael
H.J. Lu Nov. 24, 2018, 12:51 a.m. UTC | #8
On Fri, Nov 23, 2018 at 8:56 AM Rafael Avila de Espindola
<rafael@espindo.la> wrote:
>
> "Rafael Avila de Espindola" <rafael@espindo.la> writes:
>
> >> LGTM.
> >
> > If you could commit it that would be awesome.
>
> Ping.
>

Done.
Rafael Ávila de Espíndola Nov. 24, 2018, 1:21 a.m. UTC | #9
"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Fri, Nov 23, 2018 at 8:56 AM Rafael Avila de Espindola
> <rafael@espindo.la> wrote:
>>
>> "Rafael Avila de Espindola" <rafael@espindo.la> writes:
>>
>> >> LGTM.
>> >
>> > If you could commit it that would be awesome.
>>
>> Ping.
>>
>
> Done.

Thanks!

Cheers,
Rafael
Andreas Schwab Nov. 26, 2018, 9:32 a.m. UTC | #10
In file included from ../sysdeps/unix/sysv/linux/powerpc/libc-vdso.h:25,
                 from ../sysdeps/powerpc/powerpc32/backtrace.c:23:
../sysdeps/unix/sysv/linux/sysdep-vdso.h:29:5: error: "USE_VSYSCALL" is not defined, evaluates to 0 [-Werror=undef]
 #if USE_VSYSCALL && defined HAVE_VSYSCALL
     ^~~~~~~~~~~~

Andreas.
Tulio Magno Quites Machado Filho Nov. 26, 2018, 1:39 p.m. UTC | #11
Andreas Schwab <schwab@suse.de> writes:

> In file included from ../sysdeps/unix/sysv/linux/powerpc/libc-vdso.h:25,
>                  from ../sysdeps/powerpc/powerpc32/backtrace.c:23:
> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:29:5: error: "USE_VSYSCALL" is not defined, evaluates to 0 [-Werror=undef]
>  #if USE_VSYSCALL && defined HAVE_VSYSCALL
>      ^~~~~~~~~~~~

Fixed with commit 8ae74eadb60e.
Rafael Ávila de Espíndola Nov. 26, 2018, 4:22 p.m. UTC | #12
"Andreas Schwab" <schwab@suse.de> writes:

> In file included from ../sysdeps/unix/sysv/linux/powerpc/libc-vdso.h:25,
>                  from ../sysdeps/powerpc/powerpc32/backtrace.c:23:
> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:29:5: error: "USE_VSYSCALL" is not defined, evaluates to 0 [-Werror=undef]
>  #if USE_VSYSCALL && defined HAVE_VSYSCALL

Sorry about that.

While the particular build problem on powerpc is now fixed, maybe we
should just include sysdep.h from sysdep-vdso.h?

The attached patch does just that. The changelog is

2018-11-26  Rafael Ávila de Espíndola  <rafael@espindo.la>

	[BZ #19767]
	* sysdeps/unix/sysv/linux/sysdep-vdso.h: include sysdep.h.

Cheers,
Rafael
Tulio Magno Quites Machado Filho Nov. 27, 2018, 4:18 p.m. UTC | #13
Rafael Avila de Espindola <rafael@espindo.la> writes:

> "Andreas Schwab" <schwab@suse.de> writes:
>
>> In file included from ../sysdeps/unix/sysv/linux/powerpc/libc-vdso.h:25,
>>                  from ../sysdeps/powerpc/powerpc32/backtrace.c:23:
>> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:29:5: error: "USE_VSYSCALL" is not defined, evaluates to 0 [-Werror=undef]
>>  #if USE_VSYSCALL && defined HAVE_VSYSCALL
>
> Sorry about that.
>
> While the particular build problem on powerpc is now fixed, maybe we
> should just include sysdep.h from sysdep-vdso.h?
>
> The attached patch does just that. The changelog is

The patch is missing.

> 2018-11-26  Rafael Ávila de Espíndola  <rafael@espindo.la>
>
> 	[BZ #19767]
> 	* sysdeps/unix/sysv/linux/sysdep-vdso.h: include sysdep.h.

Uppercase sentence  -----------------------------^
Rafael Ávila de Espíndola Nov. 27, 2018, 6:18 p.m. UTC | #14
"Tulio Magno Quites Machado Filho" <tuliom@ascii.art.br> writes:

> Rafael Avila de Espindola <rafael@espindo.la> writes:
>
>> "Andreas Schwab" <schwab@suse.de> writes:
>>
>>> In file included from ../sysdeps/unix/sysv/linux/powerpc/libc-vdso.h:25,
>>>                  from ../sysdeps/powerpc/powerpc32/backtrace.c:23:
>>> ../sysdeps/unix/sysv/linux/sysdep-vdso.h:29:5: error: "USE_VSYSCALL" is not defined, evaluates to 0 [-Werror=undef]
>>>  #if USE_VSYSCALL && defined HAVE_VSYSCALL
>>
>> Sorry about that.
>>
>> While the particular build problem on powerpc is now fixed, maybe we
>> should just include sysdep.h from sysdep-vdso.h?
>>
>> The attached patch does just that. The changelog is
>
> The patch is missing.

Oops. Attached now.


The fixed changelog is

2018-11-27  Rafael Ávila de Espíndola  <rafael@espindo.la>

        [BZ #19767]
        * sysdeps/unix/sysv/linux/sysdep-vdso.h: Include sysdep.h.

Cheers,
Rafael
Tulio Magno Quites Machado Filho Nov. 28, 2018, 12:55 p.m. UTC | #15
Rafael Avila de Espindola <rafael@espindo.la> writes:

> "Tulio Magno Quites Machado Filho" <tuliom@ascii.art.br> writes:
>
>> Rafael Avila de Espindola <rafael@espindo.la> writes:
>>
>>> The attached patch does just that. The changelog is
>>
>> The patch is missing.
>
> Oops. Attached now.

There is nothing here again.

Maybe the mailing list is removing your patch?

I couldn't find a hint here:
https://sourceware.org/ml/libc-alpha/2018-11/msg00717.html
Florian Weimer Nov. 28, 2018, 12:57 p.m. UTC | #16
* Tulio Magno Quites Machado Filho:

> Rafael Avila de Espindola <rafael@espindo.la> writes:
>
>> "Tulio Magno Quites Machado Filho" <tuliom@ascii.art.br> writes:
>>
>>> Rafael Avila de Espindola <rafael@espindo.la> writes:
>>>
>>>> The attached patch does just that. The changelog is
>>>
>>> The patch is missing.
>>
>> Oops. Attached now.
>
> There is nothing here again.
>
> Maybe the mailing list is removing your patch?

Then Red Hat email system removes it as well. 8-/

Note that including <sysdep.h> can be problematic because on certain
architectures, not all assembler files are compatible with <sysdep.h>,
so if <sysdep-vdso.h> ends in assembler files, that could be a problem.

Thanks,
Florian
Rafael Ávila de Espíndola Nov. 28, 2018, 5:59 p.m. UTC | #17
"Tulio Magno Quites Machado Filho" <tuliom@ascii.art.br> writes:

> Rafael Avila de Espindola <rafael@espindo.la> writes:
>
>> "Tulio Magno Quites Machado Filho" <tuliom@ascii.art.br> writes:
>>
>>> Rafael Avila de Espindola <rafael@espindo.la> writes:
>>>
>>>> The attached patch does just that. The changelog is
>>>
>>> The patch is missing.
>>
>> Oops. Attached now.
>
> There is nothing here again.
>
> Maybe the mailing list is removing your patch?
>
> I couldn't find a hint here:
> https://sourceware.org/ml/libc-alpha/2018-11/msg00717.html

That is odd.

I have been having DMARC problems with the list, but this is just
peculiar.

Trying to just copy and paste it.

Cheers,
Rafael

We need to include sysdep.h to make sure USE_VSYSCALL is defined.
---
 sysdeps/unix/sysv/linux/sysdep-vdso.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index 1ee0657ad3..9ac31d3c06 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -19,6 +19,8 @@
 #ifndef SYSDEP_VDSO_LINUX_H
 # define SYSDEP_VDSO_LINUX_H

+#include <sysdep.h>
+
 #define VDSO_SYMBOL(__name) __vdso_##__name

 #ifndef INTERNAL_VSYSCALL_CALL
Rafael Ávila de Espíndola Nov. 28, 2018, 6:01 p.m. UTC | #18
"Florian Weimer" <fweimer@redhat.com> writes:

> * Tulio Magno Quites Machado Filho:
>
>> Rafael Avila de Espindola <rafael@espindo.la> writes:
>>
>>> "Tulio Magno Quites Machado Filho" <tuliom@ascii.art.br> writes:
>>>
>>>> Rafael Avila de Espindola <rafael@espindo.la> writes:
>>>>
>>>>> The attached patch does just that. The changelog is
>>>>
>>>> The patch is missing.
>>>
>>> Oops. Attached now.
>>
>> There is nothing here again.
>>
>> Maybe the mailing list is removing your patch?
>
> Then Red Hat email system removes it as well. 8-/
>
> Note that including <sysdep.h> can be problematic because on certain
> architectures, not all assembler files are compatible with <sysdep.h>,
> so if <sysdep-vdso.h> ends in assembler files, that could be a problem.

Looks like powerpc was the only build failure, so it might not be worth
the risk.

I will keep updating one arch at a time as I find time to test it on the
gcc farm.

Cheers,
Rafael
Rafal Luzynski Nov. 28, 2018, 10:35 p.m. UTC | #19
28.11.2018 13:55 Tulio Magno Quites Machado Filho <tuliom@ascii.art.br>
wrote:
> 
> Rafael Avila de Espindola <rafael@espindo.la> writes:
> 
> > "Tulio Magno Quites Machado Filho" <tuliom@ascii.art.br> writes:
> >
> >> Rafael Avila de Espindola <rafael@espindo.la> writes:
> >>
> >>> The attached patch does just that. The changelog is
> >>
> >> The patch is missing.
> >
> > Oops. Attached now.
> 
> There is nothing here again.
> 
> Maybe the mailing list is removing your patch?
> [...]

Rafael, does your email body contain a line consisting of only a single
dot?  I saw SMTP servers treating it as the end of message and removing
everything below.

Regards,

Rafal
Rafael Ávila de Espíndola Nov. 28, 2018, 11:58 p.m. UTC | #20
"Rafal Luzynski" <digitalfreak@lingonborough.com> writes:

> Rafael, does your email body contain a line consisting of only a single
> dot?  I saw SMTP servers treating it as the end of message and removing
> everything below.

Not that I can see. It looks like just the patch is missing. The content
I have after what is in
https://sourceware.org/ml/libc-alpha/2018-11/msg00717.html is:

------------------------------------------------------------
From be1a08b6257b4043ffab0cae9f4f49f49e47d0b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?=
 <rafael@espindo.la>
Date: Mon, 26 Nov 2018 08:14:39 -0800
Subject: [PATCH] Include missing header.

We need to include sysdep.h to make sure USE_VSYSCALL is defined.
---
 sysdeps/unix/sysv/linux/sysdep-vdso.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index 1ee0657ad3..9ac31d3c06 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -19,6 +19,8 @@
 #ifndef SYSDEP_VDSO_LINUX_H
 # define SYSDEP_VDSO_LINUX_H

+#include <sysdep.h>
+
 #define VDSO_SYMBOL(__name) __vdso_##__name

 #ifndef INTERNAL_VSYSCALL_CALL
------------------------------------------------------------

Cheers,
Rafael
diff mbox series

Patch

diff --git a/Makeconfig b/Makeconfig
index fbcf69e7c2..61712dc35e 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -999,7 +999,7 @@  ifeq (yes,$(build-shared))
 # Under --enable-shared, we will build a shared library of PIC objects.
 # The PIC object files are named foo.os.
 object-suffixes += .os
-CPPFLAGS-.os = -DPIC -DSHARED
+CPPFLAGS-.os = -DPIC -DSHARED -DUSE_VSYSCALL
 CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
 libtype.os := lib%_pic.a
 # This can be changed by a sysdep makefile
diff --git a/nptl/Makefile b/nptl/Makefile
index be8066524c..1b384548a1 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -449,9 +449,10 @@  link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
 tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
 		tst-cancel21-static tst-cancel24-static tst-cond8-static \
 		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
-		tst-sem12-static
+		tst-sem12-static tst-cond11-static
+
 tests += tst-cancel21-static tst-cancel24-static \
-	 tst-cond8-static
+	 tst-cond8-static tst-cond11-static
 tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static
 xtests-static += tst-setuid1-static
 
diff --git a/nptl/tst-cond11-static.c b/nptl/tst-cond11-static.c
new file mode 100644
index 0000000000..9bccb8ec8b
--- /dev/null
+++ b/nptl/tst-cond11-static.c
@@ -0,0 +1 @@ 
+#include "tst-cond11.c"
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index d047b61af7..9a006d9917 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -145,6 +145,9 @@  sysdep_routines += sched_getcpu oldglob
 
 tests += tst-affinity tst-affinity-pid
 
+tests-static := tst-affinity-static
+tests += $(tests-static)
+
 CFLAGS-fork.c = $(libio-mtsafe)
 CFLAGS-getpid.o = -fomit-frame-pointer
 CFLAGS-getpid.os = -fomit-frame-pointer
diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
index 7f894c5e02..a50844a710 100644
--- a/sysdeps/unix/sysv/linux/sysdep-vdso.h
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -26,7 +26,7 @@ 
      funcptr (args)
 #endif
 
-#if defined SHARED && defined HAVE_VSYSCALL
+#if defined HAVE_VSYSCALL && defined USE_VSYSCALL
 
 # include <libc-vdso.h>
 
@@ -84,6 +84,6 @@ 
 # define INTERNAL_VSYSCALL(name, err, nr, args...) \
    INTERNAL_SYSCALL (name, err, nr, ##args)
 
-#endif /* defined SHARED && defined HAVE_VSYSCALL */
+#endif /* defined HAVE_VSYSCALL && defined USE_VSYSCALL  */
 
 #endif /* SYSDEP_VDSO_LINUX_H  */
diff --git a/sysdeps/unix/sysv/linux/tst-affinity-static.c b/sysdeps/unix/sysv/linux/tst-affinity-static.c
new file mode 100644
index 0000000000..4022ea317a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-affinity-static.c
@@ -0,0 +1 @@ 
+#include "tst-affinity.c"
diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
index 6f86073dae..3ea43263fd 100644
--- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
@@ -22,7 +22,7 @@ 
 #include <time.h>
 #include <sys/time.h>
 
-#ifdef SHARED
+#ifdef USE_VSYSCALL
 
 # include <sysdep-vdso.h>
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index 2320505804..ad19f4b055 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -16,11 +16,10 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifdef SHARED
-# include <time.h>
-# include <sysdep.h>
-# include <dl-vdso.h>
-# include <libc-vdso.h>
+#include <time.h>
+#include <sysdep.h>
+#include <dl-vdso.h>
+#include <libc-vdso.h>
 
 long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
   attribute_hidden;
@@ -46,7 +45,6 @@  __vdso_platform_setup (void)
   VDSO_SYMBOL(getcpu) = p;
 }
 
-# define VDSO_SETUP __vdso_platform_setup
-#endif
+#define VDSO_SETUP __vdso_platform_setup
 
 #include <csu/init-first.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index f07eb04962..7b98ed5686 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -18,6 +18,11 @@ 
 #ifndef _LINUX_X86_64_SYSDEP_H
 #define _LINUX_X86_64_SYSDEP_H 1
 
+/* Always enable vsyscalls on x86_64 */
+#ifndef USE_VSYSCALL
+#define USE_VSYSCALL
+#endif
+
 /* There is some commonality.  */
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/x86_64/sysdep.h>