possible problem with generic asm/types.h
While building some stuff for aarch64, I ran into a conflict between the kernel's definition of __s64 and glibc's definition of int64_t. The package I was building (fuse) does this:
#include <stdint.h> #define __s64 int64_t
The kernel typedefs __s64 in asm/types.h and due to ordering of includes in the fuse package sources, the kernel __s64 gets used at some points while the fuse __s64 gets used in others. This leads to a build failure on aarch64 because glibc typedefs int64_t as a long while kernel uses long long for __s64. Both are 64bits but it creates a type conflict in some of the fuse code. But this same fuse code builds on other arches so I looked a further and found what I think is a problem with the kernel's asm-generic/types.h file which has:
/*
* int-ll64 is used practically everywhere now,
* so use it as a reasonable default.
*/
#include <asm-generic/int-ll64.h>Shouldn't this be:
#include <asm/bitsperlong.h>
#if __BITS_PER_LONG == 64
#include <asm-generic/int-l64.h>
#else
#include <asm-generic/int-ll64.h>
#endif--Mark
Quoted 2 lines · Mark Salter
/*
* int-ll64 is used practically everywhere now,
This comment is obsolete, it's used everywhere now.
Quoted 4 lines
* so use it as a reasonable default.
*/
#include <asm-generic/int-ll64.h>Quoted 8 lines
Shouldn't this be:
#include <asm/bitsperlong.h> #if __BITS_PER_LONG == 64 #include <asm-generic/int-l64.h> #else #include <asm-generic/int-ll64.h> #endif
No. Inside the kernel, all 64-bit platforms use int-ll64.h.
For backwards compatibility, alpha, ia64, mips, and powerpc (unless __SANE_USERSPACE_TYPES__ is defined) still use int-l64.h in userspace.
So it seems your glibc ues the old convention. Any chance you can still switch?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 12 lines · Geert Uytterhoeven
Quoted 2 lines · Mark Salter
/*
* int-ll64 is used practically everywhere now,This comment is obsolete, it's used everywhere now.
Quoted 6 lines
* so use it as a reasonable default. */ #include <asm-generic/int-ll64.h>Shouldn't this be:
Quoted 8 lines
Quoted 6 lines
#include <asm/bitsperlong.h> #if __BITS_PER_LONG == 64 #include <asm-generic/int-l64.h> #else #include <asm-generic/int-ll64.h> #endifNo. Inside the kernel, all 64-bit platforms use
int-ll64.h.
Except for alpha and ia64...
Quoted 6 lines
For backwards compatibility, alpha, ia64, mips, and powerpc (unless
__SANE_USERSPACE_TYPES__is defined) still useint-l64.hin userspace.So it seems your glibc ues the old convention. Any chance you can still switch?
Not glibc, which provides the same stdint.h for all arches. The problem is the namespace pollution caused by the app defining __s64 to be glibc's int64_t. I assume that aarch64 kernel headers pull in the kernel definition of __s64 for some reason where other kernel arches do not. So it is just by luck that fuse builds on the other arches. I think I'll take it up with the fuse maintainers...
--Mark
Quoted 3 lines · Mark Salter
Quoted 1 line
No. Inside the kernel, all 64-bit platforms use
int-ll64.h.Except for alpha and ia64...
Nope:
$ git grep int-l arch/{alpha,ia64}/include/asm/types.h
arch/alpha/include/asm/types.h:#include <asm-generic/int-ll64.h>
arch/ia64/include/asm/types.h:#include <asm-generic/int-ll64.h>
$Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 11 lines · Geert Uytterhoeven
Quoted 3 lines · Mark Salter
Quoted 1 line
No. Inside the kernel, all 64-bit platforms use
int-ll64.h.Except for alpha and ia64...
Nope:
$ git grep int-l arch/{alpha,ia64}/include/asm/types.h arch/alpha/include/asm/types.h:#include <asm-generic/int-ll64.h> arch/ia64/include/asm/types.h:#include <asm-generic/int-ll64.h> $
Hmm.
$ git grep int-l arch/{alpha,ia64}/include/uapi/asm/types.h
arch/alpha/include/uapi/asm/types.h:#include <asm-generic/int-l64.h>
arch/ia64/include/uapi/asm/types.h:#include <asm-generic/int-l64.h>Quoted 3 lines · Mark Salter
Quoted 2 lines · Geert Uytterhoeven
Quoted 1 line · Mark Salter
Quoted 1 line
No. Inside the kernel, all 64-bit platforms use
int-ll64.h.
^^^^^^^^^^^^^^^^
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines
Except for alpha and ia64...
Nope:
$ git grep int-l arch/{alpha,ia64}/include/asm/types.h arch/alpha/include/asm/types.h:#include <asm-generic/int-ll64.h> arch/ia64/include/asm/types.h:#include <asm-generic/int-ll64.h> $
Quoted 5 lines
Hmm.
$ git grep int-l arch/{alpha,ia64}/include/uapi/asm/types.h arch/alpha/include/uapi/asm/types.h:#include <asm-generic/int-l64.h> arch/ia64/include/uapi/asm/types.h:#include <asm-generic/int-l64.h>
As I wrote before:
Quoted 2 lines
For backwards compatibility, alpha, ia64, mips, and powerpc (unless
__SANE_USERSPACE_TYPES__is defined) still useint-l64.hin userspace.
^^^^^^^^^^^^
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Arnd Bergmann
maintainerQuoted 7 lines · Mark Salter
While building some stuff for aarch64, I ran into a conflict between the kernel's definition of
__s64and glibc's definition ofint64_t. The package I was building (fuse) does this:#include <stdint.h> #define __s64 int64_t
It's an old bug in fuse. The header that ships with the kernel should work fine, just update your user space package.
Arnd