bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: struct ustat defined twice: gcc-3.3's include/linux/types.h and glib


From: Dan Kegel
Subject: Re: struct ustat defined twice: gcc-3.3's include/linux/types.h and glibc-2.3.2's sysdeps/generic/bits/ustat.h
Date: Tue, 27 May 2003 18:16:13 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020615 Debian/1.0.0-3

Dan Kegel wrote:
When I try to build glibc-2.3.2 with gcc-3.3 for sh4 ...,
I get the following error:

In file included from sys/ustat.h:30,
                 from ../sysdeps/unix/sysv/linux/ustat.c:21:
../sysdeps/generic/bits/ustat.h:26: error: redefinition of `struct ustat'

Well, I got past that error and a similar one with the following patch:

--- glibc-2.3.2/sysdeps/gnu/errlist.awk.old     Tue May 27 18:10:37 2003
+++ glibc-2.3.2/sysdeps/gnu/errlist.awk Tue May 27 18:10:47 2003
@@ -39,7 +39,7 @@

     print "/* This file is generated from errno.texi by errlist.awk.  */"
     print "";
-    print "#include <errno.h>";
+    print "#include <stdlib/errno.h>";
     print "#include <libintl.h>";
     print "";
     print "#ifndef ERR_REMAP";
--- glibc-2.3.2/sysdeps/unix/sysv/linux/sh/sys/user.h.old       Tue May 27 
16:07:25 2003
+++ glibc-2.3.2/sysdeps/unix/sysv/linux/sh/sys/user.h   Tue May 27 16:38:59 2003
@@ -19,9 +19,46 @@
 #ifndef _SYS_USER_H
 #define _SYS_USER_H    1

+/* The whole purpose of this file is for gdb/strace and gdb/strace
+   only. Don't read too much into it. Don't use it for anything other
+   than gdb/strace unless you know what you are doing. */
+/* This definition comes directly from the kernel headers.  If
+   anything changes in them this header has to be changed, too.  */
+
 #include <features.h>
+#include <asm/processor.h>
+#include <asm/ptrace.h>
+#include <asm/page.h>
+
+struct user_fpu_struct {
+ unsigned long fp_regs[16]; + unsigned long xfp_regs[16]; + unsigned long fpscr; + unsigned long fpul;
+};
+
+struct user {
+ struct pt_regs regs; + struct user_fpu_struct fpu; + int u_fpvalid; + size_t u_tsize; + size_t u_dsize; + size_t u_ssize; + unsigned long start_code; + unsigned long start_data; + unsigned long start_stack; + long int signal; + struct regs *u_ar0; + struct user_fpu_struct *u_fpstate; + unsigned long magic; + char u_comm[32];
+};

-#include <asm/user.h>
+#define NBPG                   PAGE_SIZE
+#define UPAGES                 1
+#define HOST_TEXT_START_ADDR   (u.start_code)
+#define HOST_DATA_START_ADDR   (u.start_data)
+#define HOST_STACK_END_ADDR    (u.start_stack + u.u_ssize * NBPG)

 #undef start_thread


but now compiling sysdeps/unix/sysv/linux/init-first.c fails with the error:

In file included from 
/home3/dank/crosstool/result/sh4-linux/gcc-3.3/sh4-linux/include/asm/elf.h:9,
                 from ../sysdeps/unix/sysv/linux/sys/procfs.h:32,
                 from ../linuxthreads_db/proc_service.h:20,
                 from ../linuxthreads_db/thread_dbP.h:7,
                 from ../linuxthreads/descr.h:43,
                 from ../linuxthreads/sysdeps/sh/tls.h:134,
                 from ../include/tls.h:3,
                 from ../sysdeps/generic/dl-lookupcfg.h:26,
                 from ../include/link.h:37,
                 from ../sysdeps/generic/ldsodefs.h:35,
                 from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
                 from ../sysdeps/unix/sysv/linux/init-first.c:30:
/home3/dank/crosstool/result/sh4-linux/gcc-3.3/sh4-linux/include/asm/user.h:32: 
error: redefinition of `struct user_fpu_struct'
/home3/dank/crosstool/result/sh4-linux/gcc-3.3/sh4-linux/include/asm/user.h:39: 
error: redefinition of `struct user'

Poking around a bit, it seems like the problem is that (to be like
other architectures) there should be a sysdeps/unix/sysv/linux/sh/sys/procfs.h.
The fact that there isn't causes the fallback headers in glibc to
try to include the kernel's elf.h, causing all sorts of problems.

I guess I'll try to provide a procfs.h, but I'm clearly tiptoeing
a bit beyond my ken here!
- Dan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]