[PATCH] Build proper bits/syscall.h on sparc* (take 2)
Jakub Jelinek
jakub@redhat.com
Mon Nov 13 08:48:00 GMT 2000
Hi!
Below is a new version of my patch from Nov, 9th, because that one had a
missing semicolon (in the rm command which was the only one added after
testing it out).
As mentioned some time ago, sparc*-*-linux* needs to do more work to build
bits/syscall.h than most of the other ports, because although most of the
syscalls are common to both platforms, some syscalls are 32bit and some
syscalls are 64bit only.
This patch was tested on sparc32 by full bootstrap/make check (passed) and
on sparc64 (just did this by hand to see whether it works).
It should work on all other arches since nothing else defines
no_syscall_list_h.
2000-11-13 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/Makefile: Allow ports to override
syscall-list.h goal.
* sysdeps/unix/sysv/linux/sparc/Makefile: New.
--- libc/sysdeps/unix/sysv/linux/sparc/Makefile.jj Thu Nov 9 10:51:46 2000
+++ libc/sysdeps/unix/sysv/linux/sparc/Makefile Thu Nov 9 11:26:57 2000
@@ -0,0 +1,44 @@
+ifeq ($(subdir),misc)
+
+no_syscall_list_h = 1
+
+# Generate the list of SYS_* macros for the system calls (__NR_* macros).
+$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
+ rm -f $(@:.h=.d)-t
+ { \
+ echo '/* Generated at libc build time from kernel syscall list. */';\
+ echo ''; \
+ echo '#ifndef _SYSCALL_H'; \
+ echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
+ echo '#endif'; \
+ echo ''; \
+ SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
+ $(CC) -E -x c $(sysincludes) $< -U__sparc_v9__ -U__arch64__ -D_LIBC -dM | \
+ sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
+ LC_ALL=C sort > $(@:.d=.h).new32; \
+ SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
+ $(CC) -E -x c $(sysincludes) $< -D__sparc_v9__ -D__arch64__ -D_LIBC -dM | \
+ sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
+ LC_ALL=C sort > $(@:.d=.h).new64; \
+ if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
+ cat $(@:.d=.h).new32; \
+ else \
+ echo '#include <bits/wordsize.h>'; \
+ echo ''; \
+ comm -12 $(@:.d=.h).new32 $(@:.d=.h).new64; \
+ echo '#if __WORDSIZE == 64'; \
+ comm -13 $(@:.d=.h).new32 $(@:.d=.h).new64; \
+ echo '#else'; \
+ comm -23 $(@:.d=.h).new32 $(@:.d=.h).new64; \
+ echo '#endif'; \
+ fi; \
+ rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
+ } > $(@:.d=.h).new
+ mv -f $(@:.d=.h).new $(@:.d=.h)
+ sed < $(@:.h=.d)-t > $(@:.h=.d)-t2 \
+ -e 's,$(subst .,\.,$@),$(patsubst $(objpfx)%,$$(objpfx)%,\
+ $(@:.d=.h) $(@:.h=.d)),'
+ rm -f $(@:.h=.d)-t
+ mv -f $(@:.h=.d)-t2 $(@:.h=.d)
+
+endif
--- libc/sysdeps/unix/sysv/linux/Makefile.jj Tue Oct 17 07:18:13 2000
+++ libc/sysdeps/unix/sysv/linux/Makefile Thu Nov 9 10:50:08 2000
@@ -25,6 +25,7 @@ sysdep_headers += sys/mount.h sys/acct.h
install-others += $(inst_includedir)/bits/syscall.h
+ifndef no_syscall_list_h
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
rm -f $(@:.h=.d)-t
@@ -45,6 +46,7 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.
$(@:.d=.h) $(@:.h=.d)),'
rm -f $(@:.h=.d)-t
mv -f $(@:.h=.d)-t2 $(@:.h=.d)
+endif
$(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
$(make-target-directory)
Jakub
More information about the Libc-hacker
mailing list