取消
顯示結果 
搜尋替代 
您的意思是: 

怎麼判斷程式是 32bit 或 64bit?

怎麼判斷程式是 32bit 或 64bit?

我的OS是 HP-UX 11.11 64bit

要如何判斷一個程式是32bit的,還是64bit的?



謝謝
9 回覆

怎麼判斷程式是 32bit 或 64bit?

- 64bit

root@Lab1 # file testmem

testmem: PA-RISC2.0 shared executable dynamically linked -not stripped

- 32bit

root@Lab1 # file /usr/bin/ls

/usr/bin/ls: PA-RISC1.1 shared executable dynamically linked



怎麼判斷程式是 32bit 或 64bit?

您的意思是:

若出現 "PA-RISC2.0",就是 64bit

若出現 "PA-RISC1.1",就是 32bit

是這樣嗎?

怎麼判斷程式是 32bit 或 64bit?

for an a.out in LP64 mode, using file command will get this,



ELF-64 executable object file - PA-RISC 2.0 (LP64)





怎麼判斷程式是 32bit 或 64bit?

yes, in #man cc have following info



+DDdata_model Generate code using either the

ILP32 or LP64 data model. Defined values for

data_model are: 32 Use the ILP32 data model.

The size of the int, long and pointer data

types is 32-bits. This is currently equivalent

to +DA1.1. 64 Use the LP64 data model. The size

of the int data type is 32-bits, and the size

of the long and pointer data types is 64-bits.

Defines __LP64__ to the preprocessor, as if

by '#define'. This is currently equivalent

to +DA2.0W.



Note 64-bit object code is generated for PA-

RISC 2.0, and will not execute on PA-RISC 1.1

systems.

怎麼判斷程式是 32bit 或 64bit?

yes or no, PA2.0 can support 64 bit and 32bit mode. an a.out can be as a 32 bit binary in PA2.0, if you complie it with +DA2.0 option.



If you complie with +DA2.0W then the a.out will be as 64bit binary in PA2.0



Summary compile options as

+DA1.1 - 32bit in PA1.1

+DA2.0 - 32bit in PA2.0

+DA2.0W - 64bit in PA2.0

怎麼判斷程式是 32bit 或 64bit?

Small test for your reference.



- 64 bit

$ cc +DA2.0W a.c

$ file a.out

a.out: ELF-64 executable object file - PA-RISC 2.0 (LP64)



- 32 bit

$ cc +DA2.0 a.c

$ file a.out

a.out: PA-RISC2.0 shared executable dynamically linked -not stripped

$ cc +DA1.1 a.c

$ file a.out

a.out: PA-RISC1.1 shared executable dynamically linked -not stripped

怎麼判斷程式是 32bit 或 64bit?

Thank you.

怎麼判斷程式是 32bit 或 64bit?

#getconf KERNEL_BITS

怎麼判斷程式是 32bit 或 64bit?

this command use to check OS bits