On Mon, Jan 19, 2004 at 04:20:12PM +0100, Guido Guenther wrote:
> rebuilding to check everything get's generated fine correctly.
> asm-unistd.h looks o.k. now, syscall.h isn't build yet.
I generated syscall-list.h by doing make -C subdir_lib. It looks fine, a
final version of the dpatch is attached, please apply. The full build
including tests will take about 30 more hours, so I'd say let's go
ahead... 
Many thanks Dan,
 -- Guido
#! /bin/sh -e

# All lines beginning with `# DP:' are a description of the patch.
# DP: Description: create correct unistd.h and syscall.h on mips
# DP: Related bugs: 223891
# DP: Author: Daniel Jacobowitz <[EMAIL PROTECTED]>, Guido Guenther <[EMAIL PROTECTED]>
# DP: Date:  2004-01-19

if [ $# -ne 2 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

# append the patch here and adjust the -p? flag in the patch calls.
--- glibc-2.3.2/sysdeps/unix/sysv/linux/mips/Makefile.orig      2003-12-11 
16:04:24.000000000 -0500
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/mips/Makefile   2003-12-11 16:18:55.000000000 
-0500
@@ -12,7 +12,7 @@
 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
 # We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
 # it exists, but also define SYS_<abi>_<syscall> for all ABIs.
-$(objpfx)syscall-%.h $(objpfx)syscall-%.d: 
../sysdeps/unix/sysv/linux/mips/sys/syscall.h
+$(objpfx)syscall-list.h $(objpfx)syscall-list.d: $(common-objpfx)asm-unistd.h 
        $(make-target-directory)
        { \
         echo '/* Generated at libc build time from kernel syscall list.  */';\
@@ -21,31 +21,9 @@
         echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> 
instead."'; \
         echo '#endif'; \
         echo ''; \
-        rm -f $(@:.d=.h).newt; \
-        $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
-              -x c -I $(common-objdir) $(sysincludes) $< -D_LIBC -dM | \
-        sed -n '[EMAIL PROTECTED] __NR_\([^ ]*\) [EMAIL PROTECTED] SYS_\1 [EMAIL 
PROTECTED]' \
-            > $(@:.d=.h).newt; \
-        if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
-          echo '#if defined _ABI64 && _MIPS_SIM == _ABI64'; \
-          sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt; \
-          echo '#elif defined _ABIN32 && _MIPS_SIM == _ABIN32'; \
-          sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt; \
-          echo '#else'; \
-          sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt; \
-          echo '#endif'; \
-          sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt; \
-        else \
-          cat $(@:.d=.h).newt; \
-        fi; \
-        rm $(@:.d=.h).newt; \
+        grep -E '^#.*(MIPS_SIM|__NR)' $(common-objpfx)asm-unistd.h \
+         | sed 's/__NR_/SYS_/g' ; \
        } > $(@:.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
+       echo > $(@:.h=.d)
 endif

--- glibc-2.3.2/sysdeps/unix/sysv/linux/mips/configure.in.orig  2004-01-19 
15:50:35.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/mips/configure.in       2004-01-19 
15:50:48.000000000 +0100
@@ -3,7 +3,7 @@
 # Local configure fragment for sysdeps/unix/sysv/linux/mips.
 
 case $machine in
-mips*64*)
+mips*)
   rm -f asm-unistd.h
   asm_unistd_h=$sysheaders/asm/unistd.h
   if test ! -f $asm_unistd_h; then
@@ -19,57 +19,65 @@
     AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed])
     echo '#include <asm/unistd.h>' > asm-unistd.h
   else
-    # The point of this preprocessing is to turn __NR_<syscall> into
-    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
-    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
-    # and <abi> is the compiler-enabled ABI.
+    # There are two versions of this header.  The older form defined
+    # __NR_foo, __NR_N32_foo, and __NR_O32_foo.  The new form defines
+    # only __NR_foo, but does it based on the current ABI.
+    # We want to have __NR_O32_foo, __NR_N64_foo, and __NR_N32_foo defined
+    # always, and __NR_foo defined conditionally.  Only the newer form is
+    # supported.
     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 '
-/^#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";
+    awk > asm-unistd.h '
+/^#if _MIPS_SIM == _MIPS_SIM_ABI32/,/^#endif.*_MIPS_SIM_ABI32/ {
+  if (/^#define __NR_Linux/) { print; next; }
+  if (/^#define __NR_/) {
+       line = $0;
+       gsub (/_NR_/, "_NR_O32_", line);
+       print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */";
+       print "";
+       print line;
+       print "";
+       print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
        print; next;
+  }
+  print; next;
 }
-/^#define __NR_O32_/ {
-       name = $2;
-       sub (/_O32_/, "_", name);
-       print;
-       print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
-       print "# define " name " " $2;
-       print "#endif";
-       next;
+/^#if _MIPS_SIM == _MIPS_SIM_NABI32/,/^#endif.*_MIPS_SIM_NABI32/ {
+  if (/^#define __NR_Linux/) { print; next; }
+  if (/^#define __NR_/) {
+       line = $0;
+       gsub (/_NR_/, "_NR_N32_", line);
+       print "#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */";
+       print "";
+       print line;
+       print "";
+       print "#if _MIPS_SIM == _MIPS_SIM_NABI32";
+       print; next;
+  }
+  print; next;
 }
-/^#define __NR_N32_/ {
-       name = $2;
-       sub (/_N32_/, "_", name);
-       print;
-       print "#if defined _ABIN32 && _MIPS_SIM == _ABIN32";
-       print "# define " name " " $2;
-       print "#endif";
-       next;
+/^#if _MIPS_SIM == _MIPS_SIM_ABI64/,/^#endif.*_MIPS_SIM_ABI64/ {
+  if (/^#define __NR_Linux/) { print; next; }
+  if (/^#define __NR_/) {
+       line = $0;
+       gsub (/_NR_/, "_NR_N64_", line);
+       print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */";
+       print "";
+       print line;
+       print "";
+       print "#if _MIPS_SIM == _MIPS_SIM_ABI64";
+       print; next;
+  }
+  print; next;
 }
-/^#define __NR_N64_/ {
-       name = $2;
-       sub (/_N64_/, "_", name);
+/^#define __NR_64_/ {
+       line = $0;
+       gsub (/_NR_64_/, "_NR_N64_", line);
        print;
-       print "#if defined _ABI64 && _MIPS_SIM == _ABI64";
-       print "# define " name " " $2;
-       print "#endif";
+       print line;
        next;
 }
 {
        print;
 }'
   fi ;;
-mips*)
-  rm -f asm-unistd.h
-  echo '#include <asm/unistd.h>' > asm-unistd.h
-  ;;
 esac
--- glibc-2.3.2/sysdeps/unix/sysv/linux/mips/configure.orig     2004-01-19 
15:50:40.000000000 +0100
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/mips/configure  2004-01-19 15:50:44.000000000 
+0100
@@ -2,7 +2,7 @@
  # Local configure fragment for sysdeps/unix/sysv/linux/mips.
 
 case $machine in
-mips*64*)
+mips*)
   rm -f asm-unistd.h
   asm_unistd_h=$sysheaders/asm/unistd.h
   if test ! -f $asm_unistd_h; then
@@ -19,57 +19,65 @@
 echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;}
     echo '#include <asm/unistd.h>' > asm-unistd.h
   else
-    # The point of this preprocessing is to turn __NR_<syscall> into
-    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
-    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
-    # and <abi> is the compiler-enabled ABI.
+    # There are two versions of this header.  The older form defined
+    # __NR_foo, __NR_N32_foo, and __NR_O32_foo.  The new form defines
+    # only __NR_foo, but does it based on the current ABI.
+    # We want to have __NR_O32_foo, __NR_N64_foo, and __NR_N32_foo defined
+    # always, and __NR_foo defined conditionally.  Only the newer form is
+    # supported.
     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 '
-/^#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";
+    awk > asm-unistd.h '
+/^#if _MIPS_SIM == _MIPS_SIM_ABI32/,/^#endif.*_MIPS_SIM_ABI32/ {
+  if (/^#define __NR_Linux/) { print; next; }
+  if (/^#define __NR_/) {
+       line = $0;
+       gsub (/_NR_/, "_NR_O32_", line);
+       print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */";
+       print "";
+       print line;
+       print "";
+       print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
        print; next;
+  }
+  print; next;
 }
-/^#define __NR_O32_/ {
-       name = $2;
-       sub (/_O32_/, "_", name);
-       print;
-       print "#if _MIPS_SIM == _MIPS_SIM_ABI32";
-       print "# define " name " " $2;
-       print "#endif";
-       next;
+/^#if _MIPS_SIM == _MIPS_SIM_NABI32/,/^#endif.*_MIPS_SIM_NABI32/ {
+  if (/^#define __NR_Linux/) { print; next; }
+  if (/^#define __NR_/) {
+       line = $0;
+       gsub (/_NR_/, "_NR_N32_", line);
+       print "#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */";
+       print "";
+       print line;
+       print "";
+       print "#if _MIPS_SIM == _MIPS_SIM_NABI32";
+       print; next;
+  }
+  print; next;
 }
-/^#define __NR_N32_/ {
-       name = $2;
-       sub (/_N32_/, "_", name);
-       print;
-       print "#if defined _ABIN32 && _MIPS_SIM == _ABIN32";
-       print "# define " name " " $2;
-       print "#endif";
-       next;
+/^#if _MIPS_SIM == _MIPS_SIM_ABI64/,/^#endif.*_MIPS_SIM_ABI64/ {
+  if (/^#define __NR_Linux/) { print; next; }
+  if (/^#define __NR_/) {
+       line = $0;
+       gsub (/_NR_/, "_NR_N64_", line);
+       print "#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */";
+       print "";
+       print line;
+       print "";
+       print "#if _MIPS_SIM == _MIPS_SIM_ABI64";
+       print; next;
+  }
+  print; next;
 }
-/^#define __NR_N64_/ {
-       name = $2;
-       sub (/_N64_/, "_", name);
+/^#define __NR_64_/ {
+       line = $0;
+       gsub (/_NR_64_/, "_NR_N64_", line);
        print;
-       print "#if defined _ABI64 && _MIPS_SIM == _ABI64";
-       print "# define " name " " $2;
-       print "#endif";
+       print line;
        next;
 }
 {
        print;
 }'
   fi ;;
-mips*)
-  rm -f asm-unistd.h
-  echo '#include <asm/unistd.h>' > asm-unistd.h
-  ;;
 esac

Attachment: signature.asc
Description: Digital signature

Reply via email to