patches/linux/2.6.5/linux-2.6.5-x86_64-unistd.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/linux/2.6.5/linux-2.6.5-x86_64-unistd.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,80 @@
     1.4 +Retrieved with wget http://www.x86-64.org/lists/discuss/msg04963.html
     1.5 +then tabs fixed up by rediffing
     1.6 +
     1.7 +Message-Id: EFF62C7EE88E71429E38641A1172F4C2077104@net.teracruz.com
     1.8 +To: discuss@xxxxxxxxxx
     1.9 +Subject: Compile error with glibc 2.3.2 + Linux 2.6.5 ARCH=x86_64
    1.10 +From: "David Lee" david.lee@xxxxxxxxxxxx
    1.11 +Date: Wed, 21 Apr 2004 15:26:04 -0500</li>
    1.12 +
    1.13 +I am getting compiler errors when trying to compile glibc 2.3.2 using
    1.14 +the kernel headers from linux 2.6.5.  The headers from linux 2.6.3 work
    1.15 +fine.
    1.16 +
    1.17 +I've traced the cause of the problem to a change made in
    1.18 +./include/asm-x86_64/unistd.h in the 2.6.4 release.
    1.19 +
    1.20 ++#ifndef __ASSEMBLY__
    1.21 ++
    1.22 ++#include <linux/linkage.h>
    1.23 ++#include <linux/compiler.h>
    1.24 ++#include <linux/types.h>
    1.25 ++#include <asm/ptrace.h>
    1.26 ++
    1.27 ++asmlinkage long sys_ptrace(long request, long pid,
    1.28 ++                                unsigned long addr, long data);
    1.29 ++asmlinkage long sys_iopl(unsigned int level, struct pt_regs regs);
    1.30 ++asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int
    1.31 +turn_on);
    1.32 ++struct sigaction;
    1.33 ++asmlinkage long sys_rt_sigaction(int sig,
    1.34 ++                                const struct sigaction __user *act,
    1.35 ++                                struct sigaction __user *oact,
    1.36 ++                                size_t sigsetsize);
    1.37 ++
    1.38 ++#endif  /* __ASSEMBLY__ */
    1.39 +
    1.40 +Within glibc, ./sysdeps/unix/sysv/linux/x86_64/syscall.S ends up
    1.41 +including this file, which chokes the assembler with the struct
    1.42 +declarations in the above #include's.
    1.43 +
    1.44 +/home/dlee/vcs/Products/Breeze/Dev/Prj/LinuxRH8/tscale2/tools/x86_64/x86
    1.45 +_64-linux/glibcinclude/linux/posix_types.h: Assembler messages:
    1.46 +/home/dlee/vcs/Products/Breeze/Dev/Prj/LinuxRH8/tscale2/tools/x86_64/x86
    1.47 +_64-linux/glibcinclude/linux/posix_types.h:36: Error: no such
    1.48 +instruction: `typedef struct{'
    1.49 +
    1.50 +There are also errors about conflicting re-declarations further along in
    1.51 +the glibc build.
    1.52 +
    1.53 +../posix/sys/types.h:62: error: conflicting types for `dev_t'
    1.54 +/home/dlee/vcs/Products/Breeze/Dev/Prj/LinuxRH8/tscale2/tools/x86_64/x86
    1.55 +_64-linux/glibcinclude/linux/types.h:23: error: previous declaration of
    1.56 +`dev_t'
    1.57 +
    1.58 +Changing the '#ifndef __ASSEMBLY__' to '#if ((!defined __ASSEMBLY__) &&
    1.59 +(defined __KERNEL__))' clears up the problem.  My patch is below.
    1.60 +
    1.61 +dave
    1.62 +
    1.63 +
    1.64 +--- linux-2.6.5/include/asm-x86_64/unistd.h.old	2004-04-03 19:37:36.000000000 -0800
    1.65 ++++ linux-2.6.5/include/asm-x86_64/unistd.h	2004-05-05 11:07:11.000000000 -0700
    1.66 +@@ -713,7 +713,7 @@
    1.67 + 
    1.68 + #endif /* __KERNEL_SYSCALLS__ */
    1.69 + 
    1.70 +-#ifndef __ASSEMBLY__
    1.71 ++#if ((!defined __ASSEMBLY__) && (defined __KERNEL__))
    1.72 + 
    1.73 + #include <linux/linkage.h>
    1.74 + #include <linux/compiler.h>
    1.75 +@@ -730,7 +730,7 @@
    1.76 + 				struct sigaction __user *oact,
    1.77 + 				size_t sigsetsize);
    1.78 + 
    1.79 +-#endif	/* __ASSEMBLY__ */
    1.80 ++#endif /* ((!defined __ASSEMBLY__) && (defined __KERNEL__) */
    1.81 + 
    1.82 + #endif /* __NO_STUBS */
    1.83 +