All of lore.kernel.org
 help / color / mirror / Atom feed
* asm-mips/processor.h breaks compiling user applications such as iptables
@ 2004-07-15 22:22 Song Wang
  2004-07-15 22:56 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Song Wang @ 2004-07-15 22:22 UTC (permalink / raw)
  To: linux-mips

Hi, Ralf

I am building the latest iptables-1.2.11 against
linux-mips kernel 2.6.6.

When compiling extensions/libipt_state.c

#mips-linux-uclibc-gcc -s -Os -Wall -Wunused
-I/mipslinux2.6.6/linux/include -Iinclude/
-DIPTABLES_VERSION=\"1.2.11\"  -DNO_SHARED_LIBS=1
-D_INIT=ipt_state_init -c -o extensions/libipt_state.o
extensions/libipt_state.c

I got error

In file included from
/mipslinux2.6.6/linux/include/linux/spinlock.h:16,
                 from
/mipslinux2.6.6/linux/include/asm/atomic.h:21,
                 from
/mipslinux2.6.6/linux/include/linux/netfilter_ipv4/ip_conntrack.h:11,
                 from extensions/libipt_state.c:8:
/mipslinux2.6.6/linux/include/asm/processor.h:146:
error: parse error before "fpureg_t"
/mipslinux2.6.6/linux/include/asm/processor.h:146:
warning: type defaults to `int' in declaration of
`fpureg_t'
/mipslinux2.6.6/linux/include/asm/processor.h:146:
warning: data definition has no type or storage class
/mipslinux2.6.6/linux/include/asm/processor.h:149:
error: parse error before "fpureg_t"
/mipslinux2.6.6/linux/include/asm/processor.h:149:
warning: no semicolon at end of struct or union
/mipslinux2.6.6/linux/include/asm/processor.h:151:
error: parse error before '}' token
/mipslinux2.6.6/linux/include/asm/processor.h:161:
error: parse error before "fpureg_t"
/mipslinux2.6.6/linux/include/asm/processor.h:161:
warning: no semicolon at end of struct or union
/mipslinux2.6.6/linux/include/asm/processor.h:163:
error: parse error before '}' token
/mipslinux2.6.6/linux/include/asm/processor.h:166:
error: field `hard' has incomplete type
/mipslinux2.6.6/linux/include/asm/processor.h:167:
error: field `soft' has incomplete type
make[1]: *** [extensions/libipt_state.o] Error 1


I think the error is due to the line 146

typedef u64 fpureg_t;

The type 'u64' is defined in asm-mips/types.h, but
wrapped by #ifdef __KERNEL__, so when the compiler
compiles the user-level application, it cannot
recognize u64.

-Song





		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: asm-mips/processor.h breaks compiling user applications such as iptables
  2004-07-15 22:22 asm-mips/processor.h breaks compiling user applications such as iptables Song Wang
@ 2004-07-15 22:56 ` Ralf Baechle
  2004-07-16  2:01   ` Song Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2004-07-15 22:56 UTC (permalink / raw)
  To: Song Wang; +Cc: linux-mips

On Thu, Jul 15, 2004 at 03:22:34PM -0700, Song Wang wrote:

> I think the error is due to the line 146
> 
> typedef u64 fpureg_t;
> 
> The type 'u64' is defined in asm-mips/types.h, but
> wrapped by #ifdef __KERNEL__, so when the compiler
> compiles the user-level application, it cannot
> recognize u64.

Correct.  In general the policy is to avoid the use of kernel header
files in user space and copy it but there are still a few crucial tools
that don't follow this rule of Linus, so try below patch.  It also
removes the __KERNEL__ things left.

Cleaning up the use of kernel header to make them more usable for
userspace is one of the things on the agenda for 2.7.  It'll be alot of
hard and boring work but MIPS will be one of the architectures that will
greatly benefit from this.

  Ralf

Index: include/asm-mips/processor.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/processor.h,v
retrieving revision 1.94
diff -u -r1.94 processor.h
--- include/asm-mips/processor.h	28 Jun 2004 21:04:16 -0000	1.94
+++ include/asm-mips/processor.h	15 Jul 2004 22:42:29 -0000
@@ -143,7 +143,7 @@
 
 #define NUM_FPU_REGS	32
 
-typedef u64 fpureg_t;
+typedef __u64 fpureg_t;
 
 struct mips_fpu_hard_struct {
 	fpureg_t	fpr[NUM_FPU_REGS];
@@ -235,8 +235,6 @@
 	MF_FIXADE, 0, 0 \
 }
 
-#ifdef __KERNEL__
-
 struct task_struct;
 
 /* Free all resources held by a thread. */
@@ -264,8 +262,6 @@
 
 #define cpu_relax()	barrier()
 
-#endif /* __KERNEL__ */
-
 /*
  * Return_address is a replacement for __builtin_return_address(count)
  * which on certain architectures cannot reasonably be implemented in GCC

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: asm-mips/processor.h breaks compiling user applications such as iptables
  2004-07-15 22:56 ` Ralf Baechle
@ 2004-07-16  2:01   ` Song Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Song Wang @ 2004-07-16  2:01 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

--- Ralf Baechle <ralf@linux-mips.org> wrote:
> On Thu, Jul 15, 2004 at 03:22:34PM -0700, Song Wang
> wrote:
> 
> > I think the error is due to the line 146
> > 
> > typedef u64 fpureg_t;
> > 
> > The type 'u64' is defined in asm-mips/types.h, but
> > wrapped by #ifdef __KERNEL__, so when the compiler
> > compiles the user-level application, it cannot
> > recognize u64.
> 
> Correct.  In general the policy is to avoid the use
> of kernel header
> files in user space and copy it but there are still
> a few crucial tools
> that don't follow this rule of Linus, so try below
> patch.  It also
> removes the __KERNEL__ things left.
> 
> Cleaning up the use of kernel header to make them
> more usable for
> userspace is one of the things on the agenda for
> 2.7.  It'll be alot of
> hard and boring work but MIPS will be one of the
> architectures that will
> greatly benefit from this.
> 
>   Ralf
> 
Hi, Ralf

I tested the patch and it compiles fine now, although
when iptables actually runs on mips32, all the 
tcp/udp port numbers are shown as 0 and IP address
shown as 0.0.0.0. I'll dig more.

Anyway, you made a good point for kernel headers
problem. It's kinda headache.

Similar problem happened to asm-mips/page.h when
including <spaces.h> in 2.6.6, but it seemed that
you already fixed in the latest cvs version.

Thanks.

-Song


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-16  2:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-15 22:22 asm-mips/processor.h breaks compiling user applications such as iptables Song Wang
2004-07-15 22:56 ` Ralf Baechle
2004-07-16  2:01   ` Song Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.