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.)
- How is that possible?
- 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)
Answer
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
No comments:
Post a Comment