Operating System - Linux
1753808 Members
8202 Online
108805 Solutions
New Discussion юеВ

Re: 64-bit Shared Library

 
SOLVED
Go to solution
Tom Dawson
Regular Advisor

64-bit Shared Library

Hi,

We're trying to determine if a Shared Library we've
compiled is 64-bit code. When we test an executable
compiled with the "cc +DA2.0W" option, we get the
following result from the "file" command:

# file /usr/local/bin/cpuperf
/usr/local/bin/cpuperf: ELF-64 executable object file - PA-RISC 2.0 (LP64)

It explicitly says that the file contains 64-bit code.

One of our developers is compiling a shared library. She
is not using the "+DA2.0W" option, and she's linking it
with the following "ld" command:

ld -b +s -o libcsiunx.sl csiunx.o

If we execute "file" on the resultant library:

# file libcsiunx.sl
libcsiunx.sl: PA-RISC2.0 shared library -not stripped

It says it is "2.0" code, but not 64-bit code. I thought
the PA-RISC2.0 CPUs were all 64-bit. Have I got that wrong?

The man page for ld talks about SHLIB_PATH and LD_LIBRARY_PATH
for the "+s" option to ld, but it says nothing about the LPATH
environment variable. We do have /usr/lib/pa20_64 at the
beginning of LPATH.

I'm just trying to determine if we have more work to do to
get us to all 64-bit code. Any help appreciated. i.e. Is
this PA-RISC2.0 file 64-bit or not?

Thanks,
Tom
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: 64-bit Shared Library

No, PA-RISC2.0 refers to the instruction set and it is possible to use the PA-RISC2.0 instruction set and still be 32-bit (with respect to data) code.

Try this:
cc +DA2.0 -c csiunx.c
and then "file csiunx.o".
That will result in "PA-RISC2.0 object"

next:
cc +DA2.0W -c csiunx.c
and then "file csiunx.o".
That will display "ELF-64 object"

The ELF-64 means that this is true 64-bit code and does not, for example, have the 1GB quadrant boundaries that are characteristic of 32-bit PA-RISCXX code and greatly limit the size of data structures.

You need to change the flags in your makefiles (or set CCOPTS) to +DA2.0W if you want 64-bit code.
If it ain't broke, I can fix that.
Dennis Handly
Acclaimed Contributor

Re: 64-bit Shared Library

>You need to change the flags in your makefiles (or set CCOPTS) to +DA2.0W if you want 64-bit code.

It will be more portable (to IPF) if you use +DD64 instead.
Sandman!
Honored Contributor

Re: 64-bit Shared Library

Tom,

The "W" in PA-RISC2.0W stands for wide as in kernel width i.e. 64-bit as opposed to PA-RSC2.0 which defaults to 32-bit.

You can look inside your locally built shared library with ldd, if it references others, to confirm whether it's 64-bit or 32-bit. Look at the pathname to other libraries since it will contain "/usr/lib" if its 32-bit or "/usr/lib/pa20_64" if its 64-bit on PA-RISC architecture machines.

cheers!
Tom Dawson
Regular Advisor

Re: 64-bit Shared Library

Clay,

Thanks for the explanation.

Tom
Tom Dawson
Regular Advisor

Re: 64-bit Shared Library

Thanks for the replies!