From 93a45ff1ca6d459618bb0cf93580c4b2809a4b61 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 7 Jan 2014 09:36:31 +0100 Subject: S/390: Make jmp_buf extendible. --- sysdeps/unix/sysv/linux/s390/Makefile | 6 +++ sysdeps/unix/sysv/linux/s390/Versions | 3 ++ sysdeps/unix/sysv/linux/s390/longjmp_chk.c | 44 ++++++++++++++++++++++ .../unix/sysv/linux/s390/s390-32/____longjmp_chk.c | 24 ++++++++++-- .../unix/sysv/linux/s390/s390-32/nptl/libc.abilist | 10 +++++ .../linux/s390/s390-32/nptl/libpthread.abilist | 4 ++ .../unix/sysv/linux/s390/s390-64/____longjmp_chk.c | 25 ++++++++++-- .../unix/sysv/linux/s390/s390-64/nptl/libc.abilist | 10 +++++ .../linux/s390/s390-64/nptl/libpthread.abilist | 4 ++ sysdeps/unix/sysv/linux/s390/v1-longjmp_chk.c | 35 +++++++++++++++++ 10 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/s390/longjmp_chk.c create mode 100644 sysdeps/unix/sysv/linux/s390/v1-longjmp_chk.c (limited to 'sysdeps/unix/sysv/linux') diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile index 45b1922338..f91179d0fc 100644 --- a/sysdeps/unix/sysv/linux/s390/Makefile +++ b/sysdeps/unix/sysv/linux/s390/Makefile @@ -16,3 +16,9 @@ endif ifeq ($(subdir),elf) sysdep_routines += dl-vdso endif + +ifeq ($(subdir),debug) +ifeq (yes,$(build-shared)) +sysdep_routines += v1-longjmp_chk +endif +endif diff --git a/sysdeps/unix/sysv/linux/s390/Versions b/sysdeps/unix/sysv/linux/s390/Versions index 627ff53529..95778235bf 100644 --- a/sysdeps/unix/sysv/linux/s390/Versions +++ b/sysdeps/unix/sysv/linux/s390/Versions @@ -1,4 +1,7 @@ libc { + GLIBC_2.19 { + __longjmp_chk; + } GLIBC_PRIVATE { __vdso_clock_gettime; __vdso_clock_getres; diff --git a/sysdeps/unix/sysv/linux/s390/longjmp_chk.c b/sysdeps/unix/sysv/linux/s390/longjmp_chk.c new file mode 100644 index 0000000000..10f542d61c --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/longjmp_chk.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . + + This is a copy of debug/longjmp_chk.c extended for symbol + versioning. */ + +#include +#include + +/* This place is the only user of these functions. */ +extern void ____v2__longjmp_chk (__jmp_buf __env, int __val) + __attribute__ ((__noreturn__)); + +#if defined NOT_IN_libc + +# define __v2__longjmp ____longjmp_chk +# define __v2__libc_siglongjmp __longjmp_chk + +# include + +#else + +# define __v2__longjmp ____v2__longjmp_chk +# define __v2__libc_siglongjmp __v2__libc_siglongjmp_chk + +# include + +versioned_symbol (libc, __v2__libc_siglongjmp_chk, __longjmp_chk, GLIBC_2_19); + +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c b/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c index e74f335768..a1b7a6a1ae 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/____longjmp_chk.c @@ -26,8 +26,8 @@ #include #include #include - -#define __longjmp ____longjmp_chk +#include +#include #define CHECK_SP(env, guard) \ do \ @@ -51,4 +51,22 @@ } \ } while (0) -#include "__longjmp.c" + +#if defined NOT_IN_libc +/* Build a non-versioned object for rtld-*. */ +# define __longjmp ____longjmp_chk +# include "__longjmp-common.c" + +#else /* !NOT_IN_libc */ +# define __longjmp ____v2__longjmp_chk +# include "__longjmp-common.c" + +# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_11, GLIBC_2_19) +# undef __longjmp +# define __V1_JMPBUF +# define __longjmp ____v1__longjmp_chk +# include "__longjmp-common.c" +# undef __longjmp + +# endif +#endif /* !NOT_IN_libc */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist index b6256d5c25..18ec9944e1 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist @@ -1774,6 +1774,16 @@ GLIBC_2.17 GLIBC_2.18 GLIBC_2.18 A __cxa_thread_atexit_impl F +GLIBC_2.19 + GLIBC_2.19 A + __longjmp_chk F + __setjmp F + __sigsetjmp F + _longjmp F + _setjmp F + longjmp F + setjmp F + siglongjmp F GLIBC_2.2 GLIBC_2.2 A _IO_adjust_wcolumn F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist index 865364e130..699de0160c 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libpthread.abilist @@ -178,6 +178,10 @@ GLIBC_2.18 GLIBC_2.18 A pthread_getattr_default_np F pthread_setattr_default_np F +GLIBC_2.19 + GLIBC_2.19 A + longjmp F + siglongjmp F GLIBC_2.2 GLIBC_2.2 A __open64 F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c b/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c index a3b1375a0d..bc27b08728 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/s390/s390-64/____longjmp_chk.c @@ -26,8 +26,8 @@ #include #include #include - -#define __longjmp ____longjmp_chk +#include +#include #define CHECK_SP(env, guard) \ do \ @@ -51,4 +51,23 @@ } \ } while (0) -#include "__longjmp.c" + +#if defined NOT_IN_libc +/* Build a non-versioned object for rtld-*. */ +# define __longjmp ____longjmp_chk +# include "__longjmp-common.c" + +#else /* !NOT_IN_libc */ +# define __longjmp ____v2__longjmp_chk +# include "__longjmp-common.c" +# undef __longjmp + +# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_11, GLIBC_2_19) +# undef __longjmp +# define __V1_JMPBUF +# define __longjmp ____v1__longjmp_chk +# include "__longjmp-common.c" +# undef __longjmp + +# endif +#endif /* !NOT_IN_libc */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist index 265f66d905..05b5286058 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist @@ -95,6 +95,16 @@ GLIBC_2.17 GLIBC_2.18 GLIBC_2.18 A __cxa_thread_atexit_impl F +GLIBC_2.19 + GLIBC_2.19 A + __longjmp_chk F + __setjmp F + __sigsetjmp F + _longjmp F + _setjmp F + longjmp F + setjmp F + siglongjmp F GLIBC_2.2 GLIBC_2.2 A _Exit F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist index 6613c09b06..51a8a7ff60 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libpthread.abilist @@ -12,6 +12,10 @@ GLIBC_2.18 GLIBC_2.18 A pthread_getattr_default_np F pthread_setattr_default_np F +GLIBC_2.19 + GLIBC_2.19 A + longjmp F + siglongjmp F GLIBC_2.2 GLIBC_2.2 A _IO_flockfile F diff --git a/sysdeps/unix/sysv/linux/s390/v1-longjmp_chk.c b/sysdeps/unix/sysv/linux/s390/v1-longjmp_chk.c new file mode 100644 index 0000000000..bd80acfe66 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/v1-longjmp_chk.c @@ -0,0 +1,35 @@ +/* Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . + + This went into a separate source file since we would otherwise be + needed to include two different versions of setjmp.h into the same + file. */ + +#include + +#if !defined NOT_IN_libc && defined SHARED +# if SHLIB_COMPAT (libc, GLIBC_2_11, GLIBC_2_19) + +# define __v1__longjmp ____v1__longjmp_chk +# define __v1__libc_siglongjmp __v1__libc_siglongjmp_chk + +# include + +compat_symbol (libc, __v1__libc_siglongjmp_chk, __longjmp_chk, GLIBC_2_11); + +# endif +#endif -- cgit 1.4.1