2006-09-20 13:27:25

by Mitch

[permalink] [raw]
Subject: UML build failure with 2.6.18


Hi

anyone having UML build failure with the shiny new 2.6.18


laptop /usr/src/sources/linux/linux-2.6.18# !ma
make ARCH=um
SYMLINK arch/um/include/kern_constants.h
SYMLINK arch/um/include/sysdep
make[1]: `arch/um/sys-i386/user-offsets.s' is up to date.
CHK arch/um/include/user_constants.h
CHK include/linux/version.h
CHK include/linux/compile.h
CC arch/um/os-Linux/process.o
arch/um/os-Linux/process.c:144: error: syntax error before 'getpid'
arch/um/os-Linux/process.c:146: warning: return type defaults to 'int'
arch/um/os-Linux/process.c:146: warning: function declaration isn't a
prototype
arch/um/os-Linux/process.c: In function '_syscall0':
arch/um/os-Linux/process.c:147: error: syntax error before '{' token
arch/um/os-Linux/process.c:162: error: syntax error before 'prot'
arch/um/os-Linux/process.c:209: error: parameter 'ok' is initialized
arch/um/os-Linux/process.c:211: error: syntax error before 'printk'
arch/um/os-Linux/process.c:279: error: syntax error before '*' token
make[1]: *** [arch/um/os-Linux/process.o] Error 1
make: *** [arch/um/os-Linux] Error 2





2006-09-20 15:24:42

by Jeff Dike

[permalink] [raw]
Subject: Re: UML build failure with 2.6.18

On Wed, Sep 20, 2006 at 05:27:12PM +0400, [email protected] wrote:
> anyone having UML build failure with the shiny new 2.6.18

> CC arch/um/os-Linux/process.o
> arch/um/os-Linux/process.c:144: error: syntax error before 'getpid'
> arch/um/os-Linux/process.c:146: warning: return type defaults to 'int'
> arch/um/os-Linux/process.c:146: warning: function declaration isn't a
> prototype
> arch/um/os-Linux/process.c: In function '_syscall0':
> arch/um/os-Linux/process.c:147: error: syntax error before '{' token
> arch/um/os-Linux/process.c:162: error: syntax error before 'prot'
> arch/um/os-Linux/process.c:209: error: parameter 'ok' is initialized
> arch/um/os-Linux/process.c:211: error: syntax error before 'printk'
> arch/um/os-Linux/process.c:279: error: syntax error before '*' token
> make[1]: *** [arch/um/os-Linux/process.o] Error 1
> make: *** [arch/um/os-Linux] Error 2

What's the host distro?

I just built (plus the jmmpbuf patch, which isn't the problem here)
and booted it, and it seems fine here.

Jeff

2006-09-20 15:31:32

by Mitch

[permalink] [raw]
Subject: Re: UML build failure with 2.6.18

It's no distro (built up myself, so you can assume a gentoo type build).
I'm building from scratch, so it should use no headers since i'm
building a kernel.

-------- Original Message --------
Subject: Re: UML build failure with 2.6.18
Date: Wed, 20 Sep 2006 11:22:57 -0400
From: Jeff Dike <[email protected]>
To: [email protected]
CC: [email protected]
References: <[email protected]>

On Wed, Sep 20, 2006 at 05:27:12PM +0400, [email protected] wrote:
> anyone having UML build failure with the shiny new 2.6.18

> CC arch/um/os-Linux/process.o
> arch/um/os-Linux/process.c:144: error: syntax error before 'getpid'
> arch/um/os-Linux/process.c:146: warning: return type defaults to 'int'
> arch/um/os-Linux/process.c:146: warning: function declaration isn't a
> prototype
> arch/um/os-Linux/process.c: In function '_syscall0':
> arch/um/os-Linux/process.c:147: error: syntax error before '{' token
> arch/um/os-Linux/process.c:162: error: syntax error before 'prot'
> arch/um/os-Linux/process.c:209: error: parameter 'ok' is initialized
> arch/um/os-Linux/process.c:211: error: syntax error before 'printk'
> arch/um/os-Linux/process.c:279: error: syntax error before '*' token
> make[1]: *** [arch/um/os-Linux/process.o] Error 1
> make: *** [arch/um/os-Linux] Error 2

What's the host distro?

I just built (plus the jmmpbuf patch, which isn't the problem here)
and booted it, and it seems fine here.

Jeff

2006-09-20 16:47:51

by Bill Rugolsky Jr.

[permalink] [raw]
Subject: Re: UML build failure with 2.6.18

On Wed, Sep 20, 2006 at 07:31:19PM +0400, Mitch wrote:
> It's no distro (built up myself, so you can assume a gentoo type build).
> I'm building from scratch, so it should use no headers since i'm
> building a kernel.

You are probably missing the syscall macros?

I saw a similar problem the other day and noticed on Fedora Core that
upgrading glibc-kernheaders-2.4-9.1.94 to glibc-kernheaders-3.0-45 caused
a regression in /usr/include/linux/unistd.h:

--- - 2006-09-20 12:45:31.195152000 -0400
+++ /usr/include/linux/unistd.h 2006-06-22 09:49:00.000000000 -0400
@@ -6,63 +6,5 @@
* Include machine specific syscallX macros
*/
#include <asm/unistd.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-
-
-#undef _syscall0
-#undef _syscall1
-#undef _syscall2
-#undef _syscall3
-#undef _syscall4
-#undef _syscall5
-#undef _syscall6
-
-
-#define _syscall0(type,name) \
-type name(void) \
-{\
- return syscall(__NR_##name);\
-}
-
-#define _syscall1(type,name,type1,arg1) \
-type name(type1 arg1) \
-{\
- return syscall(__NR_##name, arg1);\
-}
-
-#define _syscall2(type,name,type1,arg1,type2,arg2) \
-type name(type1 arg1,type2 arg2) \
-{\
- return syscall(__NR_##name, arg1, arg2);\
-}
-
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
-type name(type1 arg1,type2 arg2,type3 arg3) \
-{\
- return syscall(__NR_##name, arg1, arg2, arg3);\
-}
-
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
-type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
-{\
- return syscall(__NR_##name, arg1, arg2, arg3, arg4);\
-}
-
-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
- type5,arg5) \
-type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
-{\
- return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5);\
-}
-
-
-#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
- type5,arg5,type6,arg6) \
-type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
-{\
- return syscall(__NR_##name, arg1, arg2, arg3, arg4, arg5, arg6);\
-}
-

#endif /* _LINUX_UNISTD_H_ */


Regards,

Bill Rugolsky

2006-09-20 17:41:57

by Jeff Dike

[permalink] [raw]
Subject: Re: UML build failure with 2.6.18

On Wed, Sep 20, 2006 at 07:31:19PM +0400, Mitch wrote:
> It's no distro (built up myself, so you can assume a gentoo type build).
> I'm building from scratch, so it should use no headers since i'm
> building a kernel.

UML interacts with the host, by making system calls, so it needs the
host's libc headers.

Try the patch below.

Jeff

Index: linux-2.6.17/arch/um/os-Linux/process.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/process.c 2006-09-20 11:15:08.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/process.c 2006-09-20 13:35:24.000000000 -0400
@@ -140,11 +140,9 @@ void os_usr1_process(int pid)
* syscalls, and also breaks with clone(), which does not unshare the TLS.
*/

-inline _syscall0(pid_t, getpid)
-
int os_getpid(void)
{
- return(getpid());
+ return syscall(__NR_getpid);
}

int os_getpgrp(void)
Index: linux-2.6.17/arch/um/os-Linux/sys-i386/tls.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/sys-i386/tls.c 2006-06-18 13:49:35.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/sys-i386/tls.c 2006-09-20 13:37:27.000000000 -0400
@@ -3,8 +3,6 @@
#include "sysdep/tls.h"
#include "user_util.h"

-static _syscall1(int, get_thread_area, user_desc_t *, u_info);
-
/* Checks whether host supports TLS, and sets *tls_min according to the value
* valid on the host.
* i386 host have it == 6; x86_64 host have it == 12, for i386 emulation. */
@@ -17,7 +15,7 @@ void check_host_supports_tls(int *suppor
user_desc_t info;
info.entry_number = val[i];

- if (get_thread_area(&info) == 0) {
+ if(syscall(__NR_get_thread_area, &info) == 0){
*tls_min = val[i];
*supports_tls = 1;
return;
Index: linux-2.6.17/arch/um/os-Linux/tls.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/tls.c 2006-08-15 21:59:56.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/tls.c 2006-09-20 13:37:14.000000000 -0400
@@ -48,14 +48,11 @@ int os_get_thread_area(user_desc_t *info
#ifdef UML_CONFIG_MODE_TT
#include "linux/unistd.h"

-static _syscall1(int, get_thread_area, user_desc_t *, u_info);
-static _syscall1(int, set_thread_area, user_desc_t *, u_info);
-
int do_set_thread_area_tt(user_desc_t *info)
{
int ret;

- ret = set_thread_area(info);
+ ret = syscall(__NR_set_thread_area, info);
if (ret < 0) {
ret = -errno;
}
@@ -66,7 +63,7 @@ int do_get_thread_area_tt(user_desc_t *i
{
int ret;

- ret = get_thread_area(info);
+ ret = syscall(__NR_get_thread_area, info);
if (ret < 0) {
ret = -errno;
}

2006-09-20 21:05:41

by Mitch

[permalink] [raw]
Subject: Re: UML build failure with 2.6.18

Hi Jeff,

That works perfectly as did the previous patch. I knew how to fix the
problem anyhow, just wanted to know why i/if was the only person having
thr problem. I'm running glibc-2.3.6 and gcc-4.0.3.

Cheers
Mithc

-------- Original Message --------
Subject: Re: UML build failure with 2.6.18
Date: Wed, 20 Sep 2006 13:40:26 -0400
From: Jeff Dike <[email protected]>
To: Mitch <[email protected]>
CC: [email protected], "Bill Rugolsky Jr."
<[email protected]>
References: <[email protected]>

On Wed, Sep 20, 2006 at 07:31:19PM +0400, Mitch wrote:
> It's no distro (built up myself, so you can assume a gentoo type build).
> I'm building from scratch, so it should use no headers since i'm
> building a kernel.

UML interacts with the host, by making system calls, so it needs the
host's libc headers.

Try the patch below.

Jeff

Index: linux-2.6.17/arch/um/os-Linux/process.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/process.c 2006-09-20
11:15:08.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/process.c 2006-09-20
13:35:24.000000000 -0400
@@ -140,11 +140,9 @@ void os_usr1_process(int pid)
* syscalls, and also breaks with clone(), which does not unshare the TLS.
*/

-inline _syscall0(pid_t, getpid)
-
int os_getpid(void)
{
- return(getpid());
+ return syscall(__NR_getpid);
}

int os_getpgrp(void)
Index: linux-2.6.17/arch/um/os-Linux/sys-i386/tls.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/sys-i386/tls.c 2006-06-18
13:49:35.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/sys-i386/tls.c 2006-09-20
13:37:27.000000000 -0400
@@ -3,8 +3,6 @@
#include "sysdep/tls.h"
#include "user_util.h"

-static _syscall1(int, get_thread_area, user_desc_t *, u_info);
-
/* Checks whether host supports TLS, and sets *tls_min according to
the value
* valid on the host.
* i386 host have it == 6; x86_64 host have it == 12, for i386
emulation. */
@@ -17,7 +15,7 @@ void check_host_supports_tls(int *suppor
user_desc_t info;
info.entry_number = val[i];

- if (get_thread_area(&info) == 0) {
+ if(syscall(__NR_get_thread_area, &info) == 0){
*tls_min = val[i];
*supports_tls = 1;
return;
Index: linux-2.6.17/arch/um/os-Linux/tls.c
===================================================================
--- linux-2.6.17.orig/arch/um/os-Linux/tls.c 2006-08-15
21:59:56.000000000 -0400
+++ linux-2.6.17/arch/um/os-Linux/tls.c 2006-09-20 13:37:14.000000000 -0400
@@ -48,14 +48,11 @@ int os_get_thread_area(user_desc_t *info
#ifdef UML_CONFIG_MODE_TT
#include "linux/unistd.h"

-static _syscall1(int, get_thread_area, user_desc_t *, u_info);
-static _syscall1(int, set_thread_area, user_desc_t *, u_info);
-
int do_set_thread_area_tt(user_desc_t *info)
{
int ret;

- ret = set_thread_area(info);
+ ret = syscall(__NR_set_thread_area, info);
if (ret < 0) {
ret = -errno;
}
@@ -66,7 +63,7 @@ int do_get_thread_area_tt(user_desc_t *i
{
int ret;

- ret = get_thread_area(info);
+ ret = syscall(__NR_get_thread_area, info);
if (ret < 0) {
ret = -errno;
}