Fix compile error in arch/x86/kernel/syscall_64.c
Subsystems (2)
PATCH 1/1 Fix compile error in arch/x86/kernel/syscall_64.c
1965aae3c98397aad957412413c07e97b1bd4e64 broke compilation on one of my systems:
CC arch/x86/kernel/syscall_64.oarch/x86/kernel/syscall_64.c:27: error: array index in initializer exceeds array bounds arch/x86/kernel/syscall_64.c:27: error: (near initialization for ‘sys_call_table’) arch/x86/kernel/syscall_64.c:27: warning: excess elements in array initializer arch/x86/kernel/syscall_64.c:27: warning: (near initialization for ‘sys_call_table’) make[1]: *** [arch/x86/kernel/syscall_64.o] Error 1
make: *** [arch/x86/kernel/syscall_64.o] Error 2
Reverting only the parts of the commit that change ASM_X86__UNISTD_64_H to _ASM_X86_UNISTD_64_H fixes the problem. Patch below.
I have no idea what's going on here. Compiler bug?
root@vm1:~/linux-2.6# gcc --version gcc (Ubuntu 4.3.2-1ubuntu11) 4.3.2
--- arch/um/sys-x86_64/syscall_table.c | 4 ++-- arch/x86/include/asm/unistd_64.h | 6 +++--- arch/x86/kernel/asm-offsets_64.c | 2 +- arch/x86/kernel/syscall_64.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
arch/um/sys-x86_64/syscall_table.c +2 -2
@@ -41,12 +41,12 @@#define stub_rt_sigreturn sys_rt_sigreturn#define __SYSCALL (nr, sym) extern asmlinkage void sym(void) ; -#undef _ASM_X86_UNISTD_64_H +#undef ASM_X86__UNISTD_64_H#include "../../x86/include/asm/unistd_64.h" #undef __SYSCALL#define __SYSCALL (nr, sym) [ nr ] = sym, -#undef _ASM_X86_UNISTD_64_H +#undef ASM_X86__UNISTD_64_Htypedef void (*sys_call_ptr_t )(void );
arch/x86/include/asm/unistd_64.h +3 -3
@@ -1,5 +1,5 @@ -#ifndef _ASM_X86_UNISTD_64_H -#define _ASM_X86_UNISTD_64_H +#ifndef ASM_X86__UNISTD_64_H +#define ASM_X86__UNISTD_64_H #ifndef __SYSCALL#define __SYSCALL (a, b)
@@ -690,4 +690,4 @@ __SYSCALL(__NR_inotify_init1, sys_inotify_init1)#define cond_syscall (x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")#endif /* __KERNEL__ */ -#endif /* _ASM_X86_UNISTD_64_H */ +#endif /* ASM_X86__UNISTD_64_H */
arch/x86/kernel/asm-offsets_64.c +1 -1
@@ -22,7 +22,7 @@#define __NO_STUBS 1#undef __SYSCALL -#undef _ASM_X86_UNISTD_64_H +#undef ASM_X86__UNISTD_64_H#define __SYSCALL (nr, sym) [nr] = 1, static char syscalls[] = {#include <asm/unistd.h>
arch/x86/kernel/syscall_64.c +2 -2
@@ -8,12 +8,12 @@#define __NO_STUBS#define __SYSCALL (nr, sym) extern asmlinkage void sym(void) ; -#undef _ASM_X86_UNISTD_64_H +#undef ASM_X86__UNISTD_64_H#include <asm/unistd_64.h> #undef __SYSCALL#define __SYSCALL (nr, sym) [nr] = sym, -#undef _ASM_X86_UNISTD_64_H +#undef ASM_X86__UNISTD_64_Htypedef void (*sys_call_ptr_t )(void );
H. Peter Anvin
reviewerQuoted 11 lines · Jody McIntyre
1965aae3c98397aad957412413c07e97b1bd4e64broke compilation on one of my systems:CC
arch/x86/kernel/syscall_64.oarch/x86/kernel/syscall_64.c:27: error: array index in initializer exceeds array boundsarch/x86/kernel/syscall_64.c:27: error: (near initialization for ‘sys_call_table’)arch/x86/kernel/syscall_64.c:27: warning: excess elements in array initializerarch/x86/kernel/syscall_64.c:27: warning: (near initialization for ‘sys_call_table’) make[1]: *** [arch/x86/kernel/syscall_64.o] Error 1
make: *** [arch/x86/kernel/syscall_64.o] Error 2
Quoted 5 lines
Reverting only the parts of the commit that change
ASM_X86__UNISTD_64_Hto_ASM_X86_UNISTD_64_Hfixes the problem. Patch below.I have no idea what's going on here. Compiler bug?
Okay, this makes no sense whatsoever. Could you send me the following:
a. the .config you're using;
b. what kernel headers do you have in /usr/include
(if you installed the old ones with the broken header guards with "make headers_install", then your development environment is broken);
c. "make arch/x86/kernel/syscall_64.i".
-hpa
Quoted 1 line · H. Peter Anvin
Okay, this makes no sense whatsoever.
Glad you agree :)
Quoted 3 lines
Could you send me the following:
a. the .config you're using;
http://downloads.lustre.org/people/scjody/lkml/config_2008-12-03
Quoted 4 lines
b. what kernel headers do you have in
/usr/include
(if you installed the old ones with the broken header guards with "makeheaders_install", then your development environment is broken);
I have never installed headers via "make headers_install". Anything under /usr/include comes from my distribution (Ubuntu), and neither header guard is found anywhere:
root@vm1:~/linux-2.6# grep -r ASM_X86__UNISTD_64_H /usr/include root@vm1:~/linux-2.6# grep -r _ASM_X86_UNISTD_64_H /usr/include root@vm1:~/linux-2.6#
/usr/include/linux/* and /usr/include/asm/* come from the linux-libc-dev (2.6.27-9.19) package:
Package: linux-libc-dev
Priority: optional
Section: devel
Installed-Size: 3684
Maintainer: Ubuntu Kernel Team <[email protected]>
Architecture: amd64
Source: linux
Version: 2.6.27-9.19
Replaces: dvb-dev (<< 1.0.1-6), libc6-dev (<< 2.3.2.ds1-6), libc6.1-dev (<< 2.3.2.ds1-6), linux-kernel-headers
Provides: linux-kernel-headers
Conflicts: amd64-libs-dev (<= 1.1), dvb-dev (<< 1.0.1-6), libc6-dev (<< 2.3.2.ds1-6), libc6.1-dev (<< 2.3.2.ds1-6), linux-kernel-headers
Filename: pool/main/l/linux/linux-libc-dev_2.6.27-9.19_amd64.deb
Size: 653400
MD5sum: f2c4482176fe9e5219f7b18a258cbf86
SHA1: 1e6d329b13612438673a905152410cde8d0a7a53
SHA256: a294cb5f320c626a48f917a23b73a04e7d763ac3c2863ad16432dcd46cc0675c
Description: Linux Kernel Headers for development
This package provides headers from the Linux kernel. These headers
are used by the installed headers for GNU glibc and other system
libraries. They are NOT meant to be used to build third-party modules for
your kernel. Use linux-headers-* packages for that.
Bugs: mailto:[email protected]
Build-Essential: yes
Origin: Ubuntu
Task: ubuntu-desktop, kubuntu-desktop, edubuntu-desktop, xubuntu-desktop, mobile-mobile
I'm confused as to why this matters - I didn't think the kernel build used any external includes (except for helper utilities like "conf".)
Quoted 1 line
c. "make
arch/x86/kernel/syscall_64.i".
http://downloads.lustre.org/people/scjody/lkml/syscall_64.i
Cheers,
Jody
Quoted 2 lines
-hpa
H. Peter Anvin
reviewerQuoted 4 lines · Jody McIntyre
I'm confused as to why this matters - I didn't think the kernel build used any external includes (except for helper utilities like "conf".)
It *shouldn't* (except for UML), but it has been known to happen by accident.
I was particularly suspicious because you said "one of my systems", which implies other systems don't behave that way...
Now, the syscall_64.i you sent me is the working version, right? Could you send me the non-working version, too?
-hpa
Quoted 2 lines · H. Peter Anvin
I was particularly suspicious because you said "one of my systems", which implies other systems don't behave that way...
I have one other system that can build this kernel, and one that gets further. The differences are gcc version (all distro-supplied), .config, and in one case X86_32 vs. X86_64.
Quoted 2 lines
Now, the syscall_64.i you sent me is the working version, right? Could you send me the non-working version, too?
That's the non-working version. I just verified:
root@vm1:~/linux-2.6# make clean && make arch/x86/kernel/syscall_64.o [...] CC arch/x86/kernel/syscall_64.o arch/x86/kernel/syscall_64.c:27: error: array index in initializer exceeds array bounds arch/x86/kernel/syscall_64.c:27: error: (near initialization for ‘sys_call_table’) arch/x86/kernel/syscall_64.c:27: warning: excess elements in array initializer arch/x86/kernel/syscall_64.c:27: warning: (near initialization for ‘sys_call_table’) make[1]: *** [arch/x86/kernel/syscall_64.o] Error 1 make: *** [arch/x86/kernel/syscall_64.o] Error 2 root@vm1:~/linux-2.6# make arch/x86/kernel/syscall_64.i CHK include/linux/version.h CHK include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 CALL scripts/checksyscalls.sh CPP arch/x86/kernel/syscall_64.i
The resulting .i file is identical (checked md5sum) to the one on the http site: http://downloads.lustre.org/people/scjody/lkml/syscall_64.i
Cheers,
Jody
Quoted 11 lines · Jody McIntyre
1965aae3c98397aad957412413c07e97b1bd4e64broke compilation on one of my systems:CC arch/x86/kernel/syscall_64.o
arch/x86/kernel/syscall_64.c:27: error: array index in initializer exceeds array boundsarch/x86/kernel/syscall_64.c:27: error: (near initialization for ‘sys_call_table’)arch/x86/kernel/syscall_64.c:27: warning: excess elements in array initializerarch/x86/kernel/syscall_64.c:27: warning: (near initialization for ‘sys_call_table’) make[1]: *** [arch/x86/kernel/syscall_64.o] Error 1
make: *** [arch/x86/kernel/syscall_64.o] Error 2
Quoted 4 lines
Reverting only the parts of the commit that change
ASM_X86__UNISTD_64_Hto_ASM_X86_UNISTD_64_Hfixes the problem. Patch below.I have no idea what's going on here. Compiler bug?
Maybe you have stale header files in include/asm-x86/? That sometimes happens if you git-checkout -f or git-reset --hard.
Arnd <><
Hi Arnd,
Quoted 2 lines · Arnd Bergmann
Maybe you have stale header files in
include/asm-x86/? That sometimes happens if you git-checkout -f or git-reset --hard.
Your suggestion led me to the actual problem: the rsync command I was running to get files to my build machine was missing --delete, which meant the build machine's tree had all sorts of cruft.
With that change, I can successfully build the latest Linus kernel without any patches. Sorry to have wasted everyone's time.
Jody (crawls back under rock)
Quoted 1 line
Arnd <><
H. Peter Anvin
reviewerQuoted 12 lines · Arnd Bergmann
Quoted 11 lines · Jody McIntyre
1965aae3c98397aad957412413c07e97b1bd4e64broke compilation on one of my systems:CC
arch/x86/kernel/syscall_64.oarch/x86/kernel/syscall_64.c:27: error: array index in initializer exceeds array boundsarch/x86/kernel/syscall_64.c:27: error: (near initialization for ‘sys_call_table’)arch/x86/kernel/syscall_64.c:27: warning: excess elements in array initializerarch/x86/kernel/syscall_64.c:27: warning: (near initialization for ‘sys_call_table’) make[1]: *** [arch/x86/kernel/syscall_64.o] Error 1
make: *** [arch/x86/kernel/syscall_64.o] Error 2
Quoted 8 lines
Quoted 4 lines
Reverting only the parts of the commit that change
ASM_X86__UNISTD_64_Hto_ASM_X86_UNISTD_64_Hfixes the problem. Patch below.I have no idea what's going on here. Compiler bug?
Maybe you have stale header files in
include/asm-x86/? That sometimes happens if you git-checkout -f or git-reset --hard.
"git cleanup" should be used to catch that classes of problems. I did notice that the include file trace used include/asm not arch/x86/include/asm, which to me implies something like this.
I just tried, and when I make a .i file on a clean tree I get:
# 10 "<full path>/arch/x86/include/asm/posix_types_64.h"
not
# 10 "include/asm/posix_types_64.h"
as the posted .i file has.
-hpa