aboutsummaryrefslogtreecommitdiff
path: root/REORG.TODO/sysdeps/s390/bits
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/sysdeps/s390/bits
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-zack/build-layout-experiment.tar
glibc-zack/build-layout-experiment.tar.gz
glibc-zack/build-layout-experiment.tar.bz2
glibc-zack/build-layout-experiment.zip
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/sysdeps/s390/bits')
-rw-r--r--REORG.TODO/sysdeps/s390/bits/byteswap-16.h65
-rw-r--r--REORG.TODO/sysdeps/s390/bits/byteswap.h134
-rw-r--r--REORG.TODO/sysdeps/s390/bits/endian.h7
-rw-r--r--REORG.TODO/sysdeps/s390/bits/flt-eval-method.h24
-rw-r--r--REORG.TODO/sysdeps/s390/bits/link.h139
-rw-r--r--REORG.TODO/sysdeps/s390/bits/setjmp.h47
-rw-r--r--REORG.TODO/sysdeps/s390/bits/string.h252
-rw-r--r--REORG.TODO/sysdeps/s390/bits/xtitypes.h33
8 files changed, 701 insertions, 0 deletions
diff --git a/REORG.TODO/sysdeps/s390/bits/byteswap-16.h b/REORG.TODO/sysdeps/s390/bits/byteswap-16.h
new file mode 100644
index 0000000000..85ae5f5505
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/byteswap-16.h
@@ -0,0 +1,65 @@
+/* Macros to swap the order of bytes in 16-bit integer values. s390 version
+ Copyright (C) 2012-2017 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _BITS_BYTESWAP_H
+# error "Never use <bits/byteswap-16.h> directly; include <byteswap.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+/* Swap bytes in 16 bit value. */
+#if defined __GNUC__ && __GNUC__ >= 2
+# if __WORDSIZE == 64
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ unsigned short int __v, __x = (unsigned short int) (x); \
+ if (__builtin_constant_p (x)) \
+ __v = __bswap_constant_16 (__x); \
+ else { \
+ unsigned short int __tmp = (unsigned short int) (__x); \
+ __asm__ __volatile__ ( \
+ "lrvh %0,%1" \
+ : "=&d" (__v) : "m" (__tmp) ); \
+ } \
+ __v; }))
+# else
+# define __bswap_16(x) \
+ (__extension__ \
+ ({ unsigned short int __v, __x = (unsigned short int) (x); \
+ if (__builtin_constant_p (x)) \
+ __v = __bswap_constant_16 (__x); \
+ else { \
+ unsigned short int __tmp = (unsigned short int) (__x); \
+ __asm__ __volatile__ ( \
+ "sr %0,%0\n" \
+ "la 1,%1\n" \
+ "icm %0,2,1(1)\n" \
+ "ic %0,0(1)" \
+ : "=&d" (__v) : "m" (__tmp) : "1"); \
+ } \
+ __v; }))
+# endif
+#else
+/* This is better than nothing. */
+static __inline unsigned short int
+__bswap_16 (unsigned short int __bsx)
+{
+ return __bswap_constant_16 (__bsx);
+}
+#endif
diff --git a/REORG.TODO/sysdeps/s390/bits/byteswap.h b/REORG.TODO/sysdeps/s390/bits/byteswap.h
new file mode 100644
index 0000000000..6d5f65e6f8
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/byteswap.h
@@ -0,0 +1,134 @@
+/* Macros to swap the order of bytes in integer values. s390 version.
+ Copyright (C) 2000-2017 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
+# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#ifndef _BITS_BYTESWAP_H
+#define _BITS_BYTESWAP_H 1
+
+#define __bswap_constant_16(x) \
+ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
+
+/* Get __bswap_16. */
+#include <bits/byteswap-16.h>
+
+/* Swap bytes in 32 bit value. */
+#define __bswap_constant_32(x) \
+ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
+
+#if defined __GNUC__ && __GNUC__ >= 2
+# if __WORDSIZE == 64
+# define __bswap_32(x) \
+ (__extension__ \
+ ({ unsigned int __v, __x = (x); \
+ if (__builtin_constant_p (x)) \
+ __v = __bswap_constant_32 (__x); \
+ else { \
+ unsigned int __tmp = (unsigned int) (__x); \
+ __asm__ __volatile__ ( \
+ "lrv %0,%1" \
+ : "=&d" (__v) : "m" (__tmp)); \
+ } \
+ __v; }))
+# else
+# define __bswap_32(x) \
+ (__extension__ \
+ ({ unsigned int __v, __x = (x); \
+ if (__builtin_constant_p (x)) \
+ __v = __bswap_constant_32 (__x); \
+ else { \
+ unsigned int __tmp = (unsigned int) (__x); \
+ __asm__ __volatile__ ( \
+ "la 1,%1\n" \
+ "icm %0,8,3(1)\n" \
+ "icm %0,4,2(1)\n" \
+ "icm %0,2,1(1)\n" \
+ "ic %0,0(1)" \
+ : "=&d" (__v) : "m" (__tmp) : "1"); \
+ } \
+ __v; }))
+# endif
+#else
+static __inline unsigned int
+__bswap_32 (unsigned int __bsx)
+{
+ return __bswap_constant_32 (__bsx);
+}
+#endif
+
+/* Swap bytes in 64 bit value. */
+#if defined __GNUC__ && __GNUC__ >= 2
+# define __bswap_constant_64(x) \
+ (__extension__ ((((x) & 0xff00000000000000ul) >> 56) \
+ | (((x) & 0x00ff000000000000ul) >> 40) \
+ | (((x) & 0x0000ff0000000000ul) >> 24) \
+ | (((x) & 0x000000ff00000000ul) >> 8) \
+ | (((x) & 0x00000000ff000000ul) << 8) \
+ | (((x) & 0x0000000000ff0000ul) << 24) \
+ | (((x) & 0x000000000000ff00ul) << 40) \
+ | (((x) & 0x00000000000000fful) << 56)))
+
+# if __WORDSIZE == 64
+# define __bswap_64(x) \
+ (__extension__ \
+ ({ unsigned long __w, __x = (x); \
+ if (__builtin_constant_p (x)) \
+ __w = __bswap_constant_64 (__x); \
+ else { \
+ unsigned long __tmp = (unsigned long) (__x); \
+ __asm__ __volatile__ ( \
+ "lrvg %0,%1" \
+ : "=&d" (__w) : "m" (__tmp)); \
+ } \
+ __w; }))
+# else
+# define __bswap_64(x) \
+ __extension__ \
+ ({ union { unsigned long long int __ll; \
+ unsigned long int __l[2]; } __w, __r; \
+ __w.__ll = (x); \
+ __r.__l[0] = __bswap_32 (__w.__l[1]); \
+ __r.__l[1] = __bswap_32 (__w.__l[0]); \
+ __r.__ll; })
+# endif
+#else
+# define __bswap_constant_64(x) \
+ ((((x) & 0xff00000000000000ull) >> 56) \
+ | (((x) & 0x00ff000000000000ull) >> 40) \
+ | (((x) & 0x0000ff0000000000ull) >> 24) \
+ | (((x) & 0x000000ff00000000ull) >> 8) \
+ | (((x) & 0x00000000ff000000ull) << 8) \
+ | (((x) & 0x0000000000ff0000ull) << 24) \
+ | (((x) & 0x000000000000ff00ull) << 40) \
+ | (((x) & 0x00000000000000ffull) << 56))
+
+__extension__
+static __inline unsigned long long int
+__bswap_64 (unsigned long long int __bsx)
+{
+ return __bswap_constant_64 (__bsx);
+}
+#endif
+
+#endif /* _BITS_BYTESWAP_H */
diff --git a/REORG.TODO/sysdeps/s390/bits/endian.h b/REORG.TODO/sysdeps/s390/bits/endian.h
new file mode 100644
index 0000000000..ac27f0119a
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/endian.h
@@ -0,0 +1,7 @@
+/* s390 is big-endian */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/REORG.TODO/sysdeps/s390/bits/flt-eval-method.h b/REORG.TODO/sysdeps/s390/bits/flt-eval-method.h
new file mode 100644
index 0000000000..c0fc68af06
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/flt-eval-method.h
@@ -0,0 +1,24 @@
+/* Define __GLIBC_FLT_EVAL_METHOD. S/390 version.
+ Copyright (C) 2016-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _MATH_H
+# error "Never use <bits/flt-eval-method.h> directly; include <math.h> instead."
+#endif
+
+/* This value is used because of a historical mistake. */
+#define __GLIBC_FLT_EVAL_METHOD 1
diff --git a/REORG.TODO/sysdeps/s390/bits/link.h b/REORG.TODO/sysdeps/s390/bits/link.h
new file mode 100644
index 0000000000..5960b9642c
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/link.h
@@ -0,0 +1,139 @@
+/* Copyright (C) 2005-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _LINK_H
+# error "Never include <bits/link.h> directly; use <link.h> instead."
+#endif
+
+#if defined HAVE_S390_VX_ASM_SUPPORT
+typedef char La_s390_vr[16];
+#endif
+
+#if __ELF_NATIVE_CLASS == 32
+
+/* Registers for entry into PLT on s390-32. */
+typedef struct La_s390_32_regs
+{
+ uint32_t lr_r2;
+ uint32_t lr_r3;
+ uint32_t lr_r4;
+ uint32_t lr_r5;
+ uint32_t lr_r6;
+ double lr_fp0;
+ double lr_fp2;
+# if defined HAVE_S390_VX_ASM_SUPPORT
+ La_s390_vr lr_v24;
+ La_s390_vr lr_v25;
+ La_s390_vr lr_v26;
+ La_s390_vr lr_v27;
+ La_s390_vr lr_v28;
+ La_s390_vr lr_v29;
+ La_s390_vr lr_v30;
+ La_s390_vr lr_v31;
+# endif
+} La_s390_32_regs;
+
+/* Return values for calls from PLT on s390-32. */
+typedef struct La_s390_32_retval
+{
+ uint32_t lrv_r2;
+ uint32_t lrv_r3;
+ double lrv_fp0;
+# if defined HAVE_S390_VX_ASM_SUPPORT
+ La_s390_vr lrv_v24;
+# endif
+} La_s390_32_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf32_Addr la_s390_32_gnu_pltenter (Elf32_Sym *__sym,
+ unsigned int __ndx,
+ uintptr_t *__refcook,
+ uintptr_t *__defcook,
+ La_s390_32_regs *__regs,
+ unsigned int *__flags,
+ const char *__symname,
+ long int *__framesizep);
+extern unsigned int la_s390_32_gnu_pltexit (Elf32_Sym *__sym,
+ unsigned int __ndx,
+ uintptr_t *__refcook,
+ uintptr_t *__defcook,
+ const La_s390_32_regs *__inregs,
+ La_s390_32_retval *__outregs,
+ const char *symname);
+
+__END_DECLS
+
+#else
+
+/* Registers for entry into PLT on s390-64. */
+typedef struct La_s390_64_regs
+{
+ uint64_t lr_r2;
+ uint64_t lr_r3;
+ uint64_t lr_r4;
+ uint64_t lr_r5;
+ uint64_t lr_r6;
+ double lr_fp0;
+ double lr_fp2;
+ double lr_fp4;
+ double lr_fp6;
+# if defined HAVE_S390_VX_ASM_SUPPORT
+ La_s390_vr lr_v24;
+ La_s390_vr lr_v25;
+ La_s390_vr lr_v26;
+ La_s390_vr lr_v27;
+ La_s390_vr lr_v28;
+ La_s390_vr lr_v29;
+ La_s390_vr lr_v30;
+ La_s390_vr lr_v31;
+# endif
+} La_s390_64_regs;
+
+/* Return values for calls from PLT on s390-64. */
+typedef struct La_s390_64_retval
+{
+ uint64_t lrv_r2;
+ double lrv_fp0;
+# if defined HAVE_S390_VX_ASM_SUPPORT
+ La_s390_vr lrv_v24;
+# endif
+} La_s390_64_retval;
+
+
+__BEGIN_DECLS
+
+extern Elf64_Addr la_s390_64_gnu_pltenter (Elf64_Sym *__sym,
+ unsigned int __ndx,
+ uintptr_t *__refcook,
+ uintptr_t *__defcook,
+ La_s390_64_regs *__regs,
+ unsigned int *__flags,
+ const char *__symname,
+ long int *__framesizep);
+extern unsigned int la_s390_64_gnu_pltexit (Elf64_Sym *__sym,
+ unsigned int __ndx,
+ uintptr_t *__refcook,
+ uintptr_t *__defcook,
+ const La_s390_64_regs *__inregs,
+ La_s390_64_retval *__outregs,
+ const char *__symname);
+
+__END_DECLS
+
+#endif
diff --git a/REORG.TODO/sysdeps/s390/bits/setjmp.h b/REORG.TODO/sysdeps/s390/bits/setjmp.h
new file mode 100644
index 0000000000..9aa3fe204f
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/setjmp.h
@@ -0,0 +1,47 @@
+/* Copyright (C) 2000-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+/* Define the machine-dependent type `jmp_buf'. IBM s390 version. */
+
+#ifndef __S390_SETJMP_H__
+#define __S390_SETJMP_H__
+
+#if !defined _SETJMP_H && !defined _PTHREAD_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#ifndef _ASM
+
+typedef struct __s390_jmp_buf
+{
+ /* We save registers 6-15. */
+ long int __gregs[10];
+
+# if __WORDSIZE == 64
+ /* We save fpu registers f8 - f15. */
+ long __fpregs[8];
+# else
+ /* We save fpu registers 4 and 6. */
+ long __fpregs[4];
+# endif
+} __jmp_buf[1];
+
+#endif
+
+#endif /* __S390_SETJMP_H__ */
diff --git a/REORG.TODO/sysdeps/s390/bits/string.h b/REORG.TODO/sysdeps/s390/bits/string.h
new file mode 100644
index 0000000000..1e794f925d
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/string.h
@@ -0,0 +1,252 @@
+/* Optimized, inlined string functions. S/390 version.
+ Copyright (C) 2000-2017 Free Software Foundation, Inc.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+ 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _STRING_H
+# error "Never use <bits/string.h> directly; include <string.h> instead."
+#endif
+
+/* Use the unaligned string inline ABI. */
+#define _STRING_INLINE_unaligned 1
+
+/* We only provide optimizations if the user selects them and if
+ GNU CC is used. */
+#if !defined __NO_STRING_INLINES && defined __USE_STRING_INLINES \
+ && defined __GNUC__ && __GNUC__ >= 2
+
+#ifndef __STRING_INLINE
+# ifndef __extern_inline
+# define __STRING_INLINE inline
+# else
+# define __STRING_INLINE __extern_inline
+# endif
+#endif
+
+#define _HAVE_STRING_ARCH_strlen 1
+#ifndef _FORCE_INLINES
+#define strlen(str) __strlen_g ((str))
+
+__STRING_INLINE size_t __strlen_g (const char *) __asm__ ("strlen");
+
+__STRING_INLINE size_t
+__strlen_g (const char *__str)
+{
+ char *__ptr, *__tmp;
+
+ __ptr = (char *) 0;
+ __tmp = (char *) __str;
+ __asm__ __volatile__ (" la 0,0\n"
+ "0: srst %0,%1\n"
+ " jo 0b\n"
+ : "+&a" (__ptr), "+&a" (__tmp) :
+ : "cc", "memory", "0" );
+ return (size_t) (__ptr - __str);
+}
+#endif
+
+/* Copy SRC to DEST. */
+#define _HAVE_STRING_ARCH_strcpy 1
+#ifndef _FORCE_INLINES
+#define strcpy(dest, src) __strcpy_g ((dest), (src))
+
+__STRING_INLINE char *__strcpy_g (char *, const char *) __asm__ ("strcpy");
+
+__STRING_INLINE char *
+__strcpy_g (char *__dest, const char *__src)
+{
+ char *tmp = __dest;
+
+ __asm__ __volatile__ (" la 0,0\n"
+ "0: mvst %0,%1\n"
+ " jo 0b"
+ : "+&a" (__dest), "+&a" (__src) :
+ : "cc", "memory", "0" );
+ return tmp;
+}
+#endif
+
+#define _HAVE_STRING_ARCH_strncpy 1
+#ifndef _FORCE_INLINES
+#define strncpy(dest, src, n) __strncpy_g ((dest), (src), (n))
+
+__STRING_INLINE char *__strncpy_g (char *, const char *, size_t)
+ __asm__ ("strncpy");
+
+__STRING_INLINE char *
+__strncpy_g (char *__dest, const char *__src, size_t __n)
+{
+ char *__ret = __dest;
+ char *__ptr;
+ size_t __diff;
+
+ if (__n > 0) {
+ __diff = (size_t) (__dest - __src);
+ __ptr = (char *) __src;
+ __asm__ __volatile__ (" j 1f\n"
+ "0: la %0,1(%0)\n"
+ "1: icm 0,1,0(%0)\n"
+ " stc 0,0(%2,%0)\n"
+ " jz 3f\n"
+#if defined(__s390x__)
+ " brctg %1,0b\n"
+#else
+ " brct %1,0b\n"
+#endif
+ " j 4f\n"
+ "2: la %0,1(%0)\n"
+ " stc 0,0(%2,%0)\n"
+#if defined(__s390x__)
+ "3: brctg %1,2b\n"
+#else
+ "3: brct %1,2b\n"
+#endif
+ "4:"
+ : "+&a" (__ptr), "+&a" (__n) : "a" (__diff)
+ : "cc", "memory", "0" );
+ }
+ return __ret;
+}
+#endif
+
+/* Append SRC onto DEST. */
+#define _HAVE_STRING_ARCH_strcat 1
+#ifndef _FORCE_INLINES
+#define strcat(dest, src) __strcat_g ((dest), (src))
+
+__STRING_INLINE char *__strcat_g (char *, const char *) __asm__ ("strcat");
+
+__STRING_INLINE char *
+__strcat_g (char *__dest, const char *__src)
+{
+ char *__ret = __dest;
+ char *__ptr, *__tmp;
+
+ /* Move __ptr to the end of __dest. */
+ __ptr = (char *) 0;
+ __tmp = __dest;
+ __asm__ __volatile__ (" la 0,0\n"
+ "0: srst %0,%1\n"
+ " jo 0b\n"
+ : "+&a" (__ptr), "+&a" (__tmp) :
+ : "cc", "0" );
+
+ /* Now do the copy. */
+ __asm__ __volatile__ (" la 0,0\n"
+ "0: mvst %0,%1\n"
+ " jo 0b"
+ : "+&a" (__ptr), "+&a" (__src) :
+ : "cc", "memory", "0" );
+ return __ret;
+}
+#endif
+
+/* Append no more than N characters from SRC onto DEST. */
+#define _HAVE_STRING_ARCH_strncat 1
+#ifndef _FORCE_INLINES
+#define strncat(dest, src, n) __strncat_g ((dest), (src), (n))
+
+__STRING_INLINE char *__strncat_g (char *, const char *, size_t)
+ __asm__ ("strncat");
+
+__STRING_INLINE char *
+__strncat_g (char *__dest, const char *__src, size_t __n)
+{
+ char *__ret = __dest;
+ char *__ptr, *__tmp;
+ size_t __diff;
+
+ if (__n > 0) {
+ /* Move __ptr to the end of __dest. */
+ __ptr = (char *) 0;
+ __tmp = __dest;
+ __asm__ __volatile__ (" la 0,0\n"
+ "0: srst %0,%1\n"
+ " jo 0b\n"
+ : "+&a" (__ptr), "+&a" (__tmp) :
+ : "cc", "memory", "0" );
+
+ __diff = (size_t) (__ptr - __src);
+ __tmp = (char *) __src;
+ __asm__ __volatile__ (" j 1f\n"
+ "0: la %0,1(%0)\n"
+ "1: icm 0,1,0(%0)\n"
+ " stc 0,0(%2,%0)\n"
+ " jz 2f\n"
+#if defined(__s390x__)
+ " brctg %1,0b\n"
+#else
+ " brct %1,0b\n"
+#endif
+ " slr 0,0\n"
+ " stc 0,1(%2,%0)\n"
+ "2:"
+ : "+&a" (__tmp), "+&a" (__n) : "a" (__diff)
+ : "cc", "memory", "0" );
+
+ }
+ return __ret;
+}
+#endif
+
+/* Search N bytes of S for C. */
+#define _HAVE_STRING_ARCH_memchr 1
+#ifndef _FORCE_INLINES
+__STRING_INLINE void *
+memchr (const void *__str, int __c, size_t __n)
+{
+ char *__ptr, *__tmp;
+
+ __tmp = (char *) __str;
+ __ptr = (char *) __tmp + __n;
+ __asm__ __volatile__ (" lhi 0,0xff\n"
+ " nr 0,%2\n"
+ "0: srst %0,%1\n"
+ " jo 0b\n"
+ " brc 13,1f\n"
+ " la %0,0\n"
+ "1:"
+ : "+&a" (__ptr), "+&a" (__tmp) : "d" (__c)
+ : "cc", "memory", "0" );
+ return __ptr;
+}
+#endif
+
+/* Compare S1 and S2. */
+#define _HAVE_STRING_ARCH_strcmp 1
+#ifndef _FORCE_INLINES
+__STRING_INLINE int
+strcmp (const char *__s1, const char *__s2)
+{
+ char *__p1, *__p2;
+ int __ret;
+
+ __p1 = (char *) __s1;
+ __p2 = (char *) __s2;
+ __asm__ __volatile__ (" slr 0,0\n"
+ "0: clst %1,%2\n"
+ " jo 0b\n"
+ " ipm %0\n"
+ " srl %0,28"
+ : "=d" (__ret), "+&a" (__p1), "+&a" (__p2) :
+ : "cc", "memory", "0" );
+ __ret = (__ret == 0) ? 0 : (__ret == 1) ? -1 : 1;
+ return __ret;
+}
+#endif
+
+#endif /* Use string inlines && GNU CC. */
diff --git a/REORG.TODO/sysdeps/s390/bits/xtitypes.h b/REORG.TODO/sysdeps/s390/bits/xtitypes.h
new file mode 100644
index 0000000000..dd3fe43880
--- /dev/null
+++ b/REORG.TODO/sysdeps/s390/bits/xtitypes.h
@@ -0,0 +1,33 @@
+/* bits/xtitypes.h -- Define some types used by <bits/stropts.h>. S390/S390x
+ Copyright (C) 2002-2017 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
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _STROPTS_H
+# error "Never include <bits/xtitypes.h> directly; use <stropts.h> instead."
+#endif
+
+#ifndef _BITS_XTITYPES_H
+#define _BITS_XTITYPES_H 1
+
+#include <bits/types.h>
+
+/* This type is used by some structs in <bits/stropts.h>. */
+typedef __S32_TYPE __t_scalar_t;
+typedef __U32_TYPE __t_uscalar_t;
+
+
+#endif /* bits/xtitypes.h */