linuxx86x86-64linux-x32-abi

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 and I got the below output:

a.o: file format elf32-x86-64
architecture: i386:x64-32, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000

Does it mean the library is 32-bit? Is that the reason I am getting the linker error?


Solution

  • There are 3 common ABIs usable on standard Intel-compatible machines (not Itanium).

    Each of the above has its on system call interface, own ld.so, own complete set of libraries, etc. But it is possible to run all 3 on the same kernel.

    On Linux, their loaders are:

    % objdump -f /lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2
    
    /lib/ld-linux.so.2:     file format elf32-i386
    architecture: i386, flags 0x00000150:
    HAS_SYMS, DYNAMIC, D_PAGED
    start address 0x00000a90
    
    
    /lib64/ld-linux-x86-64.so.2:     file format elf64-x86-64
    architecture: i386:x86-64, flags 0x00000150:
    HAS_SYMS, DYNAMIC, D_PAGED
    start address 0x0000000000000c90
    
    
    /libx32/ld-linux-x32.so.2:     file format elf32-x86-64
    architecture: i386:x64-32, flags 0x00000150:
    HAS_SYMS, DYNAMIC, D_PAGED
    start address 0x00000960
    

    Now, if you're getting the message about "skipping incompatible library", that means something is messed up with your configuration. Make sure you don't have bad variables in the environment or passed on the command line, or files installed outside of your package manager's control.