You might have a 32-bit userspace with a 64-bit kernel. You almost always want a 64-bit kernel, even for a purely 32-bit user-space. Especially if your (virtual) machine has more than 1GB of RAM, because a 32-bit kernel has to use HIGHMEM / PAE hacks and can't just map it all. i.e. i386 Ubuntu may still install an x86-64 kernel, and this is what uname
is showing you.
Use file /bin/ls
to see if your system binaries are ELF 32-bit LSB executable, Intel 80386
or ELF 64-bit LSB executable, x86-64
.
On a more recent distro, you might see ELF 64-bit LSB shared object, x86-64
if it builds packages with position-independent executables (PIE) enabled by default. Hopefully distros aren't doing this for 32-bit code, because PIC/PIE has measurable performance overhead in 32-bit mode, where RIP-relative addressing modes aren't available. Although distros do ship gcc configured with --enable-default-pie
, and that does apply to -m32
unless you turn it off. Anyway, PIE executables can use ASLR for the executable, not just for shared libraries, so there's a security advantage for a very small performance cost (in 64-bit code).