LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-03-2009, 05:19 PM   #1
nima0102
Member
 
Registered: Nov 2006
Posts: 209

Rep: Reputation: 30
runnig 32-bit software on 64-bit hardware


I have one server with Xeon processor 64-bit,and I intend to install debian 64-bit on this server,a question arises that are 32-bit software run on 64-bit hardware ??
thanks for any help
 
Old 03-03-2009, 07:27 PM   #2
bsdunix
Senior Member
 
Registered: May 2006
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761

Rep: Reputation: 80
I found these that might give you the answers your looking for:

Running 32-bit Applications on 64-bit Debian GNU/Linux
http://www.debian-administration.org/articles/534

Installing apps in a 32-bit chroot in AMD64 Debian system
http://www.debian-administration.org/articles/356
 
Old 03-03-2009, 09:27 PM   #3
T74marcell
Member
 
Registered: Mar 2009
Posts: 102

Rep: Reputation: 18
You can certainly run 32-bit applications on a 64-bit machine, but you have to be aware that in some cases the results can be different when compared with the results from a 32-bit architecture.

If the application does some bit masking operations or does some comparison with hexadecimal values, then you have to make sure that 'long long' values are used, and you also have to take care about signed and unsigned values.

Let's say you want to test for the value 0x7FFFFFFF with signed long integers
assuming that 'long myValue = 0x7FFFFFFF;'
on a 32-bit system 'myValue == 0x7FFFFFFF' is true,
on a 64-bit system 'myValue == 0x7FFFFFFF' is NOT true, because myValue is actually 0xFFFFFFFF7FFFFFFF (it's 64-bit), and
0xFFFFFFFF7FFFFFFF != 0x7FFFFFFF

It's awfull to debug something like that. As a matter of fact, such code would even fail, if compiled on a 64-bit system.

----------
T74marcell

Arch Linux

Last edited by T74marcell; 03-14-2009 at 01:47 AM.
 
Old 03-03-2009, 10:04 PM   #4
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by T74marcell View Post
You can certainly run 32-bit applications on a 64-bit machine, but you have to be aware that in some cases the results can be different when compared with the results from a 32-bit architecture.

If the application does some bit masking operations or does some comparison with hexadecimal values, then you have to make sure that 'long long' values are used, and you also have to take care about signed and unsigned values.
I think you're either answering the wrong meaning of the question, or seriously confused.

I think the OP's question was about running software compiled for x86 32-bit under an x86-64 kernel. That is relatively problem free, and none of the issues you discussed apply.

You seem to be discussing what happens when code was written with the assumption that it will be compiled in 32-bit mode, but that code is compiled unchanged in 64-bit mode.

Such source code is fairly rare in open source, because people tend to notice the lack of portability.

Quote:
assuming that 'long myValue = 0x7FFFFFFF;'
on a 32-bit system 'myValue == 0x7FFFFFFF' is true,
on a 64-bit system 'myValue == 0x7FFFFFFF' is NOT true, because myValue is actually 0xFFFFFFFF7FFFFFFF (it's 64-bit), and
0xFFFFFFFF7FFFFFFF != 0x7FFFFFFF
That is wrong in so many ways, I can hardly list them. Some are:

If you set 'long myValue = 0x7FFFFFFF;' then most certainly 'myValue == 0x7FFFFFFF' is true. The is true when compiled 32-bit (whether run on a 32 bit or 64 bit system) and true when compiled 64-bit.

Sign extension can occur on some values, but the same interpretation would occur both times you use the same constant.

Anyway, 0x7FFFFFFF is positive, so it does not sign extend to 0xFFFFFFFF7FFFFFFF.

Someone coding for 32 bit mode would tend to use 'long' only if they are trying to be portable to other sizes of int or long. So they probably thought about such issues. It is easy to construct intentional portability flaws around the fact that long is 32 bits in x86, but 64 bits in x86-64 (though you missed) but such flaws are rare in real code.

When you see mixtures of std::size_t with int or unsigned int, then you should really worry about whether the author thought through the portability issues to an architecture where std::size_t is larger than unsigned int. std::size_t is often used just for type compatibility with standard functions that expect or return it, so its use does not imply the author has thought through the consequences of the fact that std::size_t is big enough to hold the difference between pointers and int might not be.

Last edited by johnsfine; 03-03-2009 at 10:12 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Benchmarking software, compare 32-bit to 64-bit H_TeXMeX_H Linux - Software 20 07-15-2008 04:39 AM
Differences in performance for 32-bit and 64-bit software exceed1 Linux - General 10 03-14-2008 05:50 PM
Installing 64-bit linux distros on 32-bit hardware gizmo24 Linux - Software 3 12-14-2007 09:36 PM
64-bit PC: Software or Hardware problems? theYinYeti Linux - Hardware 4 02-19-2007 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration