From 25bb26d0e80e25d9612bac0c7307122e6b4c4201 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 22 Dec 2011 18:30:43 +0000 Subject: [PATCH] Fix bits/syscall.h generation for MIPS using generic code. --- ChangeLog.mips | 14 ++++ sysdeps/unix/sysv/linux/mips/Makefile | 126 ++--------------------------- sysdeps/unix/sysv/linux/mips/configure | 76 ----------------- sysdeps/unix/sysv/linux/mips/configure.in | 75 ----------------- sysdeps/unix/sysv/linux/mips/sys/syscall.h | 42 ---------- 5 files changed, 22 insertions(+), 311 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/mips/sys/syscall.h diff --git a/ChangeLog.mips b/ChangeLog.mips index 2779bed..8e60fb2 100644 --- a/ChangeLog.mips +++ b/ChangeLog.mips @@ -1,5 +1,19 @@ 2011-12-22 Joseph Myers + * sysdeps/unix/sysv/linux/mips/Makefile (no_syscall_list_h) + (mips_list_syscalls, $(objpfx)syscall-%.h $(objpfx)syscall-%.d): + Remove. + (syscall-list-variants, syscall-list-includes) + (syscall-list-o32-options, syscall-list-o32-condition) + (syscall-list-n32-options, syscall-list-n32-condition) + (syscall-list-n64-options, syscall-list-n64-condition): Define. + * sysdeps/unix/sysv/linux/mips/configure.in: Don't generate + asm-unistd.h. + * sysdeps/unix/sysv/linux/mips/configure: Regenerate. + * sysdeps/unix/sysv/linux/mips/sys/syscall.h: Remove. + +2011-12-22 Joseph Myers + [BZ #13538] * sysdeps/unix/sysv/linux/mips/sys/epoll.h (EPOLLONESHOT) (EPOLLET): Initialize with unsigned values. diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile index cff3484..41e9258 100644 --- a/sysdeps/unix/sysv/linux/mips/Makefile +++ b/sysdeps/unix/sysv/linux/mips/Makefile @@ -7,124 +7,14 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h -no_syscall_list_h = 1 - -# A callable macro that expands to a shell command. Preprocess file $(1) -# using ABI option $(2) and see which macros it defines. Print FOO for each -# macro of the form __NR$(3)_FOO, filtering out ABI-specific __NR macros -# that have a prefix other than $(3). -mips_list_syscalls = $(filter-out -m%,$(CC)) -E -x c $(+includes) \ - $(sysincludes) -D_LIBC -dM -mabi=$(2) $(1) | \ - sed -n 's@^\#define __NR$(3)_\([^ ]*\) .*@\1@p' | \ - sed -e '/^[ON]32_/d' -e '/^N64_/d' -e '/^64_/d' | \ - LC_ALL=C sort - -# Generate a list of SYS_* macros from the linux __NR macros. -# -# Before version 2.6, linux had separate 32-bit and 64-bit MIPS ports, -# each with its own set of headers. The ports were merged for 2.6 and -# this merged port defines the syscalls in a slightly different way. -# There are therefore three sets of headers that we need to consider: -# -# (1) Headers from the separate 32-bit MIPS port. They just define -# a single list of __NR macros. -# -# (2) Headers from the separate 64-bit MIPS port. They unconditionally -# define syscalls for all three ABIs, with o32 syscalls prefixed -# by __NR_O32, n32 syscalls prefixed by __NR_N32 and n64 syscalls -# prefixed by plain __NR. -# -# (3) Headers from the combined port. They use the _MIPS_SIM macro to -# define the right set of syscalls for the current ABI. The syscalls -# themselves have no special ABI prefix, but the headers also define: -# -# __NR_O32_Linux{,_syscalls} -# __NR_N32_Linux{,_syscalls} -# __NR_64_Linux{,_syscalls} -# -# In case (1) we just want a simple list of SYS_* macros. In cases (2) -# and (3) we want a file that will work for all three ABIs, regardless -# of which ABI we are currently using. We also want the file to work -# if the user later moves from (2) to (3). Thus the file we create -# for (2) and (3) has the form: -# -# #if _MIPS_SIM == _ABIN32 -# # ifdef __NR_N32_open -# # define SYS_n32syscall1 __NR_N32_n32syscall1 -# # ... -# # else -# # define SYS_n32syscall1 __NR_n32syscall1 -# # ... -# # endif -# #elif _MIPS_SIM == _ABI64 -# # define SYS_n64syscall1 __NR_n64syscall1 -# # ... -# #else -# # ifdef __NR_O32_open -# # define SYS_o32syscall1 __NR_O32_o32syscall1 -# # ... -# # else -# # define SYS_o32syscall1 __NR_o32syscall1 -# # ... -# # endif -# #endif -# -# Here, __NR_N32_open and __NR_O32_open are used to detect case (2) -# over case (3). The n64 SYS_* macros can always use the normal -# ABI-less names. -$(objpfx)syscall-%.h $(objpfx)syscall-%.d: $(firstword $(wildcard $(sysdirs:=/sys/syscall.h))) - $(make-target-directory) - $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC $< -MD -MP \ - -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' > /dev/null - { \ - echo '/* Generated at libc build time from kernel syscall list. */';\ - echo ''; \ - echo '#ifndef _SYSCALL_H'; \ - echo '# error "Never use directly; include instead."'; \ - echo '#endif'; \ - echo ''; \ - echo '#include '; \ - rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \ - $(call mips_list_syscalls,$<,n32,_N32) > $(@:.d=.h).newn32; \ - if test -s $(@:.d=.h).newn32; then \ - if grep open $(@:.d=.h).newn32 > /dev/null; then \ - $(call mips_list_syscalls,$<,32,_O32) > $(@:.d=.h).new32; \ - $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \ - else \ - $(call mips_list_syscalls,$<,32,) > $(@:.d=.h).new32; \ - $(call mips_list_syscalls,$<,n32,) > $(@:.d=.h).newn32; \ - $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \ - fi; \ - echo '#if _MIPS_SIM == _ABIN32'; \ - echo '# ifdef __NR_N32_open'; \ - sed 's@\(.*\)@# define SYS_\1 __NR_N32_\1@' < $(@:.d=.h).newn32; \ - echo '# else'; \ - sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).newn32; \ - echo '# endif'; \ - echo '#elif _MIPS_SIM == _ABI64'; \ - sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new64; \ - echo '#else'; \ - echo '# ifdef __NR_O32_open'; \ - sed 's@\(.*\)@# define SYS_\1 __NR_O32_\1@' < $(@:.d=.h).new32; \ - echo '# else'; \ - sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new32; \ - echo '# endif'; \ - echo '#endif'; \ - else \ - $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC -dM $< | \ - sed -n 's@^\#define __NR_\([^ ]*\) .*@\#define SYS_\1 __NR_\1@p' | \ - LC_ALL=C sort; \ - fi; \ - rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \ - } > $(@:.d=.h).new - mv -f $(@:.d=.h).new $(@:.d=.h) -ifneq (,$(objpfx)) - sed $(sed-remove-objpfx) $(@:.h=.d)-t > $(@:.h=.d)-t2 - rm -f $(@:.h=.d)-t - mv -f $(@:.h=.d)-t2 $(@:.h=.d) -else - mv -f $(@:.h=.d)-t $(@:.h=.d) -endif +syscall-list-variants := o32 n32 n64 +syscall-list-includes := sgidefs.h +syscall-list-o32-options := -mabi=32 +syscall-list-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32 +syscall-list-n32-options := -mabi=n32 +syscall-list-n32-condition := _MIPS_SIM == _MIPS_SIM_ABIN32 +syscall-list-n64-options := -mabi=64 +syscall-list-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64 endif ifeq ($(subdir),elf) diff --git a/sysdeps/unix/sysv/linux/mips/configure b/sysdeps/unix/sysv/linux/mips/configure index 2233f6f..d8f1304 100644 --- a/sysdeps/unix/sysv/linux/mips/configure +++ b/sysdeps/unix/sysv/linux/mips/configure @@ -1,82 +1,6 @@ # This file is generated from configure.in by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/unix/sysv/linux/mips. -case $machine in -mips*64*) - rm -f asm-unistd.h - asm_unistd_h=$sysheaders/asm/unistd.h - if test ! -f $asm_unistd_h; then - # Try to find asm/unistd.h in compiler header search path. - try_asm_unistd_h=`echo '#include ' | $CPP - | - sed -n '/^# 1 "\(\/[^"]*\)".*/{s,,\1,p;q;}'` - if test -n "$try_asm_unistd_h" && - test -f "$try_asm_unistd_h"; then - asm_unistd_h=$try_asm_unistd_h - fi - fi - if test ! -f "$asm_unistd_h"; then - { echo "$as_me:$LINENO: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&5 -echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;} - echo '#include ' > asm-unistd.h - elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then - # The point of this preprocessing is to turn __NR_ into - # __NR_N64_, as well as to define __NR_ to - # __NR__, if __NR__ is defined - # and is the compiler-enabled ABI. - cat "$asm_unistd_h" | - sed -e 's,__NR_,__NR_N64_,g' \ - -e 's,__NR_N64_##,__NR_##,g' \ - -e 's,__NR_N64_O32_,__NR_O32_,g' \ - -e 's,__NR_N64_N32_,__NR_N32_,g' \ - -e 's,__NR_N64_N64_,__NR_N64_,g' \ - | awk > asm-unistd.h ' -BEGIN { print "#include "; } -/^#define __NR.*unused/ { print; next; } -/^#define __NR_N64__exit __NR_N64_exit/ { - print "#define __NR__exit __NR_exit"; - print "#define __NR_O32__exit __NR_O32_exit"; - print "#define __NR_N32__exit __NR_N32_exit"; - print; next; -} -/^#define __NR_O32_/ { - name = $2; - sub (/_O32_/, "_", name); - print; - print "#if _MIPS_SIM == _ABIO32"; - print "# define " name " " $2; - print "#endif"; - next; -} -/^#define __NR_N32_/ { - name = $2; - sub (/_N32_/, "_", name); - print; - print "#if _MIPS_SIM == _ABIN32"; - print "# define " name " " $2; - print "#endif"; - next; -} -/^#define __NR_N64_/ { - name = $2; - sub (/_N64_/, "_", name); - print; - print "#if _MIPS_SIM == _ABI64"; - print "# define " name " " $2; - print "#endif"; - next; -} -{ - print; -}' - else - echo '#include ' > asm-unistd.h - fi ;; -mips*) - rm -f asm-unistd.h - echo '#include ' > asm-unistd.h - ;; -esac - case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. diff --git a/sysdeps/unix/sysv/linux/mips/configure.in b/sysdeps/unix/sysv/linux/mips/configure.in index c2e66ed..4871382 100644 --- a/sysdeps/unix/sysv/linux/mips/configure.in +++ b/sysdeps/unix/sysv/linux/mips/configure.in @@ -2,81 +2,6 @@ sinclude(./aclocal.m4)dnl Autoconf lossage GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/unix/sysv/linux/mips. -case $machine in -mips*64*) - rm -f asm-unistd.h - asm_unistd_h=$sysheaders/asm/unistd.h - if test ! -f $asm_unistd_h; then - # Try to find asm/unistd.h in compiler header search path. - try_asm_unistd_h=`echo '#include ' | $CPP - | - sed -n '/^# 1 "\(\/[^"]*\)".*/{s,,\1,p;q;}'` - if test -n "$try_asm_unistd_h" && - test -f "$try_asm_unistd_h"; then - asm_unistd_h=$try_asm_unistd_h - fi - fi - if test ! -f "$asm_unistd_h"; then - AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed]) - echo '#include ' > asm-unistd.h - elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then - # The point of this preprocessing is to turn __NR_ into - # __NR_N64_, as well as to define __NR_ to - # __NR__, if __NR__ is defined - # and is the compiler-enabled ABI. - cat "$asm_unistd_h" | - sed -e 's,__NR_,__NR_N64_,g' \ - -e 's,__NR_N64_##,__NR_##,g' \ - -e 's,__NR_N64_O32_,__NR_O32_,g' \ - -e 's,__NR_N64_N32_,__NR_N32_,g' \ - -e 's,__NR_N64_N64_,__NR_N64_,g' \ - | awk > asm-unistd.h ' -BEGIN { print "#include "; } -/^#define __NR.*unused/ { print; next; } -/^#define __NR_N64__exit __NR_N64_exit/ { - print "#define __NR__exit __NR_exit"; - print "#define __NR_O32__exit __NR_O32_exit"; - print "#define __NR_N32__exit __NR_N32_exit"; - print; next; -} -/^#define __NR_O32_/ { - name = $2; - sub (/_O32_/, "_", name); - print; - print "#if _MIPS_SIM == _ABIO32"; - print "# define " name " " $2; - print "#endif"; - next; -} -/^#define __NR_N32_/ { - name = $2; - sub (/_N32_/, "_", name); - print; - print "#if _MIPS_SIM == _ABIN32"; - print "# define " name " " $2; - print "#endif"; - next; -} -/^#define __NR_N64_/ { - name = $2; - sub (/_N64_/, "_", name); - print; - print "#if _MIPS_SIM == _ABI64"; - print "# define " name " " $2; - print "#endif"; - next; -} -{ - print; -}' - else - echo '#include ' > asm-unistd.h - fi ;; -mips*) - rm -f asm-unistd.h - echo '#include ' > asm-unistd.h - ;; -esac - case "$prefix" in /usr | /usr/) # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib. diff --git a/sysdeps/unix/sysv/linux/mips/sys/syscall.h b/sysdeps/unix/sysv/linux/mips/sys/syscall.h deleted file mode 100644 index f6458cd..0000000 --- a/sysdeps/unix/sysv/linux/mips/sys/syscall.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1995, 1996, 1997, 2003 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. */ - -#ifndef _SYSCALL_H -#define _SYSCALL_H 1 - -/* This file should list the numbers of the system the system knows. - But instead of duplicating this we use the information available - from the kernel sources. */ -#ifdef _LIBC -/* Since the kernel doesn't define macro names in a way usable for - glibc, we preprocess this header, and use it during the glibc build - process. */ -# include -#else -# include -#endif - -#ifndef _LIBC -/* The Linux kernel header file defines macros `__NR_', but some - programs expect the traditional form `SYS_'. So in building libc - we scan the kernel's list and produce with macros for - all the `SYS_' names. */ -# include -#endif - -#endif -- 2.7.4