Skip to content

Commit

Permalink
s390: Enable VDSO for static linking
Browse files Browse the repository at this point in the history
Although s390 only enables vDSO for dynamically linked elf binaries
(arch/s390/kernel/vdso.c:217), there is no indication in the code or
associated commit message for why not enable it for statically linked
binaries as well.  To double check, I rebuilt a kernel with the
check removed and the vDSO does work for static build for supplied
symbols.

Checked on s390x-linux-gnu and s390-linux-gnu.

	[BZ #19767]
	* sysdeps/unix/sysv/linux/s390/init-first.c: Remove #ifdef SHARED.
	* sysdeps/unix/sysv/linux/s390/libc-vdso.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
	(ALWAYS_USE_VSYSCALL): Define.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
	(ALWAYS_USE_VSYSCALL): Likewise.
  • Loading branch information
zatrazz committed Aug 5, 2019
1 parent 27a0914 commit 5e855c8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
2019-08-05 Adhemerval Zanella <[email protected]>

[BZ #19767]
* sysdeps/unix/sysv/linux/s390/init-first.c: Remove #ifdef SHARED.
* sysdeps/unix/sysv/linux/s390/libc-vdso.h: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
(ALWAYS_USE_VSYSCALL): Define.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
(ALWAYS_USE_VSYSCALL): Likewise.

[BZ #19767]
* sysdeps/unix/sysv/linux/riscv/init-first.c: Remove #ifdef SHARED.
* sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise.
Expand Down
8 changes: 2 additions & 6 deletions sysdeps/unix/sysv/linux/s390/init-first.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

#ifdef SHARED
# include <dl-vdso.h>
# include <libc-vdso.h>
#include <dl-vdso.h>
#include <libc-vdso.h>

long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
attribute_hidden;
Expand Down Expand Up @@ -54,7 +53,4 @@ _libc_vdso_platform_setup (void)
VDSO_SYMBOL (getcpu) = p;
}

# define VDSO_SETUP _libc_vdso_platform_setup
#endif

#include <csu/init-first.c>
3 changes: 0 additions & 3 deletions sysdeps/unix/sysv/linux/s390/libc-vdso.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#ifndef _LIBC_VDSO_H
#define _LIBC_VDSO_H

#ifdef SHARED

#include <sysdep-vdso.h>

extern long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
Expand All @@ -33,6 +31,5 @@ extern long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);

extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *)
attribute_hidden;
#endif

#endif /* _LIBC_VDSO_H */
3 changes: 3 additions & 0 deletions sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
#ifndef _LINUX_S390_SYSDEP_H
#define _LINUX_S390_SYSDEP_H

/* Always enable vsyscalls on s390-32. */
#define ALWAYS_USE_VSYSCALL 1

#include <sysdeps/s390/s390-32/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
Expand Down
3 changes: 3 additions & 0 deletions sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#ifndef _LINUX_S390_SYSDEP_H
#define _LINUX_S390_SYSDEP_H

/* Always enable vsyscalls on s390-64. */
#define ALWAYS_USE_VSYSCALL 1

#include <sysdeps/s390/s390-64/sysdep.h>
#include <sysdeps/unix/sysdep.h>
#include <sysdeps/unix/sysv/linux/sysdep.h>
Expand Down

0 comments on commit 5e855c8

Please sign in to comment.