linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Possible problem in asm/bitops.h
@ 2002-12-11 15:31 Georg Klug
  2002-12-12 15:28 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Georg Klug @ 2002-12-11 15:31 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all,

today I tried to compile the iproute2-2.4.7-now-ss010824 for my walnut-like
custom board. But unfortunately it fails: (original make output below)

The reason seems to be that linux/inetdevice.h uses the inline function ffz()
to define another inline function inet_mask_len(). The ffz() function is
defined in the include file asm/bitops.h. But now there is some inconsistency
between the asm-i386/ and the asm-ppc/ directory: while the asm-i386/bitops.h
defines the ffz function for all includes, the asm-ppc/bitops.h restricts the
ffz function (and also some others) to kernel files (with #ifdef __KERNEL__).

 I then tried to remove the #ifdef __KERNEL__ from the first significant line
of the asm-ppc/bitops.h file, but now the compiler complained about the missing
macro definition of PPC405_ERR77(). This one is defined in the asm-ppc/atomic.h
as well as in asm-ppc/ppc_asm.h, but - unfortunately - differently. (One has
double quotes, the other not.) The definition in atomic.h is only for kernel
files, but I moved it out of the #ifdef __KERNEL__ and could successfully
compile
iproute2.

 But here are my questions:
Q: Is the ffz() function desgined to work in a user space application, too? If
   yes, the file asm-ppc/bitops.h would need a change.
Q: Does it make any sense to define one single macro (PPC405_ERR77()) in
different
   ways in different include files?

What is your opinion?
Kind regards,
Georg Klug


------------- output of the make ---------------------------------
make KERNEL_INCLUDE=/var/samba/Users/gklug/Work/tmp/linux-2.4.17_mvl21/include
CC=ppc_405-gcc
make[1]: Entering directory
`/var/samba/Users/gklug/Work/linux/tools/net/iproute2/lib'
ppc_405-gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -Werror -g -I../include-
glibc -include
../include-glibc/glibc-bugs.h -I/var/samba/Users/gklug/Work/tmp/linux-2.4.17_mvl
21/include -I../include -DRESOLVE_HOSTNAMES   -c -o ll_map.o ll_map.c
ppc_405-gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -Werror -g -I../include-
glibc -include
../include-glibc/glibc-bugs.h -I/var/samba/Users/gklug/Work/tmp/linux-2.4.17_mvl
21/include -I../include -DRESOLVE_HOSTNAMES   -c -o libnetlink.o libnetlink.c
ar rcs libnetlink.a ll_map.o libnetlink.o
ppc_405-gcc -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall -Werror -g -I../include-
glibc -include
../include-glibc/glibc-bugs.h -I/var/samba/Users/gklug/Work/tmp/linux-2.4.17_mvl
21/include -I../include -DRESOLVE_HOSTNAMES   -c -o utils.o utils.c
cc1: warnings being treated as errors
In file included from ../include/utils.h:6,
                 from utils.c:30:
/var/samba/Users/gklug/Work/tmp/linux-2.4.17_mvl21/include/linux/inetdevice.h:
In function `inet_mask_len':
/var/samba/Users/gklug/Work/tmp/linux-2.4.17_mvl21/include/linux/inetdevice.h:16
3: warning: implicit declaration of function `ffz'
make[1]: *** [utils.o] Error 1
make[1]: Leaving directory
`/var/samba/Users/gklug/Work/linux/tools/net/iproute2/lib'
make: *** [all] Error 2
------------------------------------------------------------------


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Possible problem in asm/bitops.h
  2002-12-11 15:31 Possible problem in asm/bitops.h Georg Klug
@ 2002-12-12 15:28 ` Tom Rini
  2002-12-17  9:10   ` AW: " Georg Klug
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2002-12-12 15:28 UTC (permalink / raw)
  To: Georg Klug; +Cc: linuxppc-embedded


On Wed, Dec 11, 2002 at 04:31:14PM +0100, Georg Klug wrote:

> Q: Is the ffz() function desgined to work in a user space application, too? If
>    yes, the file asm-ppc/bitops.h would need a change.
> Q: Does it make any sense to define one single macro (PPC405_ERR77()) in
> different
>    ways in different include files?

The problem here is that userland programs are _not_ allowed to use
kernel headers, iirc, even programs which are tied to the kernel in some
way.  They _must_ make a local copy of the include file which they
actually need.  I suspect the actual problem is that iproute2 only needs
a very small amount of what is in include/linux/inetdev.h

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* AW: Possible problem in asm/bitops.h
  2002-12-12 15:28 ` Tom Rini
@ 2002-12-17  9:10   ` Georg Klug
  2002-12-17 10:16     ` Paul Mackerras
  2002-12-17 14:59     ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Georg Klug @ 2002-12-17  9:10 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded


Hi Tom,

> On Wed, Dec 11, 2002 at 04:31:14PM +0100, Georg Klug wrote:
>
> > Q: Is the ffz() function desgined to work in a user space
> application, too? If
> >    yes, the file asm-ppc/bitops.h would need a change.
> > Q: Does it make any sense to define one single macro (PPC405_ERR77()) in
> > different
> >    ways in different include files?
>
> The problem here is that userland programs are _not_ allowed to use
> kernel headers, iirc, even programs which are tied to the kernel in some
> way. They _must_ make a local copy of the include file which they
> actually need.

Oops, I thought, that the directories /usr/include/linux as well as
/usr/include/asm should come directly from the kernel (either as a copy
or symbolically linked). In that case those include files should always
be prepared to be included in a userland application. Am I right with this?

I also thought, that the asm-ppc/bitops.h should provide the same
functionality as its pendant in asm-i386/ which lets userland applications
use some static inline functions like set_bit() clear_bit() and change_bit().
I actually don't know whether those functions are needed outside the kernel,
so I cannot tell whether it is correct or not. But IMO it should be done
the same way on all plattforms. Would you agree?

> I suspect the actual problem is that iproute2 only needs
> a very small amount of what is in include/linux/inetdev.h

That might be true. But would the solution be to copy the linux/inetdev.h
to a local directory and change that file until it doesn't need the file
asm/bitops.h anymore?

Sorry for asking a little bit pedantic, but I want to set-up a complete
environment for building a kernel as well as all the needed userland
applications for our custom ppc_405 (walnut based) boards.

Thanks in advance for answering my questions,
Georg Klug


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: AW: Possible problem in asm/bitops.h
  2002-12-17  9:10   ` AW: " Georg Klug
@ 2002-12-17 10:16     ` Paul Mackerras
  2002-12-17 14:59     ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Mackerras @ 2002-12-17 10:16 UTC (permalink / raw)
  To: Georg Klug; +Cc: Tom Rini, linuxppc-embedded


Georg Klug writes:

> Oops, I thought, that the directories /usr/include/linux as well as
> /usr/include/asm should come directly from the kernel (either as a copy

That is how it used to be done, but that way of doing things has been
deprecated for a long time now.  /usr/include/{linux,asm} are part of
glibc these days.

> or symbolically linked). In that case those include files should always
> be prepared to be included in a userland application. Am I right with this?
>
> I also thought, that the asm-ppc/bitops.h should provide the same
> functionality as its pendant in asm-i386/ which lets userland applications
> use some static inline functions like set_bit() clear_bit() and change_bit().
> I actually don't know whether those functions are needed outside the kernel,
> so I cannot tell whether it is correct or not. But IMO it should be done
> the same way on all plattforms. Would you agree?

The policy is the same on all architectures: userland programs should
not include kernel headers.  The architectures differ in the extent to
which this is enforced, that's all.

Paul.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: Possible problem in asm/bitops.h
  2002-12-17  9:10   ` AW: " Georg Klug
  2002-12-17 10:16     ` Paul Mackerras
@ 2002-12-17 14:59     ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2002-12-17 14:59 UTC (permalink / raw)
  To: Georg Klug; +Cc: linuxppc-embedded


On Tue, Dec 17, 2002 at 10:10:09AM +0100, Georg Klug wrote:

> > I suspect the actual problem is that iproute2 only needs
> > a very small amount of what is in include/linux/inetdev.h
>
> That might be true. But would the solution be to copy the linux/inetdev.h
> to a local directory and change that file until it doesn't need the file
> asm/bitops.h anymore?

Correct.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2002-12-17 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-11 15:31 Possible problem in asm/bitops.h Georg Klug
2002-12-12 15:28 ` Tom Rini
2002-12-17  9:10   ` AW: " Georg Klug
2002-12-17 10:16     ` Paul Mackerras
2002-12-17 14:59     ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).