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

Re: incompatible unaligned.h between x86 and ppc - kernel-hackers verify please



On Wed, 2004-11-03 at 17:24, Benjamin Herrenschmidt wrote:
> > Please point to the equally-optimized alternative
> > that works on all platforms.
> 
> If there is none, then rip off the kernel implementation or lobby glibc
> to provide one, or make a "libunaligned.so" and distribute it etc...
> 
> but to NOT rely on the kernel header, that is bogus.

Unless someone is using the -I option with gcc, this
is NOT a kernel header. It comes with glibc-headers.
It is therefore a glibc header. :-)

Now, it certainly is true that the header originates
from kernel source. By the time the user gets it though,
it is no longer a kernel header. It has, supposedly,
been cleaned up for userspace usage.

One could argue that the actual bug is that the #ifdef
is not getting removed in the creation of the glibc-headers
package. The more practical solution is to simply remove
the #ifdef from the kernel source, so that glibc-headers
will be generated without it.

> > > At least on arm this header can be wrong if userspace doesn't set
> > > __ARMEB__ (or source the correct kernel config before) with the correct
> > > endianness (arm can be LE or BE).
> > 
> > ARM should be using constants set by the compiler.
> > If __ARMEB__ is not compiler-defined, something is
> > broken.
> 
> Rubbish !
> 
> Kernel headers are totally free to use whatever macros they want in
> their implementation, none of that has to be available to userland.

Uh huh. This is true. The glibc-headers package could be
fixed to patch out the #ifdef. Heck, the kernel headers
could all start with this:

#ifndef __KERNEL__
#error Bug your glibc-headers maintainer to clean this file.
#endif

That's just making unneeded work though.

> Also, there is no  guarantee that get_unaligned() is inlined at all
> 
> > I'ld rather protect asm-i386/unaligned.h (as well as others archs) with
> > > __KERNEL__ than make asm-ppc/unaligned.h not protected..
> > 
> > Next time, start with i386. If Linus won't go for it,
> > then don't screw around adding __KERNEL__ to other places.
> > Stuff breaks, needlessly. I'd go so far as to say that
> > the Linux API has been broken on ppc.
> 
> Stop this crap please !

What crap? You're the one who implied that these were
somehow kernel headers. They're not. They come with
the glibc-headers package.

It really doesn't matter how this is fixed. It could be
fixed in the glibc-headers package. Alternately, the
kernel source could be made more friendly toward the
generation of glibc-headers. Obviously, one method is
much easier to implement, but either will do.




Reply to: