Questions tagged [linux-x32-abi]

Linux's x32 ABI is 64-bit code with 32-bit pointers. All the advantages of 64-bit but with a cache footprint similar to 32-bit code. Plain old 32-bit code uses the i386 ABI, not x32.

x32 is a Linux ABI that combines the larger register set of x86_64 with smaller memory and cache footprint using 32-bit pointers. Code produced for the environment can run up to 40% faster than non-x32 code.

The official ABI documentation is here (in LaTeX source). (TODO: find a pdf built from that source).

x32 is not the same thing as legacy 32-bit. (That's the Intel386 or i386 System V psABI. See also the tag wiki for more ABI links).

x32 support was added to the Linux 3.4 kernel. It requires GLIBC 2.11 and GCC 4.8. In addition, a modern distribution, like Debian 8, Fedora 17 or Ubuntu 13.04 is needed.

The x32 extensions must be compiled into the kernel, and must be enabled at boot time with a option like GRUB_CMDLINE_LINUX="syscall.x32=y".

The x32 ABI is rarely used. Some modern distros (like Arch) don't build support for it in their default kernel. Many people either don't think the extra complication of supporting another ABI (and set of libraries) is worth the performance benefit, or don't realize the performance benefit of the reduced cache footprint.

18 questions
8
votes
2 answers

difference between i386:x64-32 vs i386 vs i386:x86_64

Can someone explain the difference between the three architectures? Actually when I built a 64-bit application in Linux, I got a link error saying: skipping incompatible library.a when searching for library.a Then I used objdump -f on that library…
Santhosh Kumar
  • 167
  • 2
  • 12
7
votes
1 answer

What must be recompiled to run a x32 ABI application?

Can I compile an application with the new x32 ABI, and then run it in a normal kernel? What about the runtime C library? Is there any form of interoperability with precompiled x86/x86_64 libraries?
Lorenzo Pistone
  • 5,028
  • 3
  • 34
  • 65
6
votes
3 answers

How should the [u]int_fastN_t types be defined for x86_64, with or without the x32 ABI?

The x32 ABI specifies, among other things, 32-bit pointers for code generated for the x86_64 architecture. It combines the advantages of the x86_64 architecture (including 64-bit CPU registers) with the reduced overhead of 32-bit pointers. The…
Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
6
votes
2 answers

What <4GB workloads would have worse performance in the Linux x32 ABI than x64?

There is a relatively new Linux ABI referred to as x32, where the x86-64 processor runs in 32-bit mode, so pointers are still only 32-bits, but the 64-bit architecture specific registers are still used. So you're still limited to 4GB max memory use…
Joseph Garvin
  • 20,727
  • 18
  • 94
  • 165
3
votes
1 answer

Bus error when executing `emms` MMX instruction

I'm working on a port of some software with inline assembly because we took a few bug reports from a Debian maintainer under X32. The code is fine under both X86 and X64. We're catching a bus error on the emms instruction: ... 0x005520fd…
jww
  • 97,681
  • 90
  • 411
  • 885
3
votes
2 answers

How to detect X32 ABI or environment in the preprocessor?

X32 is an ABI for amd64/x86_64 CPUs using 32-bit pointers. The idea is to combine the larger register set of x86_64 with the smaller memory and cache footprint resulting from 32-bit pointers. It provides up to about a 40% speedup. See Difference…
jww
  • 97,681
  • 90
  • 411
  • 885
2
votes
1 answer

Error: no instruction for this cpu level (or, force REX prefix)

I'm working on an X32 object file, which uses 32-bit Integers, Longs and Pointers. I'm building the object file like so: nasm -f elfx32 rdrand.S -DX32 -o rdrand-x32.o rdrand.S is multi-platofrm (X86, X32 and X64). Within the X86 block, 64-bit…
jww
  • 97,681
  • 90
  • 411
  • 885
2
votes
1 answer

64-bit executable runs slower than 32-bit version

I have a 64-bit Ubuntu 13.04 system. I was curious to see how 32-bit applications perform against 64-bit applications on a 64-bit system so I compiled the following C program as 32-bit and 64-bit executable and recorded the time they took to…
ajay
  • 9,402
  • 8
  • 44
  • 71
1
vote
1 answer

Why are system call numbers for `x86-64` and `x32` different but similar, and why are some not defined in unistd_x32.h?

I have come across these files on Linux after reading more about system call numbers for particular architecture. When I ran this command locate unistd_64.h it gives me a path to the system call file /usr/include/asm/unistd_64.h but when I looked in…
Visrut
  • 360
  • 4
  • 14
1
vote
1 answer

x32 executables in fasm

"format ELF executable 3" makes an x86 executable "format ELF64 executable 3" makes an x64 executable But how can I make an x32 (x64 with 32-bit pointers) executable? p.s. What does "3" mean after "executable" in these lines?
Jin X
  • 121
  • 3
1
vote
1 answer

Is __ILP32__ and __i386__ a valid configuration?

We took a bug report for some X32 code under Clang on OS X (the error is shown below). The user tried to compile code on an Intel x86_64 system using -arch i386. X32 is 32-bit integers, longs and pointers. According to the System V Application…
jww
  • 97,681
  • 90
  • 411
  • 885
1
vote
5 answers

How to detect X32 on Windows?

X32 allows one to write programs using 32-bit integers, longs and pointers that run on x86_64 processors. Using X32 has a number of benefits under certain use cases. (X32 is different than X86 or X64; see Difference between x86, x32, and x64…
jww
  • 97,681
  • 90
  • 411
  • 885
0
votes
0 answers

how signal handle in user space get siginfo and ucontext?

I read kernel code about signal handle, as i know, x32 get parameters from stack instead of registers. But i can't understand the code as below. void (*sa_sigaction)(int, siginfo_t *, void *); if (is_ia32_frame(ksig)) { if (ksig->ka.sa.sa_flags…
taoozh
  • 31
  • 4
0
votes
0 answers

X32 and __gnu_cxx::__exchange_and_add_single?

I'm trying to understand a crash in a library that's undergoing testing on X32 platform (x86_64 with ILP32). When I backtrace it, I see: (gdb) bt full #0 0xf6e02e1b in _Unwind_Resume () from /lib/x86_64-linux-gnux32/libgcc_s.so.1 No symbol table…
jww
  • 97,681
  • 90
  • 411
  • 885
0
votes
2 answers

Can't link shared library with -mx32 and gcc 4.7 or gcc 4.8

I'm trying to compile a large codebase written for a 32 bit embedded processor to run on a 64 bit desktop processor for simulation/unit testing. I need the resulting object to be a shared library. This is not an issue in Windows, I can build a dll…
skelliam
  • 522
  • 3
  • 11
1
2