Bug 10785 - compilation error with ARCH=um ; sys-i386/registers.c:8:22: error: asm/user.h: No such file or directory
Summary: compilation error with ARCH=um ; sys-i386/registers.c:8:22: error: asm/user...
Status: REJECTED INVALID
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: UML (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: J
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-24 05:52 UTC by J
Modified: 2008-05-28 10:50 UTC (History)
2 users (show)

See Also:
Kernel Version: linux-2.6.26-rc3
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
removing arch_validate because not used and to prevent compilation error (2.65 KB, patch)
2008-05-26 16:50 UTC, J
Details | Diff

Description J 2008-05-24 05:52:21 UTC
Latest working kernel version: ??? (could not compile the 2.6.25 due to gcc bug) and linux-2.6.24 due to other bugs. 
Earliest failing kernel version: 
Distribution: fedora
Hardware Environment: 

Intel(R) Pentium(R) 4 CPU 3.00GHz (smp) with 2 processor (32 bit)


Software Environment:
    gcc-4.3.0-8.i386
    make-3.81-12.fc9.i386


Problem Description:

Trying to use config files from http://uml.nagafix.co.uk/kernels/
for the  linux-2.6.26-rc3 using the .25 config file for 32 bits


Steps to reproduce:

copy config file to the kernel linux directory.
rename it as: .config
$ make V=1 ARCH=um oldconfig
..... output of the config file
$ make V=1 ARCH=um
....
  gcc -Wp,-MD,arch/um/os-Linux/sys-i386/.registers.o.d  -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -fno-stack-protector -D__arch_um__ -DSUBARCH=\"i386\" -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback -Din6addr_any=kernel_in6addr_any -march=i686 -mtune=generic -mpreferred-stack-boundary=2 -ffreestanding -D_LARGEFILE64_SOURCE  -fno-unit-at-a-time -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wno-pointer-sign -Iarch/um/include -I/home/jtawork/tmp/kernel/linux-2.6.26-rc3/arch/um/include/skas  -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -c -o arch/um/os-Linux/sys-i386/registers.o arch/um/os-Linux/sys-i386/registers.c
arch/um/os-Linux/sys-i386/registers.c:8:22: error: asm/user.h: No such file or directory
arch/um/os-Linux/sys-i386/registers.c: In function ‘arch_init_registers’:
arch/um/os-Linux/sys-i386/registers.c:78: error: storage size of ‘fpx_regs’ isn’t known
arch/um/os-Linux/sys-i386/registers.c:78: warning: unused variable ‘fpx_regs’
make[2]: *** [arch/um/os-Linux/sys-i386/registers.o] Error 1
make[1]: *** [arch/um/os-Linux/sys-i386] Error 2
make: *** [arch/um/os-Linux] Error 2
Comment 1 J 2008-05-24 06:25:41 UTC
calling gcc:
gcc -Wp,-MD,arch/um/os-Linux/sys-i386/.registers.o.d  -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -fno-stack-protector -DCONFIG_X86_32 -D__CORRECTINGBUG__  -D__arch_um__ -DSUBARCH=\"i386\" -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback -Din6addr_any=kernel_in6addr_any -march=i686 -mtune=generic -mpreferred-stack-boundary=2 -ffreestanding -D_LARGEFILE64_SOURCE  -fno-unit-at-a-time -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wno-pointer-sign -Iarch/um/include -I/home/jtawork/tmp/kernel/linux-2.6.26-rc3/arch/um/include/skas -Iinclude  -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -c -o arch/um/os-Linux/sys-i386/registers.o arch/um/os-Linux/sys-i386/registers.c

does not return any errors.
This is with the following changes:
added the following options -DCONFIG_X86_32 

the -D__CORRECTINGBUG__

corresponds to the following change in:
--- include/asm/page.h	2008-05-18 23:36:41.000000000 +0200
+++ ../linux-2.6.26-rc3-a/include/asm/page.h	2008-05-24 12:33:24.000000000 +0200
@@ -118,7 +118,10 @@
 #define pfn_valid(pfn) ((pfn) < max_mapnr)
 #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))
 
+
+#ifndef __CORRECTINGBUG__
 extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
+#endif
 #define HAVE_ARCH_VALIDATE
 
 #include <asm-generic/memory_model.h>
Comment 2 J 2008-05-24 07:26:11 UTC
The compilation continues with:

--- arch/um/os-Linux/sys-i386/Makefile	2008-05-24 16:22:39.000000000 +0200
+++ ../linux-2.6.26-rc3/arch/um/os-Linux/sys-i386/Makefile	2008-05-18 23:36:41.000000000 +0200
@@ -3,13 +3,8 @@
 # Licensed under the GPL
 #
 
-
 obj-y = registers.o signal.o task_size.o tls.o
 
 USER_OBJS := $(obj-y)
 
-#
-CFLAGS_registers.o += -DCONFIG_X86_32 -Iinclude 
-
-
 include arch/um/scripts/Makefile.rules
Comment 3 J 2008-05-24 07:32:15 UTC
OOPS... should be the opposite (i.e we add -DCONFIG_X86_32 and -Iinclude):

diff -u ../linux-2.6.26-rc3/arch/um/os-Linux/sys-i386/Makefile arch/um/os-Linux/sys-i386/Makefile
--- ../linux-2.6.26-rc3/arch/um/os-Linux/sys-i386/Makefile	2008-05-18 23:36:41.000000000 +0200
+++ arch/um/os-Linux/sys-i386/Makefile	2008-05-24 16:22:39.000000000 +0200
@@ -3,8 +3,13 @@
 # Licensed under the GPL
 #
 
+
 obj-y = registers.o signal.o task_size.o tls.o
 
 USER_OBJS := $(obj-y)
 
+#
+CFLAGS_registers.o += -DCONFIG_X86_32 -Iinclude 
+
+
 include arch/um/scripts/Makefile.rules

--- include/asm/page.h  2008-05-18 23:36:41.000000000 +0200
+++ ../linux-2.6.26-rc3-a/include/asm/page.h    2008-05-24 12:33:24.000000000
+0200
@@ -118,7 +118,10 @@
 #define pfn_valid(pfn) ((pfn) < max_mapnr)
 #define virt_addr_valid(v) pfn_valid(phys_to_pfn(__pa(v)))

+
+#ifndef CONFIG_X86_32
 extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
+#endif
 #define HAVE_ARCH_VALIDATE

 #include <asm-generic/memory_model.h>


Note that not removing arch_validate causes the following error:
In file included from include/asm/arch/user_64.h:5,
                 from include/asm/arch/user.h:4,
                 from include/asm/user.h:4,
                 from arch/um/os-Linux/sys-i386/registers.c:8:
include/asm/page.h:123: error: expected declaration specifiers or ‘...’ before ‘gfp_t’
In file included from include/linux/ptrace.h:49,
                 from arch/um/include/sysdep/ptrace_user.h:10,
                 from arch/um/os-Linux/sys-i386/registers.c:12:
include/asm/ptrace.h:50: warning: ‘struct user_fxsr_struct’ declared inside parameter list
include/asm/ptrace.h:50: warning: its scope is only this definition or declaration, which is probably not what you want
include/asm/ptrace.h:52: warning: ‘struct user_fxsr_struct’ declared inside parameter list
arch/um/os-Linux/sys-i386/registers.c: In function ‘arch_init_registers’:
arch/um/os-Linux/sys-i386/registers.c:78: error: storage size of ‘fpx_regs’ isn’t known
arch/um/os-Linux/sys-i386/registers.c:78: warning: unused variable ‘fpx_regs’
make[2]: *** [arch/um/os-Linux/sys-i386/registers.o] Error 1
make[1]: *** [arch/um/os-Linux/sys-i386] Error 2
make: *** [arch/um/os-Linux] Error 2
Comment 4 J 2008-05-25 18:50:46 UTC
Note that the patch of  ../linux-2.6.26-rc3-a/include/asm/page.h:

#ifndef __CORRECTINGBUG__
 extern struct page *arch_validate(struct page *page, gfp_t mask, int order);
+#endif

is for the supplementary error caused after the arch/asm/user.h problem has been solved.

the output of this error message is:
In file included from include/asm/arch/user_32.h:5,
                 from include/asm/arch/user.h:3,
                 from include/asm/user.h:5,
                 from arch/um/os-Linux/sys-i386/registers.c:9:
include/asm/page.h:121: error: expected declaration specifiers or ‘...’ before ‘gfp_t’
make[2]: *** [arch/um/os-Linux/sys-i386/registers.o] Error 1
make[1]: *** [arch/um/os-Linux/sys-i386] Error 2
make: *** [arch/um/os-Linux] Error 2

I looked for an explanation but I do not know what the problem is.
Comment 5 J 2008-05-25 18:52:23 UTC
still present in: 2.6.26-rc3-git7 	2008-05-24 19:01 UTC

this is not astonishing though.
Comment 6 J 2008-05-26 16:47:54 UTC
I discovered the following patch submitted to the kernel mailing list:

http://lkml.org/lkml/2008/4/24/37

It consist in removing altogether "arch_validate" from arch/um/mem.c, include/asm/page.h and arch/um/ksyms.c 

It also makes the variable: 'empty_bad_page' static.

This solves the problem from comment #4.

And the compile problem of this bug is solved by adding:
CFLAGS_registers.o += -DCONFIG_X86_32 -Iinclude 
to arch/um/os-Linux/sys-i386/Makefile

NOTE please that I am not sure adding these CFLAGS are the most suitable method.

I'll add this here as a patch. 
Comment 7 J 2008-05-26 16:50:13 UTC
Created attachment 16287 [details]
removing arch_validate  because not used and to prevent compilation error

[Patch] arch/um/kernel/mem.c: remove arch_validate()

This patch solves two kernel compilation problems with um architecture:
1/ error: asm/user.h: No such file or directory in arch/um/os-Linux/sys-i386/registers.c
2/ include/asm/page.h:121: error: expected declaration specifiers or ‘...’

A similar patch was posted: http://lkml.org/lkml/2008/4/24/37 (with a supplementary 
change) by Wang Cong.
Comment 8 Jeff Dike 2008-05-28 08:49:48 UTC
You are just randomly patching things without understanding why things are as they are.  The problems that you hit after "fixing" one problem are a good sign that you didn't really fix anything.

This all starts with asm/user.h not being available from libc.  This is a libc kernel headers bug, not a UML bug, as far as I can tell.  Without user.h, there is no way to use any of the ptrace FP get or set registers.  End of story.

However, you observed that there is a asm/user.h in the kernel tree and that adding -Iinclude will pull it in.  But, this is a kernel header, and is not usable in libc code, which is what registers.c is.  This in turn causes the gfp_t problems, which you fix by removing arch/validate (which isn't necessarily wrong, since it's unused, but what would you have done if it was used?).
Comment 9 J 2008-05-28 10:50:18 UTC
Thanks for the answer. I do appreciate.

- The bug report was first of all a report that the kernel did NOT compile with ARCH=um (just in case it had not been already reported).
- I guess the bug is closed because of the problem described in: http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg225786.html 

I consider this bug report closed. I thank you again for the feedback.

Note You need to log in before you can comment on or make changes to this bug.