1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/2.3.5/pr758.patch Wed May 23 21:08:24 2007 +0000
1.3 @@ -0,0 +1,256 @@
1.4 +See http://sources.redhat.com/bugzilla/show_bug.cgi?id=758
1.5 +
1.6 +Submitted By: Jim Gifford (patches at jg555 dot com)
1.7 +Date: 2005-02-23
1.8 +Initial Package Version: 2.3.4
1.9 +Origin: Richard Sandiford
1.10 +Upstream Status: Unknown
1.11 +Description: Fixes Syscall.h generation
1.12 +
1.13 +diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/Makefile glibc-2.3.4/sysdeps/unix/sysv/linux/mips/Makefile
1.14 +--- glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/Makefile 2004-11-24 04:38:15 +0000
1.15 ++++ glibc-2.3.4/sysdeps/unix/sysv/linux/mips/Makefile 2005-02-23 18:21:54 +0000
1.16 +@@ -9,11 +9,73 @@
1.17 +
1.18 + no_syscall_list_h = 1
1.19 +
1.20 +-# Generate the list of SYS_* macros for the system calls (__NR_* macros).
1.21 +-# We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
1.22 +-# it exists, but also define SYS_<abi>_<syscall> for all ABIs.
1.23 ++# A callable macro that expands to a shell command. Preprocess file $(1)
1.24 ++# using ABI option $(2) and see which macros it defines. Print FOO for each
1.25 ++# macro of the form __NR$(3)_FOO, filtering out ABI-specific __NR macros
1.26 ++# that have a prefix other than $(3).
1.27 ++mips_list_syscalls = $(filter-out -m%,$(CC)) -E -x c $(+includes) \
1.28 ++ $(sysincludes) -D_LIBC -dM -mabi=$(2) $(1) | \
1.29 ++ sed -n 's@^\#define __NR$(3)_\([^ ]*\) .*@\1@p' | \
1.30 ++ sed -e '/^[ON]32_/d' -e '/^N64_/d' -e '/^64_/d' | \
1.31 ++ LC_ALL=C sort
1.32 ++
1.33 ++# Generate a list of SYS_* macros from the linux __NR macros.
1.34 ++#
1.35 ++# Before version 2.6, linux had separate 32-bit and 64-bit MIPS ports,
1.36 ++# each with its own set of headers. The ports were merged for 2.6 and
1.37 ++# this merged port defines the syscalls in a slightly different way.
1.38 ++# There are therefore three sets of headers that we need to consider:
1.39 ++#
1.40 ++# (1) Headers from the separate 32-bit MIPS port. They just define
1.41 ++# a single list of __NR macros.
1.42 ++#
1.43 ++# (2) Headers from the separate 64-bit MIPS port. They unconditionally
1.44 ++# define syscalls for all three ABIs, with o32 syscalls prefixed
1.45 ++# by __NR_O32, n32 syscalls prefixed by __NR_N32 and n64 syscalls
1.46 ++# prefixed by plain __NR.
1.47 ++#
1.48 ++# (3) Headers from the combined port. They use the _MIPS_SIM macro to
1.49 ++# define the right set of syscalls for the current ABI. The syscalls
1.50 ++# themselves have no special ABI prefix, but the headers also define:
1.51 ++#
1.52 ++# __NR_O32_Linux{,_syscalls}
1.53 ++# __NR_N32_Linux{,_syscalls}
1.54 ++# __NR_64_Linux{,_syscalls}
1.55 ++#
1.56 ++# In case (1) we just want a simple list of SYS_* macros. In cases (2)
1.57 ++# and (3) we want a file that will work for all three ABIs, regardless
1.58 ++# of which ABI we are currently using. We also want the file to work
1.59 ++# if the user later moves from (2) to (3). Thus the file we create
1.60 ++# for (2) and (3) has the form:
1.61 ++#
1.62 ++# #if _MIPS_SIM == _MIPS_SIM_NABI32
1.63 ++# # ifdef __NR_N32_open
1.64 ++# # define SYS_n32syscall1 __NR_N32_n32syscall1
1.65 ++# # ...
1.66 ++# # else
1.67 ++# # define SYS_n32syscall1 __NR_n32syscall1
1.68 ++# # ...
1.69 ++# # endif
1.70 ++# #elif _MIPS_SIM == _MIPS_SIM_ABI64
1.71 ++# # define SYS_n64syscall1 __NR_n64syscall1
1.72 ++# # ...
1.73 ++# #else
1.74 ++# # ifdef __NR_O32_open
1.75 ++# # define SYS_o32syscall1 __NR_O32_o32syscall1
1.76 ++# # ...
1.77 ++# # else
1.78 ++# # define SYS_o32syscall1 __NR_o32syscall1
1.79 ++# # ...
1.80 ++# # endif
1.81 ++# #endif
1.82 ++#
1.83 ++# Here, __NR_N32_open and __NR_O32_open are used to detect case (2)
1.84 ++# over case (3). The n64 SYS_* macros can always use the normal
1.85 ++# ABI-less names.
1.86 + $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h
1.87 + $(make-target-directory)
1.88 ++ $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC $< -MD -MP \
1.89 ++ -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' > /dev/null
1.90 + { \
1.91 + echo '/* Generated at libc build time from kernel syscall list. */';\
1.92 + echo ''; \
1.93 +@@ -22,28 +84,38 @@
1.94 + echo '#endif'; \
1.95 + echo ''; \
1.96 + echo '#include <sgidefs.h>'; \
1.97 +- rm -f $(@:.d=.h).newt; \
1.98 +- $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
1.99 +- -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \
1.100 +- sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
1.101 +- > $(@:.d=.h).newt; \
1.102 +- if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
1.103 ++ rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \
1.104 ++ $(call mips_list_syscalls,$<,n32,_N32) > $(@:.d=.h).newn32; \
1.105 ++ if test -s $(@:.d=.h).newn32; then \
1.106 ++ if grep open $(@:.d=.h).newn32 > /dev/null; then \
1.107 ++ $(call mips_list_syscalls,$<,32,_O32) > $(@:.d=.h).new32; \
1.108 ++ $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \
1.109 ++ else \
1.110 ++ $(call mips_list_syscalls,$<,32,) > $(@:.d=.h).new32; \
1.111 ++ $(call mips_list_syscalls,$<,n32,) > $(@:.d=.h).newn32; \
1.112 ++ $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \
1.113 ++ fi; \
1.114 + echo '#if _MIPS_SIM == _ABIN32'; \
1.115 +- sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
1.116 +- LC_ALL=C sort; \
1.117 ++ echo '# ifdef __NR_N32_open'; \
1.118 ++ sed 's@\(.*\)@# define SYS_\1 __NR_N32_\1@' < $(@:.d=.h).newn32; \
1.119 ++ echo '# else'; \
1.120 ++ sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).newn32; \
1.121 ++ echo '# endif'; \
1.122 + echo '#elif _MIPS_SIM == _ABI64'; \
1.123 +- sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
1.124 +- LC_ALL=C sort; \
1.125 ++ sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new64; \
1.126 + echo '#else'; \
1.127 +- sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \
1.128 +- LC_ALL=C sort; \
1.129 ++ echo '# ifdef __NR_O32_open'; \
1.130 ++ sed 's@\(.*\)@# define SYS_\1 __NR_O32_\1@' < $(@:.d=.h).new32; \
1.131 ++ echo '# else'; \
1.132 ++ sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new32; \
1.133 ++ echo '# endif'; \
1.134 + echo '#endif'; \
1.135 +- sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \
1.136 +- LC_ALL=C sort +1.8; \
1.137 + else \
1.138 +- cat $(@:.d=.h).newt; \
1.139 ++ $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC -dM $< | \
1.140 ++ sed -n 's@^\#define __NR_\([^ ]*\) .*@\#define SYS_\1 __NR_\1@p' | \
1.141 ++ LC_ALL=C sort; \
1.142 + fi; \
1.143 +- rm $(@:.d=.h).newt; \
1.144 ++ rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \
1.145 + } > $(@:.d=.h).new
1.146 + mv -f $(@:.d=.h).new $(@:.d=.h)
1.147 + ifneq (,$(objpfx))
1.148 +diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/configure glibc-2.3.4/sysdeps/unix/sysv/linux/mips/configure
1.149 +--- glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/configure 2004-11-24 04:42:45 +0000
1.150 ++++ glibc-2.3.4/sysdeps/unix/sysv/linux/mips/configure 2005-02-23 18:10:11 +0000
1.151 +@@ -18,7 +18,7 @@
1.152 + { echo "$as_me:$LINENO: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&5
1.153 + echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;}
1.154 + echo '#include <asm/unistd.h>' > asm-unistd.h
1.155 +- else
1.156 ++ elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then
1.157 + # The point of this preprocessing is to turn __NR_<syscall> into
1.158 + # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
1.159 + # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
1.160 +@@ -68,6 +68,8 @@
1.161 + {
1.162 + print;
1.163 + }'
1.164 ++ else
1.165 ++ echo '#include <asm/unistd.h>' > asm-unistd.h
1.166 + fi ;;
1.167 + mips*)
1.168 + rm -f asm-unistd.h
1.169 +diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/configure.in glibc-2.3.4/sysdeps/unix/sysv/linux/mips/configure.in
1.170 +--- glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/configure.in 2004-11-24 04:38:31 +0000
1.171 ++++ glibc-2.3.4/sysdeps/unix/sysv/linux/mips/configure.in 2005-02-23 18:10:11 +0000
1.172 +@@ -18,7 +18,7 @@
1.173 + if test ! -f "$asm_unistd_h"; then
1.174 + AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed])
1.175 + echo '#include <asm/unistd.h>' > asm-unistd.h
1.176 +- else
1.177 ++ elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then
1.178 + # The point of this preprocessing is to turn __NR_<syscall> into
1.179 + # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
1.180 + # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
1.181 +@@ -68,6 +68,8 @@
1.182 + {
1.183 + print;
1.184 + }'
1.185 ++ else
1.186 ++ echo '#include <asm/unistd.h>' > asm-unistd.h
1.187 + fi ;;
1.188 + mips*)
1.189 + rm -f asm-unistd.h
1.190 +diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h glibc-2.3.4/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h
1.191 +--- glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h 2003-03-29 08:15:29 +0000
1.192 ++++ glibc-2.3.4/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h 2005-02-23 18:10:11 +0000
1.193 +@@ -1,36 +0,0 @@
1.194 +-/* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
1.195 +- This file is part of the GNU C Library.
1.196 +-
1.197 +- The GNU C Library is free software; you can redistribute it and/or
1.198 +- modify it under the terms of the GNU Lesser General Public
1.199 +- License as published by the Free Software Foundation; either
1.200 +- version 2.1 of the License, or (at your option) any later version.
1.201 +-
1.202 +- The GNU C Library is distributed in the hope that it will be useful,
1.203 +- but WITHOUT ANY WARRANTY; without even the implied warranty of
1.204 +- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.205 +- Lesser General Public License for more details.
1.206 +-
1.207 +- You should have received a copy of the GNU Lesser General Public
1.208 +- License along with the GNU C Library; if not, write to the Free
1.209 +- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1.210 +- 02111-1307 USA. */
1.211 +-
1.212 +-#ifndef _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H
1.213 +-#define _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H 1
1.214 +-
1.215 +-/* There is some commonality. */
1.216 +-#include <sysdeps/unix/sysv/linux/mips/mips32/sysdep.h>
1.217 +-
1.218 +-/* For Linux we can use the system call table in the header file
1.219 +- /usr/include/asm/unistd.h
1.220 +- of the kernel. But these symbols do not follow the SYS_* syntax
1.221 +- so we have to redefine the `SYS_ify' macro here. */
1.222 +-#undef SYS_ify
1.223 +-#ifdef __STDC__
1.224 +-# define SYS_ify(syscall_name) __NR_O32_##syscall_name
1.225 +-#else
1.226 +-# define SYS_ify(syscall_name) __NR_O32_/**/syscall_name
1.227 +-#endif
1.228 +-
1.229 +-#endif /* linux/mips/mips32/kern64/sysdep.h */
1.230 +diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h glibc-2.3.4/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h
1.231 +--- glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h 2004-10-18 05:16:07 +0000
1.232 ++++ glibc-2.3.4/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h 2005-02-23 18:10:11 +0000
1.233 +@@ -28,9 +28,9 @@
1.234 + so we have to redefine the `SYS_ify' macro here. */
1.235 + #undef SYS_ify
1.236 + #ifdef __STDC__
1.237 +-# define SYS_ify(syscall_name) __NR_N32_##syscall_name
1.238 ++# define SYS_ify(syscall_name) __NR_##syscall_name
1.239 + #else
1.240 +-# define SYS_ify(syscall_name) __NR_N32_/**/syscall_name
1.241 ++# define SYS_ify(syscall_name) __NR_/**/syscall_name
1.242 + #endif
1.243 +
1.244 + #ifdef __ASSEMBLER__
1.245 +diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h glibc-2.3.4/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h
1.246 +--- glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h 2004-10-18 05:16:08 +0000
1.247 ++++ glibc-2.3.4/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h 2005-02-23 18:10:11 +0000
1.248 +@@ -28,9 +28,9 @@
1.249 + so we have to redefine the `SYS_ify' macro here. */
1.250 + #undef SYS_ify
1.251 + #ifdef __STDC__
1.252 +-# define SYS_ify(syscall_name) __NR_N64_##syscall_name
1.253 ++# define SYS_ify(syscall_name) __NR_##syscall_name
1.254 + #else
1.255 +-# define SYS_ify(syscall_name) __NR_N64_/**/syscall_name
1.256 ++# define SYS_ify(syscall_name) __NR_/**/syscall_name
1.257 + #endif
1.258 +
1.259 + #ifdef __ASSEMBLER__