linamh/sys-libs/glibc/files/2.3.4/glibc-2.3.4-mips-generate-syscall_h.patch
2009-09-12 08:46:08 +00:00

255 lines
8.0 KiB
Diff

--- sysdeps/unix/sysv/linux/mips/configure.in.orig 2004-09-29 23:49:30.000000000 -0400
+++ sysdeps/unix/sysv/linux/mips/configure.in 2004-09-30 02:04:26.000000000 -0400
@@ -19,50 +19,62 @@ mips*64*)
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 '
+ awk > asm-unistd.h '
BEGIN { print "#include <sgidefs.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";
- print; next;
-}
-/^#define __NR_O32_/ {
- name = $2;
- sub (/_O32_/, "_", name);
- print;
+/^#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 "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N32_/ {
- name = $2;
- sub (/_N32_/, "_", name);
- print;
+/^#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 "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N64_/ {
- name = $2;
- sub (/_N64_/, "_", name);
- print;
+/^#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 "# define " name " " $2;
- print "#endif";
+ print; next;
+ }
+ print; next;
+}
+/^#define __NR_64_/ {
+ line = $0;
+ gsub (/_NR_64_/, "_NR_N64_", line);
+ print;
+ print line;
next;
}
{
--- sysdeps/unix/sysv/linux/mips/configure.orig 2004-09-29 23:49:30.000000000 -0400
+++ sysdeps/unix/sysv/linux/mips/configure 2004-09-30 02:06:58.000000000 -0400
@@ -19,50 +19,62 @@ mips*64*)
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 '
+ awk > asm-unistd.h '
BEGIN { print "#include <sgidefs.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";
- print; next;
-}
-/^#define __NR_O32_/ {
- name = $2;
- sub (/_O32_/, "_", name);
- print;
+/^#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 "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N32_/ {
- name = $2;
- sub (/_N32_/, "_", name);
- print;
+/^#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 "# define " name " " $2;
- print "#endif";
- next;
+ print; next;
+ }
+ print; next;
}
-/^#define __NR_N64_/ {
- name = $2;
- sub (/_N64_/, "_", name);
- print;
+/^#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 "# define " name " " $2;
- print "#endif";
+ print; next;
+ }
+ print; next;
+}
+/^#define __NR_64_/ {
+ line = $0;
+ gsub (/_NR_64_/, "_NR_N64_", line);
+ print;
+ print line;
next;
}
{
--- sysdeps/unix/sysv/linux/mips/Makefile.orig 2004-09-29 23:49:30.000000000 -0400
+++ sysdeps/unix/sysv/linux/mips/Makefile 2004-09-30 02:12:30.000000000 -0400
@@ -12,7 +12,7 @@ no_syscall_list_h = 1
# 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. */';\
@@ -22,35 +22,9 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.
echo '#endif'; \
echo ''; \
echo '#include <sgidefs.h>'; \
- rm -f $(@:.d=.h).newt; \
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
- -x c $(+includes) $(sysincludes) $< -D_LIBC -dM | \
- sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
- > $(@:.d=.h).newt; \
- if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
- echo '#if _MIPS_SIM == _MIPS_SIM_NABI32'; \
- sed -n 's/^\(#define SYS_\)N32_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
- echo '#elif _MIPS_SIM == _MIPS_SIM_ABI64'; \
- sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
- echo '#else'; \
- sed -n 's/^\(#define SYS_\)O32_/\1/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort; \
- echo '#endif'; \
- sed -n '/^#define SYS_\([ON]32\|N64\)_/p' < $(@:.d=.h).newt | \
- LC_ALL=C sort +1.8; \
- 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