patches/linux/2.6.5/100-linux-2.6.5-x86_64-unistd.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Feb 17 22:08:06 2008 +0000 (2008-02-17)
changeset 431 8bde4c6ea47a
permissions -rw-r--r--
Robert P. J. DAY says:

apparently, the patchset for gcc 4.2.1 applies properly to the
source for gcc 4.2.2 and gcc 4.2.3. so, if you want, you can simply
add support for those last two just by augmenting menuconfig and
adding a couple symlinks for those two directories. seems like a
cheap way to add a couple new versions.
yann@402
     1
Retrieved with wget http://www.x86-64.org/lists/discuss/msg04963.html
yann@402
     2
then tabs fixed up by rediffing
yann@402
     3
yann@402
     4
Message-Id: EFF62C7EE88E71429E38641A1172F4C2077104@net.teracruz.com
yann@402
     5
To: discuss@xxxxxxxxxx
yann@402
     6
Subject: Compile error with glibc 2.3.2 + Linux 2.6.5 ARCH=x86_64
yann@402
     7
From: "David Lee" david.lee@xxxxxxxxxxxx
yann@402
     8
Date: Wed, 21 Apr 2004 15:26:04 -0500</li>
yann@402
     9
yann@402
    10
I am getting compiler errors when trying to compile glibc 2.3.2 using
yann@402
    11
the kernel headers from linux 2.6.5.  The headers from linux 2.6.3 work
yann@402
    12
fine.
yann@402
    13
yann@402
    14
I've traced the cause of the problem to a change made in
yann@402
    15
./include/asm-x86_64/unistd.h in the 2.6.4 release.
yann@402
    16
yann@402
    17
+#ifndef __ASSEMBLY__
yann@402
    18
+
yann@402
    19
+#include <linux/linkage.h>
yann@402
    20
+#include <linux/compiler.h>
yann@402
    21
+#include <linux/types.h>
yann@402
    22
+#include <asm/ptrace.h>
yann@402
    23
+
yann@402
    24
+asmlinkage long sys_ptrace(long request, long pid,
yann@402
    25
+                                unsigned long addr, long data);
yann@402
    26
+asmlinkage long sys_iopl(unsigned int level, struct pt_regs regs);
yann@402
    27
+asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int
yann@402
    28
turn_on);
yann@402
    29
+struct sigaction;
yann@402
    30
+asmlinkage long sys_rt_sigaction(int sig,
yann@402
    31
+                                const struct sigaction __user *act,
yann@402
    32
+                                struct sigaction __user *oact,
yann@402
    33
+                                size_t sigsetsize);
yann@402
    34
+
yann@402
    35
+#endif  /* __ASSEMBLY__ */
yann@402
    36
yann@402
    37
Within glibc, ./sysdeps/unix/sysv/linux/x86_64/syscall.S ends up
yann@402
    38
including this file, which chokes the assembler with the struct
yann@402
    39
declarations in the above #include's.
yann@402
    40
yann@402
    41
/home/dlee/vcs/Products/Breeze/Dev/Prj/LinuxRH8/tscale2/tools/x86_64/x86
yann@402
    42
_64-linux/glibcinclude/linux/posix_types.h: Assembler messages:
yann@402
    43
/home/dlee/vcs/Products/Breeze/Dev/Prj/LinuxRH8/tscale2/tools/x86_64/x86
yann@402
    44
_64-linux/glibcinclude/linux/posix_types.h:36: Error: no such
yann@402
    45
instruction: `typedef struct{'
yann@402
    46
yann@402
    47
There are also errors about conflicting re-declarations further along in
yann@402
    48
the glibc build.
yann@402
    49
yann@402
    50
../posix/sys/types.h:62: error: conflicting types for `dev_t'
yann@402
    51
/home/dlee/vcs/Products/Breeze/Dev/Prj/LinuxRH8/tscale2/tools/x86_64/x86
yann@402
    52
_64-linux/glibcinclude/linux/types.h:23: error: previous declaration of
yann@402
    53
`dev_t'
yann@402
    54
yann@402
    55
Changing the '#ifndef __ASSEMBLY__' to '#if ((!defined __ASSEMBLY__) &&
yann@402
    56
(defined __KERNEL__))' clears up the problem.  My patch is below.
yann@402
    57
yann@402
    58
dave
yann@402
    59
yann@402
    60
yann@402
    61
--- linux-2.6.5/include/asm-x86_64/unistd.h.old	2004-04-03 19:37:36.000000000 -0800
yann@402
    62
+++ linux-2.6.5/include/asm-x86_64/unistd.h	2004-05-05 11:07:11.000000000 -0700
yann@402
    63
@@ -713,7 +713,7 @@
yann@402
    64
 
yann@402
    65
 #endif /* __KERNEL_SYSCALLS__ */
yann@402
    66
 
yann@402
    67
-#ifndef __ASSEMBLY__
yann@402
    68
+#if ((!defined __ASSEMBLY__) && (defined __KERNEL__))
yann@402
    69
 
yann@402
    70
 #include <linux/linkage.h>
yann@402
    71
 #include <linux/compiler.h>
yann@402
    72
@@ -730,7 +730,7 @@
yann@402
    73
 				struct sigaction __user *oact,
yann@402
    74
 				size_t sigsetsize);
yann@402
    75
 
yann@402
    76
-#endif	/* __ASSEMBLY__ */
yann@402
    77
+#endif /* ((!defined __ASSEMBLY__) && (defined __KERNEL__) */
yann@402
    78
 
yann@402
    79
 #endif /* __NO_STUBS */
yann@402
    80