source: scripts/patches/glibc-2.3.4-mips_syscall-2.patch@ 0547e59

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 0547e59 was 7f65c0e, checked in by Jim Gifford <clfs@…>, 19 years ago

r625@server (orig r623): jim | 2005-10-31 12:43:24 -0800
Final Move

  • Property mode set to 100644
File size: 10.8 KB
  • sysdeps/unix/sysv/linux/mips/Makefile

    Submitted By: Jim Gifford (patches at jg555 dot com)
    Date: 2005-02-23
    Initial Package Version: 2.3.4
    Origin: Richard Sandiford
    Upstream Status: Unknown
    Description: Fixes Syscall.h generation
     
    diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/Makefile glibc-2.3.4/sysdeps/unix/sysv/linux/mips/Makefile
    old new  
    99
    1010no_syscall_list_h = 1
    1111
    12 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
    13 # We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
    14 # it exists, but also define SYS_<abi>_<syscall> for all ABIs.
     12# A callable macro that expands to a shell command.  Preprocess file $(1)
     13# using ABI option $(2) and see which macros it defines.  Print FOO for each
     14# macro of the form __NR$(3)_FOO, filtering out ABI-specific __NR macros
     15# that have a prefix other than $(3).
     16mips_list_syscalls =    $(filter-out -m%,$(CC)) -E -x c $(+includes) \
     17                            $(sysincludes) -D_LIBC -dM -mabi=$(2) $(1) | \
     18                        sed -n 's@^\#define __NR$(3)_\([^ ]*\) .*@\1@p' | \
     19                        sed -e '/^[ON]32_/d' -e '/^N64_/d' -e '/^64_/d' | \
     20                        LC_ALL=C sort
     21
     22# Generate a list of SYS_* macros from the linux __NR macros.
     23#
     24# Before version 2.6, linux had separate 32-bit and 64-bit MIPS ports,
     25# each with its own set of headers.  The ports were merged for 2.6 and
     26# this merged port defines the syscalls in a slightly different way.
     27# There are therefore three sets of headers that we need to consider:
     28#
     29#    (1) Headers from the separate 32-bit MIPS port.  They just define
     30#        a single list of __NR macros.
     31#
     32#    (2) Headers from the separate 64-bit MIPS port.  They unconditionally
     33#        define syscalls for all three ABIs, with o32 syscalls prefixed
     34#        by __NR_O32, n32 syscalls prefixed by __NR_N32 and n64 syscalls
     35#        prefixed by plain __NR.
     36#
     37#    (3) Headers from the combined port.  They use the _MIPS_SIM macro to
     38#        define the right set of syscalls for the current ABI.  The syscalls
     39#        themselves have no special ABI prefix, but the headers also define:
     40#
     41#           __NR_O32_Linux{,_syscalls}
     42#           __NR_N32_Linux{,_syscalls}
     43#           __NR_64_Linux{,_syscalls}
     44#
     45# In case (1) we just want a simple list of SYS_* macros.  In cases (2)
     46# and (3) we want a file that will work for all three ABIs, regardless
     47# of which ABI we are currently using.  We also want the file to work
     48# if the user later moves from (2) to (3).  Thus the file we create
     49# for (2) and (3) has the form:
     50#
     51#    #if _MIPS_SIM == _MIPS_SIM_NABI32
     52#    # ifdef __NR_N32_open
     53#    #  define SYS_n32syscall1 __NR_N32_n32syscall1
     54#    #  ...
     55#    # else
     56#    #  define SYS_n32syscall1 __NR_n32syscall1
     57#    #  ...
     58#    # endif
     59#    #elif _MIPS_SIM == _MIPS_SIM_ABI64
     60#    # define SYS_n64syscall1 __NR_n64syscall1
     61#    # ...
     62#    #else
     63#    # ifdef __NR_O32_open
     64#    #  define SYS_o32syscall1 __NR_O32_o32syscall1
     65#    #  ...
     66#    # else
     67#    #  define SYS_o32syscall1 __NR_o32syscall1
     68#    #  ...
     69#    # endif
     70#    #endif
     71#
     72# Here, __NR_N32_open and __NR_O32_open are used to detect case (2)
     73# over case (3).  The n64 SYS_* macros can always use the normal
     74# ABI-less names.
    1575$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h
    1676        $(make-target-directory)
     77        $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC $< -MD -MP \
     78              -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' > /dev/null
    1779        { \
    1880         echo '/* Generated at libc build time from kernel syscall list.  */';\
    1981         echo ''; \
     
    2284         echo '#endif'; \
    2385         echo ''; \
    2486         echo '#include <sgidefs.h>'; \
    25          rm -f $(@:.d=.h).newt; \
    26          $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
    27                -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \
    28          sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
    29              > $(@:.d=.h).newt; \
    30          if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
     87         rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \
     88         $(call mips_list_syscalls,$<,n32,_N32) > $(@:.d=.h).newn32; \
     89         if test -s $(@:.d=.h).newn32; then \
     90           if grep open $(@:.d=.h).newn32 > /dev/null; then \
     91             $(call mips_list_syscalls,$<,32,_O32) > $(@:.d=.h).new32; \
     92             $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \
     93           else \
     94             $(call mips_list_syscalls,$<,32,) > $(@:.d=.h).new32; \
     95             $(call mips_list_syscalls,$<,n32,) > $(@:.d=.h).newn32; \
     96             $(call mips_list_syscalls,$<,64,) > $(@:.d=.h).new64; \
     97           fi; \
    3198           echo '#if _MIPS_SIM == _ABIN32'; \
    32            sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
    33                 LC_ALL=C sort; \
     99           echo '# ifdef __NR_N32_open'; \
     100           sed 's@\(.*\)@#  define SYS_\1 __NR_N32_\1@' < $(@:.d=.h).newn32; \
     101           echo '# else'; \
     102           sed 's@\(.*\)@#  define SYS_\1 __NR_\1@' < $(@:.d=.h).newn32; \
     103           echo '# endif'; \
    34104           echo '#elif _MIPS_SIM == _ABI64'; \
    35            sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
    36                 LC_ALL=C sort; \
     105           sed 's@\(.*\)@# define SYS_\1 __NR_\1@' < $(@:.d=.h).new64; \
    37106           echo '#else'; \
    38            sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \
    39                 LC_ALL=C sort; \
     107           echo '# ifdef __NR_O32_open'; \
     108           sed 's@\(.*\)@#  define SYS_\1 __NR_O32_\1@' < $(@:.d=.h).new32; \
     109           echo '# else'; \
     110           sed 's@\(.*\)@#  define SYS_\1 __NR_\1@' < $(@:.d=.h).new32; \
     111           echo '# endif'; \
    40112           echo '#endif'; \
    41            sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \
    42                 LC_ALL=C sort +1.8; \
    43113         else \
    44            cat $(@:.d=.h).newt; \
     114           $(CC) -E -x c $(+includes) $(sysincludes) -D_LIBC -dM $< | \
     115           sed -n 's@^\#define __NR_\([^ ]*\) .*@\#define SYS_\1 __NR_\1@p' | \
     116           LC_ALL=C sort; \
    45117         fi; \
    46          rm $(@:.d=.h).newt; \
     118         rm -f $(@:.d=.h).new32 $(@:.d=.h).newn32 $(@:.d=.h).new64; \
    47119        } > $(@:.d=.h).new
    48120        mv -f $(@:.d=.h).new $(@:.d=.h)
    49121ifneq (,$(objpfx))
  • sysdeps/unix/sysv/linux/mips/configure

    diff -Naur glibc-2.3.4.orig/sysdeps/unix/sysv/linux/mips/configure glibc-2.3.4/sysdeps/unix/sysv/linux/mips/configure
    old new  
    1818    { echo "$as_me:$LINENO: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&5
    1919echo "$as_me: WARNING: *** asm/unistd.h not found, it will not be pre-processed" >&2;}
    2020    echo '#include <asm/unistd.h>' > asm-unistd.h
    21   else
     21  elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then
    2222    # The point of this preprocessing is to turn __NR_<syscall> into
    2323    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
    2424    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
     
    6868{
    6969        print;
    7070}'
     71  else
     72    echo '#include <asm/unistd.h>' > asm-unistd.h
    7173  fi ;;
    7274mips*)
    7375  rm -f asm-unistd.h
  • sysdeps/unix/sysv/linux/mips/configure.in

    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
    old new  
    1818  if test ! -f "$asm_unistd_h"; then
    1919    AC_MSG_WARN([*** asm/unistd.h not found, it will not be pre-processed])
    2020    echo '#include <asm/unistd.h>' > asm-unistd.h
    21   else
     21  elif grep __NR_N32_open "$asm_unistd_h" > /dev/null; then
    2222    # The point of this preprocessing is to turn __NR_<syscall> into
    2323    # __NR_N64_<syscall>, as well as to define __NR_<syscall> to
    2424    # __NR_<abi>_<syscall>, if __NR_<abi>_<syscall> is defined
     
    6868{
    6969        print;
    7070}'
     71  else
     72    echo '#include <asm/unistd.h>' > asm-unistd.h
    7173  fi ;;
    7274mips*)
    7375  rm -f asm-unistd.h
  • sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h

    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
    old new  
    1 /* Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
    2    This file is part of the GNU C Library.
    3 
    4    The GNU C Library is free software; you can redistribute it and/or
    5    modify it under the terms of the GNU Lesser General Public
    6    License as published by the Free Software Foundation; either
    7    version 2.1 of the License, or (at your option) any later version.
    8 
    9    The GNU C Library is distributed in the hope that it will be useful,
    10    but WITHOUT ANY WARRANTY; without even the implied warranty of
    11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    12    Lesser General Public License for more details.
    13 
    14    You should have received a copy of the GNU Lesser General Public
    15    License along with the GNU C Library; if not, write to the Free
    16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    17    02111-1307 USA.  */
    18 
    19 #ifndef _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H
    20 #define _LINUX_MIPS_MIPS32_KERN64_SYSDEP_H 1
    21 
    22 /* There is some commonality.  */
    23 #include <sysdeps/unix/sysv/linux/mips/mips32/sysdep.h>
    24 
    25 /* For Linux we can use the system call table in the header file
    26         /usr/include/asm/unistd.h
    27    of the kernel.  But these symbols do not follow the SYS_* syntax
    28    so we have to redefine the `SYS_ify' macro here.  */
    29 #undef SYS_ify
    30 #ifdef __STDC__
    31 # define SYS_ify(syscall_name)  __NR_O32_##syscall_name
    32 #else
    33 # define SYS_ify(syscall_name)  __NR_O32_/**/syscall_name
    34 #endif
    35 
    36 #endif /* linux/mips/mips32/kern64/sysdep.h */
  • sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h

    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
    old new  
    2828   so we have to redefine the `SYS_ify' macro here.  */
    2929#undef SYS_ify
    3030#ifdef __STDC__
    31 # define SYS_ify(syscall_name)  __NR_N32_##syscall_name
     31# define SYS_ify(syscall_name)  __NR_##syscall_name
    3232#else
    33 # define SYS_ify(syscall_name)  __NR_N32_/**/syscall_name
     33# define SYS_ify(syscall_name)  __NR_/**/syscall_name
    3434#endif
    3535
    3636#ifdef __ASSEMBLER__
  • sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h

    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
    old new  
    2828   so we have to redefine the `SYS_ify' macro here.  */
    2929#undef SYS_ify
    3030#ifdef __STDC__
    31 # define SYS_ify(syscall_name)  __NR_N64_##syscall_name
     31# define SYS_ify(syscall_name)  __NR_##syscall_name
    3232#else
    33 # define SYS_ify(syscall_name)  __NR_N64_/**/syscall_name
     33# define SYS_ify(syscall_name)  __NR_/**/syscall_name
    3434#endif
    3535
    3636#ifdef __ASSEMBLER__
Note: See TracBrowser for help on using the repository browser.