WSL: multilib ABIs don't work
Please use the following bug reporting template to help produce actionable and reproducible issues:
A brief description
The two non-primary ABIs supported by Ubuntu are not functional under the Linux subsystem:
- i386/x86/ia32 The traditional 32-bit ABI. Built with
gcc -m32. - x32 An ABI that supports the full 64-bit instruction set and registers, but with a 32-bit address space. Built with
gcc -mx32. More info about the ABI here and here.
Expected results
Applications built against the two ABIs should run.
Actual results (with terminal output if applicable)
+ cat test.c
#include <stdio.h>
int main(int argc, char **argv)
{
#if defined(__x86_64__) && defined(__ILP32__)
printf("x32 ABI\n");
#elif defined(__x86_64__)
printf("x86_64 ABI\n");
#elif defined(__i386__)
printf("i386 ABI\n");
#else
#error "Unknown ABI"
#endif
return 0;
}
+ for ABI in 32 64 x32
+ gcc -m32 -o test-32 test.c
+ ./test-32
bash: ./test-32: cannot execute binary file: Exec format error
+ gcc -m64 -o test-64 test.c
+ ./test-64
x86_64 ABI
+ gcc -mx32 -o test-x32 test.c
+ ./test-x32
bash: ./test-x32: cannot execute binary file: Exec format error
Your Windows build number
14393.10
Required packages and commands to install
The gcc-multilib package is sufficient to get started building i386 and x32 test applications.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Reactions: 6
- Comments: 16 (4 by maintainers)
@aseering I develop programs against those ABIs and use it for servers. In the server context, I basically build any application that shouldn’t reasonably consume more than 4GB of memory using the x32 ABI. This effectively caps its memory utilization. If an application leaks memory or is manipulated in some way to cause its memory usage to balloon too much, only the responsible process is killed by exhausting its own 4GB address space, instead of exhausting all of system memory and invoking the OOM killer which haphazardly kills arbitrary processes. There are other benefits of the ABI, but that’s a pretty important one.
One nice thing for Microsoft on this issue is that a big chunk of the hard work (compiler, linking, packaging) are already done. They just need to implement the kernel side of it. Obviously not an easy piece of work, but easier than owning the userspace side in addition to that…
Fine, although x32 is not legacy. x86 is.