OSDN Git Service

Add comment about duplication of EXTRA_PARTS in EXTRA_MULTILIB_PARTS
[pf3gnuchains/gcc-fork.git] / gcc / fixinc.x86-linux-gnu
1 #! /bin/sh
2 #
3 # The script is created for Cygnus by vmakarov@cygnus.com and based on
4 # fixinc.wrap
5 #
6 # This script is designed for x86 with gnulibc of version 2.0 and less
7 # for solution of problems with invalid asm-statements by creating
8 # small wrappers around the include files containg the asm-statements.
9 #
10 # See README-fixinc for more information.
11
12
13 # Directory in which to store the results.
14 LIB=${1?"fixincludes: output directory not specified"}
15
16 # Make sure it exists.
17 if [ ! -d $LIB ]; then
18   mkdir $LIB || exit 1
19 fi
20
21 # Make LIB absolute if it is relative.
22 # Don't do this if not necessary, since may screw up automounters.
23 case $LIB in
24 /*)
25         ;;
26 *)
27         cd $LIB; LIB=`${PWDCMD-pwd}`
28         ;;
29 esac
30
31 echo Building fixed headers in ${LIB}
32   
33 file=selectbits.h
34 echo Fixed $file for glibc-2.0.x
35 rm -f $LIB/$file
36 cat <<'__EOF__' >$LIB/$file
37 /* This file fixes __FD_ZERO bug for glibc-2.0.x. */
38 #ifndef _SELECTBITS_H_WRAPPER
39 #include <features.h>
40 #include_next <selectbits.h>
41
42 #if defined(__FD_ZERO) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && __GLIBC__ == 2 && __GLIBC_MINOR__ == 0
43 #undef __FD_ZERO
44 #define __FD_ZERO(fdsetp) \
45   do { \
46     int __d0, __d1; \
47   __asm__ __volatile__ ("cld; rep; stosl" \
48                         : "=m" (((__fd_mask *) \
49                                  (fdsetp))[__FDELT (__FD_SETSIZE)]), \
50                           "=&c" (__d0), "=&D" (__d1) \
51                         : "a" (0), "1" (sizeof (__fd_set) \
52                                         / sizeof (__fd_mask)), \
53                           "2" ((__fd_mask *) (fdsetp)) \
54                         : "memory"); \
55   } while (0)
56 #endif
57
58 #define _SELECTBITS_H_WRAPPER
59 #endif /* _SELECTBITS_H_WRAPPER */
60 __EOF__
61 # Define _SELECTBITS_H_WRAPPER at the end of the wrapper, not
62 # the start, so that if #include_next gets another instance of
63 # the wrapper, this will follow the #include_next chain until
64 # we arrive at the real <selectbits.h>.
65 chmod a+r $LIB/$file
66
67 # asm/posix_types.h for libc version 1.x
68 file=asm/posix_types.h
69 echo Fixed $file for glibc-1.x
70 rm -f $LIB/$file
71 dir=`dirname $LIB/$file`
72 if [ ! -d $dir ]; then
73   mkdir -p $dir || exit 1
74 fi
75 cat <<'__EOF__' >$LIB/$file
76 /* This file fixes __FD_ZERO bug for glibc-1.x. */
77 #ifndef _POSIX_TYPES_H_WRAPPER
78 #include <features.h>
79 #include_next <asm/posix_types.h>
80
81 #if defined(__FD_ZERO) && !defined(__GLIBC__)
82 #undef __FD_ZERO
83 #define __FD_ZERO(fdsetp) \
84   do { \
85     int __d0, __d1; \
86                 __asm__ __volatile__("cld ; rep ; stosl" \
87                         : "=m" (*(__kernel_fd_set *) (fdsetp)), \
88                           "=&c" (__d0), "=&D" (__d1) \
89                         : "a" (0), "1" (__FDSET_LONGS), \
90                           "2" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
91   } while (0)
92 #endif
93
94 #define _POSIX_TYPES_H_WRAPPER
95 #endif /* _POSIX_TYPES_H_WRAPPER */
96 __EOF__
97 # Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
98 # the start, so that if #include_next gets another instance of
99 # the wrapper, this will follow the #include_next chain until
100 # we arrive at the real <asm/posix_types.h>.
101 chmod a+r $LIB/$file
102
103 # gnu/types.h for libc version 1.x
104 file=gnu/types.h
105 echo Fixed $file for glibc-1.x
106 rm -f $LIB/$file
107 dir=`dirname $LIB/$file`
108 if [ ! -d $dir ]; then
109   mkdir -p $dir || exit 1
110 fi
111 cat <<'__EOF__' >$LIB/$file
112 /* This file fixes __FD_ZERO bug for glibc-1.x. */
113 #ifndef _TYPES_H_WRAPPER
114 #include <features.h>
115 #include_next <gnu/types.h>
116
117 #if defined(__FD_ZERO) && !defined(__GLIBC__)
118 #undef __FD_ZERO
119 # define __FD_ZERO(fdsetp) \
120   do { \
121     int __d0, __d1; \
122         __asm__ __volatile__("cld ; rep ; stosl" \
123                 : "=m" (*(__fd_set *) (fdsetp)), \
124                   "=&c" (__d0), "=&D" (__d1) \
125                 : "a" (0), "1" (__FDSET_LONGS), \
126                   "2" ((__fd_set *) (fdsetp)) :"memory"); \
127   } while (0)
128 #endif
129
130 #define _TYPES_H_WRAPPER
131 #endif /* _TYPES_H_WRAPPER */
132 __EOF__
133 # Define _TYPES_H_WRAPPER at the end of the wrapper, not the start,
134 # so that if #include_next gets another instance of the wrapper,
135 # this will follow the #include_next chain until we arrive at
136 # the real <gnu/types.h>.
137 chmod a+r $LIB/$file
138
139 exit 0
140