Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

It appears that I can run both ELF 32-bit and ELF 64-bit binaries on my Linux host. I am running on pretty vanilla Linux boxes (Intel hardware, RedHat 64-bit kernel, etc.)

  1. How is that possible?
  2. Is there a test to know this is possible on each Linux installation (certain library, kernel module, etc.)?

Some helpful details:

$ uname -a
Linux xhkg6002dap 2.6.18-348.4.1.el5 #1 SMP Fri Mar 22 05:41:51 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux

To me, that looks like I am runing an x86 Linux kernel that is 64-bit.

We have several versions of Subversion installed. Some appear to be 32-bit and others 64-bit. I can run at least some 32-bit versions and some 64-bit versions.

$ for file in $(find /sbcimp/run/pd/subversion -path '*/bin/svn') ; do echo $file ; file $file ; $file --version 2>&1 | head -n 1 ; done
/sbcimp/run/pd/subversion/1.5.3/bin/svn
/sbcimp/run/pd/subversion/1.5.3/bin/svn: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
svn, version 1.5.3 (r33570)
/sbcimp/run/pd/subversion/64-bit/1.5.3/bin/svn
/sbcimp/run/pd/subversion/64-bit/1.5.3/bin/svn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
svn, version 1.5.3 (r33570)
/sbcimp/run/pd/subversion/64-bit/1.5.4/bin/svn
/sbcimp/run/pd/subversion/64-bit/1.5.4/bin/svn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
svn, version 1.5.4 (r33841)
/sbcimp/run/pd/subversion/64-bit/1.6.2/bin/svn
/sbcimp/run/pd/subversion/64-bit/1.6.2/bin/svn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/sbcimp/run/pd/subversion/64-bit/1.6.2/bin/svn: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory
/sbcimp/run/pd/subversion/64-bit/1.6.6/bin/svn
/sbcimp/run/pd/subversion/64-bit/1.6.6/bin/svn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
/sbcimp/run/pd/subversion/64-bit/1.6.6/bin/svn: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory
/sbcimp/run/pd/subversion/1.5.4/bin/svn
/sbcimp/run/pd/subversion/1.5.4/bin/svn: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
svn, version 1.5.4 (r33841)
/sbcimp/run/pd/subversion/1.6.2/bin/svn
/sbcimp/run/pd/subversion/1.6.2/bin/svn: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
svn, version 1.6.2 (r37639)
/sbcimp/run/pd/subversion/1.6.6/bin/svn
/sbcimp/run/pd/subversion/1.6.6/bin/svn: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
svn, version 1.6.6 (r40053)
share|improve this question

1 Answer 1

up vote 2 down vote accepted

a 32 bit kernel (x86) can only run 32 bit code. a 64 bit kernel (x86_64) can run both 32 and 64 bit code.

Your uname -a has x86_64 plastered all over it and that is 64 bit.

There is no need for testing 32 bit code just works on a 64 bit kernel.

It is possible certain programs might need certain compile flags to make it work. However, all modern programs have these flags standard in the Makefile.

The only limitation is 32 bit programs still cannot access more than 4gb of RAM.

Note: Your kernel is ancient and you should upgrade it

share|improve this answer
    
Does running 32bit code still require 32bit libraries to be installed. I had an instance of Ubuntu Server x64 (don't remember what version) running and had to download the 32 bit libraries. Everything existed as duplicates. –  Fiasco Labs Feb 4 at 5:03
    
Usually a 32bit app requires 32 bit libraries. In many cases the 64 bit libraries are optimized to take advantage of 64 bits and 32 bit programs can have issues. For example if a 32bit program was handed a 64 bit memory address it couldn't handle it. –  cybernard Feb 4 at 5:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.