about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog28
-rw-r--r--Makerules11
-rw-r--r--scripts/gen-as-const.awk28
-rw-r--r--stdlib/Makefile3
-rw-r--r--stdlib/tst-ucontext-off.c35
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/i386/ucontext_i.h61
-rw-r--r--sysdeps/unix/sysv/linux/i386/ucontext_i.sym30
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h62
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym34
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h75
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym50
-rw-r--r--sysdeps/unix/sysv/linux/s390/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h49
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h49
-rw-r--r--sysdeps/unix/sysv/linux/s390/ucontext_i.sym23
-rw-r--r--sysdeps/unix/sysv/linux/sh/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.h79
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym38
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.h149
-rw-r--r--sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym73
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/Makefile4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ucontext_i.h69
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym34
25 files changed, 366 insertions, 634 deletions
diff --git a/ChangeLog b/ChangeLog
index ea9be8abb7..5c03197589 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,33 @@
 2005-12-21  Roland McGrath  <roland@redhat.com>
 
+	* sysdeps/unix/sysv/linux/i386/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/i386/ucontext_i.sym: New file.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym: New file.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym: New file.
+	* sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/s390/ucontext_i.sym: New file.
+	* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym: New file.
+	* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym: New file.
+	* sysdeps/unix/sysv/linux/x86_64/ucontext_i.h: File removed.
+	* sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym: New file.
+	* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = stdlib]:
+	(gen-as-const-headers): Add it.
+	* sysdeps/unix/sysv/linux/powerpc/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/sh/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/s390/Makefile: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/Makefile: Likewise.
+	* stdlib/tst-ucontext-off.c: File removed.
+	* stdlib/Makefile (tests): Remove it.
+
+	* scripts/gen-as-const.awk: Support generating a test program.
+	* Makerules [gen-as-const-headers] (tests): Add test-as-const.
+	[gen-as-const-headers] ($(objpfx)test-as-const.c): New target.
+
 	* sysdeps/generic/bits: Subdirectory and all files moved to ...
 	* bits: ... here, new subdirectory.
 	* Makeconfig (+includes): Reordered includes to put build and sysdeps
diff --git a/Makerules b/Makerules
index d0b1d8975d..2679c0a74b 100644
--- a/Makerules
+++ b/Makerules
@@ -183,6 +183,7 @@ sed-remove-dotdot := -e 's@  *\([^ 	\/$$][^ 	\]*\)@ $$(..)\1@g' \
 endif
 
 
+ifdef gen-as-const-headers
 # Generating headers for assembly constants.
 # We need this defined early to get into before-compile before
 # it's used in sysd-rules, below.
@@ -201,6 +202,16 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
 	mv -f $(@:.h.d=.h)T $(@:.h.d=.h)
 vpath %.sym $(sysdirs)
 before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
+
+tests += test-as-const
+$(objpfx)test-as-const.c: $(..)scripts/gen-as-const.awk $(..)Makerules \
+			  $(gen-as-const-headers) \
+			  $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
+	($(AWK) '{ sub(/^/, "asconst_", $$2); print; }' $(filter %.h,$^); \
+	 $(AWK) -v test=1 -f $< $(filter %.sym,$^); \
+	 echo '#include "$(..)test-skeleton.c"') > $@T
+	mv -f $@T $@
+endif
 
 # Generate an ordered list of implicit rules which find the source files in
 # each sysdep directory.  The old method was to use vpath to search all the
diff --git a/scripts/gen-as-const.awk b/scripts/gen-as-const.awk
index a315066422..c529fa42c8 100644
--- a/scripts/gen-as-const.awk
+++ b/scripts/gen-as-const.awk
@@ -13,7 +13,17 @@ BEGIN { started = 0 }
 /^#/ { print; next }
 
 NF >= 1 && !started {
-  print "void dummy(void) {";
+  if (test) {
+    print "\n#include <stdio.h>";
+    print "\nstatic int do_test (void)\n{\n  int bad = 0, good = 0;\n";
+    print "#define TEST(name, source, expr) \\\n" \
+      "  if (asconst_##name != (expr)) { ++bad;" \
+      " fprintf (stderr, \"%s: %s is %ld but %s is %ld\\n\"," \
+      " source, #name, (long int) asconst_##name, #expr, (long int) (expr));" \
+      " } else ++good;\n";
+  }
+  else
+    print "void dummy(void) {";
   started = 1;
 }
 
@@ -25,8 +35,18 @@ NF == 1 { sub(/^.*$/, "& &"); }
 NF > 1 {
   name = $1;
   sub(/^[^ 	]+[ 	]+/, "");
-  printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
-    name, $0;
+  if (test)
+    print "  TEST (" name ", \"" FILENAME ":" FNR "\", " $0 ")";
+  else
+    printf "asm (\"@@@name@@@%s@@@value@@@%%0@@@end@@@\" : : \"i\" (%s));\n",
+      name, $0;
 }
 
-END { if (started) print "}" }
+END {
+  if (test) {
+    print "  printf (\"%d errors in %d tests\\n\", bad, good + bad);"
+    print "  return bad != 0 || good == 0;\n}\n";
+    print "#define TEST_FUNCTION do_test ()";
+  }
+  else if (started) print "}";
+}
diff --git a/stdlib/Makefile b/stdlib/Makefile
index fa65c95121..9a9ff8bd45 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -63,8 +63,7 @@ tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
 		   test-canon test-canon2 tst-strtoll tst-environ	    \
 		   tst-xpg-basename tst-random tst-random2 tst-bsearch	    \
 		   tst-limits tst-rand48 bug-strtod tst-setcontext	    \
-		   test-a64l tst-qsort tst-system testmb2 bug-strtod2	    \
-		   tst-ucontext-off
+		   test-a64l tst-qsort tst-system testmb2 bug-strtod2
 
 include ../Makeconfig
 
diff --git a/stdlib/tst-ucontext-off.c b/stdlib/tst-ucontext-off.c
deleted file mode 100644
index 2e97f21aba..0000000000
--- a/stdlib/tst-ucontext-off.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <stddef.h>
-#include <stdio.h>
-#include <sys/ucontext.h>
-
-#include <ucontext_i.h>
-
-static int
-do_test  (void)
-{
-  int nerrors = 0;
-  int ntests = 0;
-
-#define TEST(member, val) \
-  do {									\
-    if (offsetof (struct ucontext, member) != val)			\
-      {									\
-	printf ("offsetof(%s) = %zu, %s = %zu\n",			\
-		#member, offsetof (struct ucontext, member),		\
-		#val, (size_t) val);					\
-	++nerrors;							\
-      }									\
-    ++ntests;								\
-  } while (0)
-
-#ifdef TESTS
-  TESTS
-#endif
-
-  printf ("%d errors in %d tests\n", nerrors, ntests);
-
-  return nerrors != 0;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 1ae69407ff..7db3e3eeac 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -12,3 +12,7 @@ endif
 ifeq ($(subdir),resource)
 sysdep_routines += oldgetrlimit64
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.h b/sysdeps/unix/sysv/linux/i386/ucontext_i.h
deleted file mode 100644
index c6319f2391..0000000000
--- a/sysdeps/unix/sysv/linux/i386/ucontext_i.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2001, 2005 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oLINK		4
-#define oSS_SP		8
-#define oSS_SIZE	16
-#define oGS		20
-#define oFS		24
-#define oEDI		36
-#define oESI		40
-#define oEBP		44
-#define oESP		48
-#define oEBX		52
-#define oEDX		56
-#define oECX		60
-#define oEAX		64
-#define oEIP		76
-#define oFPREGS		96
-#define oSIGMASK	108
-#define oFPREGSMEM	236
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_link, oLINK);				\
-  TEST (uc_stack.ss_sp, oSS_SP);			\
-  TEST (uc_stack.ss_size, oSS_SIZE);			\
-  TEST (uc_mcontext.gregs[REG_GS], oGS);		\
-  TEST (uc_mcontext.gregs[REG_FS], oFS);		\
-  TEST (uc_mcontext.gregs[REG_EDI], oEDI);		\
-  TEST (uc_mcontext.gregs[REG_ESI], oESI);		\
-  TEST (uc_mcontext.gregs[REG_EBP], oEBP);		\
-  TEST (uc_mcontext.gregs[REG_ESP], oESP);		\
-  TEST (uc_mcontext.gregs[REG_EBX], oEBX);		\
-  TEST (uc_mcontext.gregs[REG_EDX], oEDX);		\
-  TEST (uc_mcontext.gregs[REG_ECX], oECX);		\
-  TEST (uc_mcontext.gregs[REG_EAX], oEAX);		\
-  TEST (uc_mcontext.gregs[REG_EIP], oEIP);		\
-  TEST (uc_mcontext.fpregs, oFPREGS);			\
-  TEST (uc_sigmask, oSIGMASK);				\
-  TEST (__fpregs_mem, oFPREGSMEM);
diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
new file mode 100644
index 0000000000..b11a5509cd
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym
@@ -0,0 +1,30 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+#define mreg(reg)		mcontext (gregs[REG_##reg])
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oGS		mreg (GS)
+oFS		mreg (FS)
+oEDI		mreg (EDI)
+oESI		mreg (ESI)
+oEBP		mreg (EBP)
+oESP		mreg (ESP)
+oEBX		mreg (EBX)
+oEDX		mreg (EDX)
+oECX		mreg (ECX)
+oEAX		mreg (EAX)
+oEIP		mreg (EIP)
+oFPREGS		mcontext (fpregs)
+oSIGMASK	ucontext (uc_sigmask)
+oFPREGSMEM	ucontext (__fpregs_mem)
diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 671370ede0..55d2d0d273 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -2,3 +2,7 @@
 ifeq ($(subdir),rt)
 librt-routines += rt-sysdep
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
deleted file mode 100644
index f65b0ed58c..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-#define _FRAME_BACKCHAIN	0
-#define _FRAME_LR_SAVE	4
-#define _FRAME_PARM_SAVE1	8
-#define _FRAME_PARM_SAVE2	12
-#define _FRAME_PARM_SAVE3	16
-#define _FRAME_PARM_SAVE4	20
-
-#define _UC_LINK	4
-#define _UC_STACK_SP	8
-#define _UC_STACK_SIZE	16
-#define _UC_REGS_PTR	48
-#define _UC_SIGMASK	52
-#define _UC_REG_SPACE	180
-
-/* offsets within mcontext_t */
-#define _UC_GREGS	0
-#define _UC_FREGS	192
-#define _UC_VREGS	464
-#define _UC_VSCR	976
-#define _UC_VRSAVE	980
-
-/* The registers don't have a fixed offset within ucontext because the
-   orginal ucontext only contained the regs pointer.  Also with the
-   addition of VMX to the register state the mcontext may require
-   stronger alignment (16) then the containing ucontext (4).  All access
-   to register state (pt_regs/mcontext) must be indirect via the regs
-   (uc_regs) pointer.  This means we can't test the PPC32 mcontext
-   register offsets here.  */
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_link, _UC_LINK);					\
-  TEST (uc_stack.ss_sp, _UC_STACK_SP);				\
-  TEST (uc_stack.ss_size, _UC_STACK_SIZE);			\
-  TEST (uc_mcontext.regs, _UC_REGS_PTR);			\
-  TEST (uc_mcontext.uc_regs, _UC_REGS_PTR);			\
-  TEST (uc_sigmask, _UC_SIGMASK);				\
-  TEST (uc_reg_space, _UC_REG_SPACE);
-
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
new file mode 100644
index 0000000000..662c693303
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/ucontext_i.sym
@@ -0,0 +1,34 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+-- XXX Do these correspond to some struct?
+_FRAME_BACKCHAIN	0
+_FRAME_LR_SAVE		4
+_FRAME_PARM_SAVE1	8
+_FRAME_PARM_SAVE2	12
+_FRAME_PARM_SAVE3	16
+_FRAME_PARM_SAVE4	20
+
+-- Offsets in ucontext_t.
+#define ucontext(member)	offsetof (ucontext_t, member)
+_UC_LINK		ucontext (uc_link)
+_UC_STACK_SP		ucontext (uc_stack.ss_sp)
+_UC_STACK_SIZE		ucontext (uc_stack.ss_size)
+_UC_REGS_PTR		ucontext (uc_mcontext.uc_regs)
+_UC_SIGMASK		ucontext (uc_sigmask)
+_UC_REG_SPACE		ucontext (uc_reg_space)
+
+-- Offsets in mcontext_t.
+#define mcontext(member)	offsetof (mcontext_t, member)
+_UC_GREGS		mcontext (gregs)
+_UC_FREGS		mcontext (fpregs)
+_UC_VREGS		mcontext (vrregs)
+_UC_VREGS		mcontext (vrregs)
+_UC_VSCR		mcontext (vrregs.vscr)
+_UC_VRSAVE		mcontext (vrregs.vrsave)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h
deleted file mode 100644
index d540cfeaf1..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2002 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the powerpc64 ABI stack frame.  */
-
-#define FRAME_BACKCHAIN 0
-#define FRAME_CR_SAVE 8
-#define FRAME_LR_SAVE 16
-#define FRAME_COMPILER_DW 24
-#define FRAME_LINKER_DW 32
-#define FRAME_TOC_SAVE 40
-#define FRAME_PARM_SAVE 48
-#define FRAME_PARM1_SAVE 48
-#define FRAME_PARM2_SAVE 56
-#define FRAME_PARM3_SAVE 64
-#define FRAME_PARM4_SAVE 72
-#define FRAME_PARM5_SAVE 80
-#define FRAME_PARM6_SAVE 88
-#define FRAME_PARM7_SAVE 96
-#define FRAME_PARM8_SAVE 104
-#define FRAME_PARM9_SAVE 112
-
-
-/* Offsets of the fields in the ucontext_t structure.  */
-
-#define UCONTEXT_LINK 8
-#define UCONTEXT_STACK 16
-#define UCONTEXT_STACK_SP 16
-#define UCONTEXT_STACK_FLAGS 24
-#define UCONTEXT_STACK_SIZE 32
-#define UCONTEXT_SIGMASK 40
-#define UCONTEXT_MCONTEXT 168
-#define SIGCONTEXT_SIGNAL 200
-#define SIGCONTEXT_HANDLER 208
-#define SIGCONTEXT_OLDMASK 216
-#define SIGCONTEXT_PT_REGS 224
-#define SIGCONTEXT_GP_REGS 232
-#define SIGCONTEXT_FP_REGS 616
-#define SIGCONTEXT_V_REGS_PTR 880
-#define SIGCONTEXT_V_RESERVE 888
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_link, UCONTEXT_LINK);				\
-  TEST (uc_stack.ss_sp, UCONTEXT_STACK_SP);			\
-  TEST (uc_stack.ss_size, UCONTEXT_STACK_SIZE);			\
-  TEST (uc_sigmask, UCONTEXT_SIGMASK);				\
-  TEST (uc_mcontext.signal, SIGCONTEXT_SIGNAL);			\
-  TEST (uc_mcontext.handler, SIGCONTEXT_HANDLER);		\
-  TEST (uc_mcontext.oldmask, SIGCONTEXT_OLDMASK);		\
-  TEST (uc_mcontext.regs, SIGCONTEXT_PT_REGS);			\
-  TEST (uc_mcontext.gp_regs, SIGCONTEXT_GP_REGS);		\
-  TEST (uc_mcontext.fp_regs, SIGCONTEXT_FP_REGS);		\
-  TEST (uc_mcontext.v_regs, SIGCONTEXT_V_REGS_PTR);		\
-  TEST (uc_mcontext.vmx_reserve, SIGCONTEXT_V_RESERVE);
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
new file mode 100644
index 0000000000..a35418d9d4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/ucontext_i.sym
@@ -0,0 +1,50 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+
+-- Offsets of the fields in the powerpc64 ABI stack frame.
+-- XXX Do these correspond to some struct?
+
+FRAME_BACKCHAIN		0
+FRAME_CR_SAVE		8
+FRAME_LR_SAVE		16
+FRAME_COMPILER_DW	24
+FRAME_LINKER_DW		32
+FRAME_TOC_SAVE		40
+FRAME_PARM_SAVE		48
+FRAME_PARM1_SAVE	48
+FRAME_PARM2_SAVE	56
+FRAME_PARM3_SAVE	64
+FRAME_PARM4_SAVE	72
+FRAME_PARM5_SAVE	80
+FRAME_PARM6_SAVE	88
+FRAME_PARM7_SAVE	96
+FRAME_PARM8_SAVE	104
+FRAME_PARM9_SAVE	112
+
+
+-- Offsets of the fields in the ucontext_t structure.
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+UCONTEXT_LINK			ucontext (uc_link)
+UCONTEXT_STACK			ucontext (uc_stack)
+UCONTEXT_STACK_SP		ucontext (uc_stack.ss_sp)
+UCONTEXT_STACK_FLAGS		ucontext (uc_stack.ss_flags)
+UCONTEXT_STACK_SIZE		ucontext (uc_stack.ss_size)
+UCONTEXT_SIGMASK		ucontext (uc_sigmask)
+UCONTEXT_MCONTEXT		ucontext (uc_mcontext)
+SIGCONTEXT_SIGNAL		mcontext (signal)
+SIGCONTEXT_HANDLER		mcontext (handler)
+SIGCONTEXT_OLDMASK		mcontext (oldmask)
+SIGCONTEXT_PT_REGS		mcontext (regs)
+SIGCONTEXT_GP_REGS		mcontext (gp_regs)
+SIGCONTEXT_FP_REGS		mcontext (fp_regs)
+SIGCONTEXT_V_REGS_PTR		mcontext (v_regs)
+SIGCONTEXT_V_RESERVE		mcontext (vmx_reserve)
diff --git a/sysdeps/unix/sysv/linux/s390/Makefile b/sysdeps/unix/sysv/linux/s390/Makefile
index 8d8df743ac..5c5381871b 100644
--- a/sysdeps/unix/sysv/linux/s390/Makefile
+++ b/sysdeps/unix/sysv/linux/s390/Makefile
@@ -2,3 +2,7 @@
 ifeq ($(subdir),rt)
 librt-routines += rt-sysdep
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h
deleted file mode 100644
index 61f018621b..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/ucontext_i.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-   Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Constants shared between setcontext() and getcontext().  Don't
-   install this header file.  */
-
-#define SIG_BLOCK	0
-#define SIG_UNBLOCK	1
-#define SIG_SETMASK	2
-
-#define SC_FLGS 0x000
-#define SC_LINK 0x004
-#define SC_STCK 0x008
-#define SC_STSZ 0x010
-#define SC_PSW  0x018
-#define SC_GPRS 0x020
-#define SC_ACRS 0x060
-#define SC_FPC  0x0A0
-#define SC_FPRS 0x0A8
-#define SC_MASK 0x128
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_flags, SC_FLGS);				\
-  TEST (uc_link, SC_LINK);				\
-  TEST (uc_stack.ss_sp, SC_STCK);			\
-  TEST (uc_stack.ss_size, SC_STSZ);			\
-  TEST (uc_mcontext.psw, SC_PSW);			\
-  TEST (uc_mcontext.gregs, SC_GPRS);			\
-  TEST (uc_mcontext.aregs, SC_ACRS);			\
-  TEST (uc_mcontext.fpregs.fpc, SC_FPC);		\
-  TEST (uc_mcontext.fpregs.fprs, SC_FPRS);		\
-  TEST (uc_sigmask, SC_MASK);
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h b/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
deleted file mode 100644
index 28ef915fc1..0000000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/ucontext_i.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-     Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
-
-   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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* Constants shared between setcontext() and getcontext().  Don't
-   install this header file.  */
-
-#define SIG_BLOCK	0
-#define SIG_UNBLOCK	1
-#define SIG_SETMASK	2
-
-#define SC_FLGS 0x000
-#define SC_LINK 0x008
-#define SC_STCK 0x010
-#define SC_STSZ 0x020
-#define SC_PSW  0x028
-#define SC_GPRS 0x038
-#define SC_ACRS 0x0B8
-#define SC_FPC  0x0F8
-#define SC_FPRS 0x100
-#define SC_MASK 0x180
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_flags, SC_FLGS);				\
-  TEST (uc_link, SC_LINK);				\
-  TEST (uc_stack.ss_sp, SC_STCK);			\
-  TEST (uc_stack.ss_size, SC_STSZ);			\
-  TEST (uc_mcontext.psw, SC_PSW);			\
-  TEST (uc_mcontext.gregs, SC_GPRS);			\
-  TEST (uc_mcontext.aregs, SC_ACRS);			\
-  TEST (uc_mcontext.fpregs.fpc, SC_FPC);		\
-  TEST (uc_mcontext.fpregs.fprs, SC_FPRS);		\
-  TEST (uc_sigmask, SC_MASK);
diff --git a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
new file mode 100644
index 0000000000..525b54300c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
@@ -0,0 +1,23 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_UNBLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+SC_FLGS		ucontext (uc_flags)
+SC_LINK		ucontext (uc_link)
+SC_STCK		ucontext (uc_stack.ss_sp)
+SC_STSZ		ucontext (uc_stack.ss_size)
+SC_PSW		mcontext (psw)
+SC_GPRS		mcontext (gregs)
+SC_ACRS		mcontext (aregs)
+SC_FPC		mcontext (fpregs.fpc)
+SC_FPRS		mcontext (fpregs.fprs)
+SC_MASK		ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sh/Makefile b/sysdeps/unix/sysv/linux/sh/Makefile
index e8544b5dc6..6d72cb0294 100644
--- a/sysdeps/unix/sysv/linux/sh/Makefile
+++ b/sysdeps/unix/sysv/linux/sh/Makefile
@@ -5,3 +5,7 @@ endif
 ifeq ($(subdir),misc)
 sysdep_headers += sys/io.h
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.h b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.h
deleted file mode 100644
index d8483dbe64..0000000000
--- a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2005 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oLINK		4
-#define oSS_SP		8
-#define oSS_SIZE	16
-#define oR0		24
-#define oR1		28
-#define oR2		32
-#define oR3		36
-#define oR4		40
-#define oR5		44
-#define oR6		48
-#define oR7		52
-#define oR8		56
-#define oR9		60
-#define oR10		64
-#define oR11		68
-#define oR12		72
-#define oR13		76
-#define oR14		80
-#define oR15		84
-#define oPC		88
-#define oPR		92
-#define oSR		96
-#define oGBR		100
-#define oMACH		104
-#define oMACL		108
-#define oSIGMASK	112
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_link, oLINK);				\
-  TEST (uc_stack.ss_sp, oSS_SP);			\
-  TEST (uc_stack.ss_size, oSS_SIZE);			\
-  TEST (uc_mcontext.gregs[R0], oR0);			\
-  TEST (uc_mcontext.gregs[R1], oR1);			\
-  TEST (uc_mcontext.gregs[R2], oR2);			\
-  TEST (uc_mcontext.gregs[R3], oR3);			\
-  TEST (uc_mcontext.gregs[R4], oR4);			\
-  TEST (uc_mcontext.gregs[R5], oR5);			\
-  TEST (uc_mcontext.gregs[R6], oR6);			\
-  TEST (uc_mcontext.gregs[R7], oR7);			\
-  TEST (uc_mcontext.gregs[R8], oR8);			\
-  TEST (uc_mcontext.gregs[R9], oR9);			\
-  TEST (uc_mcontext.gregs[R10], oR10);			\
-  TEST (uc_mcontext.gregs[R11], oR11);			\
-  TEST (uc_mcontext.gregs[R12], oR12);			\
-  TEST (uc_mcontext.gregs[R13], oR13);			\
-  TEST (uc_mcontext.gregs[R14], oR14);			\
-  TEST (uc_mcontext.gregs[R15], oR15);			\
-  TEST (uc_mcontext.pc, oPC);				\
-  TEST (uc_mcontext.pr, oPR);				\
-  TEST (uc_mcontext.sr, oSR);				\
-  TEST (uc_mcontext.gbr, oGBR);				\
-  TEST (uc_mcontext.mach, oMACH);			\
-  TEST (uc_mcontext.macl, oMACL);			\
-  TEST (uc_sigmask, oSIGMASK);
diff --git a/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
new file mode 100644
index 0000000000..17397c5511
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh3/ucontext_i.sym
@@ -0,0 +1,38 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oR0		mcontext (gregs[R0])
+oR1		mcontext (gregs[R1])
+oR2		mcontext (gregs[R2])
+oR3		mcontext (gregs[R3])
+oR4		mcontext (gregs[R4])
+oR5		mcontext (gregs[R5])
+oR6		mcontext (gregs[R6])
+oR7		mcontext (gregs[R7])
+oR8		mcontext (gregs[R8])
+oR9		mcontext (gregs[R9])
+oR10		mcontext (gregs[R10])
+oR11		mcontext (gregs[R11])
+oR12		mcontext (gregs[R12])
+oR13		mcontext (gregs[R13])
+oR14		mcontext (gregs[R14])
+oR15		mcontext (gregs[R15])
+oPC		mcontext (pc)
+oPR		mcontext (pr)
+oSR		mcontext (sr)
+oGBR		mcontext (gbr)
+oMACH		mcontext (mach)
+oMACL		mcontext (macl)
+oSIGMASK	ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.h b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.h
deleted file mode 100644
index 88f774f0ad..0000000000
--- a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation.
-   Copyright (C) 2005 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oLINK		4
-#define oSS_SP		8
-#define oSS_SIZE	16
-#define oR0		24
-#define oR1		28
-#define oR2		32
-#define oR3		36
-#define oR4		40
-#define oR5		44
-#define oR6		48
-#define oR7		52
-#define oR8		56
-#define oR9		60
-#define oR10		64
-#define oR11		68
-#define oR12		72
-#define oR13		76
-#define oR14		80
-#define oR15		84
-#define oPC		88
-#define oPR		92
-#define oSR		96
-#define oGBR		100
-#define oMACH		104
-#define oMACL		108
-#define oFR0		112
-#define oFR1		116
-#define oFR2		120
-#define oFR3		124
-#define oFR4		128
-#define oFR5		132
-#define oFR6		136
-#define oFR7		140
-#define oFR8		144
-#define oFR9		148
-#define oFR10		152
-#define oFR11		156
-#define oFR12		160
-#define oFR13		164
-#define oFR14		168
-#define oFR15		172
-#define oXFR0		176
-#define oXFR1		180
-#define oXFR2		184
-#define oXFR3		188
-#define oXFR4		192
-#define oXFR5		196
-#define oXFR6		200
-#define oXFR7		204
-#define oXFR8		208
-#define oXFR9		212
-#define oXFR10		216
-#define oXFR11		220
-#define oXFR12		224
-#define oXFR13		228
-#define oXFR14		232
-#define oXFR15		236
-#define oFPSCR		240
-#define oFPUL		244
-#define oOWNEDFP	248
-#define oSIGMASK	252
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_link, oLINK);				\
-  TEST (uc_stack.ss_sp, oSS_SP);			\
-  TEST (uc_stack.ss_size, oSS_SIZE);			\
-  TEST (uc_mcontext.gregs[R0], oR0);			\
-  TEST (uc_mcontext.gregs[R1], oR1);			\
-  TEST (uc_mcontext.gregs[R2], oR2);			\
-  TEST (uc_mcontext.gregs[R3], oR3);			\
-  TEST (uc_mcontext.gregs[R4], oR4);			\
-  TEST (uc_mcontext.gregs[R5], oR5);			\
-  TEST (uc_mcontext.gregs[R6], oR6);			\
-  TEST (uc_mcontext.gregs[R7], oR7);			\
-  TEST (uc_mcontext.gregs[R8], oR8);			\
-  TEST (uc_mcontext.gregs[R9], oR9);			\
-  TEST (uc_mcontext.gregs[R10], oR10);			\
-  TEST (uc_mcontext.gregs[R11], oR11);			\
-  TEST (uc_mcontext.gregs[R12], oR12);			\
-  TEST (uc_mcontext.gregs[R13], oR13);			\
-  TEST (uc_mcontext.gregs[R14], oR14);			\
-  TEST (uc_mcontext.gregs[R15], oR15);			\
-  TEST (uc_mcontext.pc, oPC);				\
-  TEST (uc_mcontext.pr, oPR);				\
-  TEST (uc_mcontext.sr, oSR);				\
-  TEST (uc_mcontext.gbr, oGBR);				\
-  TEST (uc_mcontext.mach, oMACH);			\
-  TEST (uc_mcontext.macl, oMACL);			\
-  TEST (uc_mcontext.fpregs[0], oFR0);			\
-  TEST (uc_mcontext.fpregs[1], oFR1);			\
-  TEST (uc_mcontext.fpregs[2], oFR2);			\
-  TEST (uc_mcontext.fpregs[3], oFR3);			\
-  TEST (uc_mcontext.fpregs[4], oFR4);			\
-  TEST (uc_mcontext.fpregs[5], oFR5);			\
-  TEST (uc_mcontext.fpregs[6], oFR6);			\
-  TEST (uc_mcontext.fpregs[7], oFR7);			\
-  TEST (uc_mcontext.fpregs[8], oFR8);			\
-  TEST (uc_mcontext.fpregs[9], oFR9);			\
-  TEST (uc_mcontext.fpregs[10], oFR10);			\
-  TEST (uc_mcontext.fpregs[11], oFR11);			\
-  TEST (uc_mcontext.fpregs[12], oFR12);			\
-  TEST (uc_mcontext.fpregs[13], oFR13);			\
-  TEST (uc_mcontext.fpregs[14], oFR14);			\
-  TEST (uc_mcontext.fpregs[15], oFR15);			\
-  TEST (uc_mcontext.xfpregs[0], oXFR0);			\
-  TEST (uc_mcontext.xfpregs[1], oXFR1);			\
-  TEST (uc_mcontext.xfpregs[2], oXFR2);			\
-  TEST (uc_mcontext.xfpregs[3], oXFR3);			\
-  TEST (uc_mcontext.xfpregs[4], oXFR4);			\
-  TEST (uc_mcontext.xfpregs[5], oXFR5);			\
-  TEST (uc_mcontext.xfpregs[6], oXFR6);			\
-  TEST (uc_mcontext.xfpregs[7], oXFR7);			\
-  TEST (uc_mcontext.xfpregs[8], oXFR8);			\
-  TEST (uc_mcontext.xfpregs[9], oXFR9);			\
-  TEST (uc_mcontext.xfpregs[10], oXFR10);		\
-  TEST (uc_mcontext.xfpregs[11], oXFR11);		\
-  TEST (uc_mcontext.xfpregs[12], oXFR12);		\
-  TEST (uc_mcontext.xfpregs[13], oXFR13);		\
-  TEST (uc_mcontext.xfpregs[14], oXFR14);		\
-  TEST (uc_mcontext.xfpregs[15], oXFR15);		\
-  TEST (uc_mcontext.fpscr, oFPSCR);			\
-  TEST (uc_mcontext.fpul, oFPUL);			\
-  TEST (uc_mcontext.ownedfp, oOWNEDFP);			\
-  TEST (uc_sigmask, oSIGMASK);
diff --git a/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
new file mode 100644
index 0000000000..65633fbcf4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym
@@ -0,0 +1,73 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+
+oLINK		ucontext (uc_link)
+oSS_SP		ucontext (uc_stack.ss_sp)
+oSS_SIZE	ucontext (uc_stack.ss_size)
+oR0		mcontext (gregs[R0])
+oR1		mcontext (gregs[R1])
+oR2		mcontext (gregs[R2])
+oR3		mcontext (gregs[R3])
+oR4		mcontext (gregs[R4])
+oR5		mcontext (gregs[R5])
+oR6		mcontext (gregs[R6])
+oR7		mcontext (gregs[R7])
+oR8		mcontext (gregs[R8])
+oR9		mcontext (gregs[R9])
+oR10		mcontext (gregs[R10])
+oR11		mcontext (gregs[R11])
+oR12		mcontext (gregs[R12])
+oR13		mcontext (gregs[R13])
+oR14		mcontext (gregs[R14])
+oR15		mcontext (gregs[R15])
+oPC		mcontext (pc)
+oPR		mcontext (pr)
+oSR		mcontext (sr)
+oGBR		mcontext (gbr)
+oMACH		mcontext (mach)
+oMACL		mcontext (macl)
+oFR0		mcontext (fpregs[0])
+oFR1		mcontext (fpregs[1])
+oFR2		mcontext (fpregs[2])
+oFR3		mcontext (fpregs[3])
+oFR4		mcontext (fpregs[4])
+oFR5		mcontext (fpregs[5])
+oFR6		mcontext (fpregs[6])
+oFR7		mcontext (fpregs[7])
+oFR8		mcontext (fpregs[8])
+oFR9		mcontext (fpregs[9])
+oFR10		mcontext (fpregs[10])
+oFR11		mcontext (fpregs[11])
+oFR12		mcontext (fpregs[12])
+oFR13		mcontext (fpregs[13])
+oFR14		mcontext (fpregs[14])
+oFR15		mcontext (fpregs[15])
+oXFR0		mcontext (xfpregs[0])
+oXFR1		mcontext (xfpregs[1])
+oXFR2		mcontext (xfpregs[2])
+oXFR3		mcontext (xfpregs[3])
+oXFR4		mcontext (xfpregs[4])
+oXFR5		mcontext (xfpregs[5])
+oXFR6		mcontext (xfpregs[6])
+oXFR7		mcontext (xfpregs[7])
+oXFR8		mcontext (xfpregs[8])
+oXFR9		mcontext (xfpregs[9])
+oXFR10		mcontext (xfpregs[10])
+oXFR11		mcontext (xfpregs[11])
+oXFR12		mcontext (xfpregs[12])
+oXFR13		mcontext (xfpregs[13])
+oXFR14		mcontext (xfpregs[14])
+oXFR15		mcontext (xfpregs[15])
+oFPSCR		mcontext (fpscr)
+oFPUL		mcontext (fpul)
+oOWNEDFP	mcontext (ownedfp)
+oSIGMASK	ucontext (uc_sigmask)
diff --git a/sysdeps/unix/sysv/linux/x86_64/Makefile b/sysdeps/unix/sysv/linux/x86_64/Makefile
index 627275db09..0f20367236 100644
--- a/sysdeps/unix/sysv/linux/x86_64/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/Makefile
@@ -9,3 +9,7 @@ endif
 ifeq ($(subdir),stdlib)
 sysdep_routines += __start_context
 endif
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h
deleted file mode 100644
index e5099084cf..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Offsets and other constants needed in the *context() function
-   implementation for Linux/x86-64.
-   Copyright (C) 2002, 2005 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, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#define SIG_BLOCK	0
-#define SIG_SETMASK	2
-
-/* Since we cannot include a header to define _NSIG/8, we define it
-   here.  */
-#define _NSIG8		8
-
-/* Offsets of the fields in the ucontext_t structure.  */
-#define oRBP		120
-#define oRSP		160
-#define oRBX		128
-#define oR8		40
-#define oR9		48
-#define oR12		72
-#define oR13		80
-#define oR14		88
-#define oR15		96
-#define oRDI		104
-#define oRSI		112
-#define oRDX		136
-#define oRAX		144
-#define oRCX		152
-#define oRIP		168
-#define oFPREGS		224
-#define oSIGMASK	296
-#define oFPREGSMEM	424
-#define oMXCSR		448
-
-/* Tests run in stdlib/tst-ucontext-off.  */
-#define TESTS \
-  TEST (uc_mcontext.gregs[REG_RBP], oRBP);				\
-  TEST (uc_mcontext.gregs[REG_RSP], oRSP);				\
-  TEST (uc_mcontext.gregs[REG_RBX], oRBX);				\
-  TEST (uc_mcontext.gregs[REG_R8], oR8);				\
-  TEST (uc_mcontext.gregs[REG_R9], oR9);				\
-  TEST (uc_mcontext.gregs[REG_R12], oR12);				\
-  TEST (uc_mcontext.gregs[REG_R13], oR13);				\
-  TEST (uc_mcontext.gregs[REG_R14], oR14);				\
-  TEST (uc_mcontext.gregs[REG_R15], oR15);				\
-  TEST (uc_mcontext.gregs[REG_RDI], oRDI);				\
-  TEST (uc_mcontext.gregs[REG_RSI], oRSI);				\
-  TEST (uc_mcontext.gregs[REG_RDX], oRDX);				\
-  TEST (uc_mcontext.gregs[REG_RAX], oRAX);				\
-  TEST (uc_mcontext.gregs[REG_RCX], oRCX);				\
-  TEST (uc_mcontext.gregs[REG_RIP], oRIP);				\
-  TEST (uc_mcontext.fpregs, oFPREGS);					\
-  TEST (uc_sigmask, oSIGMASK);						\
-  TEST (__fpregs_mem, oFPREGSMEM);					\
-  TEST (__fpregs_mem.mxcsr, oMXCSR);
diff --git a/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
new file mode 100644
index 0000000000..b3cfe9aa4c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/ucontext_i.sym
@@ -0,0 +1,34 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys/ucontext.h>
+
+--
+
+SIG_BLOCK
+SIG_SETMASK
+
+_NSIG8		(_NSIG / 8)
+
+#define ucontext(member)	offsetof (ucontext_t, member)
+#define mcontext(member)	ucontext (uc_mcontext.member)
+#define mreg(reg)		mcontext (gregs[REG_##reg])
+
+oRBP		mreg (RBP)
+oRSP		mreg (RSP)
+oRBX		mreg (RBX)
+oR8		mreg (R8)
+oR9		mreg (R9)
+oR12		mreg (R12)
+oR13		mreg (R13)
+oR14		mreg (R14)
+oR15		mreg (R15)
+oRDI		mreg (RDI)
+oRSI		mreg (RSI)
+oRDX		mreg (RDX)
+oRAX		mreg (RAX)
+oRCX		mreg (RCX)
+oRIP		mreg (RIP)
+oFPREGS		mcontext (fpregs)
+oSIGMASK	ucontext (uc_sigmask)
+oFPREGSMEM	ucontext (__fpregs_mem)
+oMXCSR		ucontext (__fpregs_mem.mxcsr)