diff options
| author | Roland McGrath <roland@gnu.org> | 2005-12-22 05:18:34 +0000 |
|---|---|---|
| committer | Roland McGrath <roland@gnu.org> | 2005-12-22 05:18:34 +0000 |
| commit | 0c7c6d531f8514aaee236ab1388ed88c1c31a630 (patch) | |
| tree | a049c3500bba177e7567307645d3eb0442fc4bd7 | |
| parent | c72565e5f1124c2dc72573e83406fe999e56091f (diff) | |
| download | glibc-0c7c6d531f8514aaee236ab1388ed88c1c31a630.tar.xz glibc-0c7c6d531f8514aaee236ab1388ed88c1c31a630.zip | |
* 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.
25 files changed, 366 insertions, 634 deletions
@@ -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 @@ -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 -#de |
