solaris >> Compiling and Linking 64Bit Programs on Solaris Sparc with GCC 3.x

by Brian E. Seppanen » Wed, 11 Feb 2004 05:59:05 GMT

Hi Folks:

I would like to be able to compile source programs to 64 bit binaries on
the solaris sparc platform using gcc 3.x. In the past I've given what
I've thought we're the correct arguments to the compile program, but
when it links the program it complains about the linker not compiling 64
bit programs. So I guess my question is how I can get a version of gnu
ld compiled that will support 64bit binaries...

Any hints on how to accomplish this would be greatly appreciated,
including recommended reading if that is necessary.


Thanks for the help.

Brian Seppanen
XXXX@XXXXX.COM


solaris >> Compiling and Linking 64Bit Programs on Solaris Sparc with GCC 3.x

by Frank Langelage » Wed, 11 Feb 2004 06:08:40 GMT



The manual says:
-m32
-m64
Generate code for a 32-bit or 64-bit environment. The
32-bit environment sets int, long and pointer to 32
bits. The 64-bit environment sets int to 32 bits and
long and pointer to 64 bits.

Which parameter do you give for compiling and linking in 64Bit mode ?

solaris >> Compiling and Linking 64Bit Programs on Solaris Sparc with GCC 3.x

by Rich Teer » Wed, 11 Feb 2004 06:53:07 GMT


Sun's compilers are a better choice...


GNU Ld isn't required. Use the one provided by Solaris.


It would help if you told us what you did.

Assuming you used gcc -m64, don't forget that you also have to link with
64-bit libraries.

--
Rich Teer, SCNA, SCSA

President,
Rite Online Inc.

Voice: +1 (250) 979-1638
URL: http://www.rite-online.net

solaris >> Compiling and Linking 64Bit Programs on Solaris Sparc with GCC 3.x

by Brian E. Seppanen » Thu, 12 Feb 2004 02:33:49 GMT


Hadn't thought of that...


Alright I have gcc-3.3.2. I'm passing CFLAGS=-m64 to gcc and I'm
using LD_OPTIONS=-64.

My compile gets to this point when trying to compile mysql 4.0.17

64 bit

ld: fatal: file
/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/crt1.o: wrong ELF
class: ELFCLASS32
ld: fatal: File processing errors. No output written to .libs/mysql
collect2: ld returned 1 exit status

Now this is using /usr/ccs/bin/ld as my linker.

I do have /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/sparcv9/crt1.o

How can I get the 64 bit support and bypass 32bit support.

Thanks,

solaris >> Compiling and Linking 64Bit Programs on Solaris Sparc with GCC 3.x

by Darren Dunham » Thu, 12 Feb 2004 03:01:29 GMT


Do a 'file /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/crt1.o'.
I'm imagining this is a 32-bit ELF file. There should be a 64-bit copy
in ...3.3.2/sparcv9/crt1.o

You cannot mix 32 bit and 64 bit libraries in the same executable.

I'm not certain why the compiler is trying to link that library. I
would imagine that there should be a 64 bit version of that library if
the compiler is capable of producing 64 bit code, and it should be using
that version.

--
Darren Dunham XXXX@XXXXX.COM
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >

solaris >> Compiling and Linking 64Bit Programs on Solaris Sparc with GCC 3.x

by Brian E. Seppanen » Thu, 12 Feb 2004 03:52:29 GMT


That's exactly correct. It is a 32bit library. In one directory up
sparcv9 is crt1.o 64bit. How do I compile it such that it knows that
it should use files in that directory rather than the another. I was
wondering if maybe I had to pass -mcpu=sparcv9, but that doesn't seem to
work for me. Unless I'm specifying it incorrectly.

Thanks for the help.

Brian seppanen
XXXX@XXXXX.COM

solaris >> Compiling and Linking 64Bit Programs on Solaris Sparc with GCC 3.x

by Casper H.S. Dik » Thu, 12 Feb 2004 19:20:17 GMT

"Brian E. Seppanen" < XXXX@XXXXX.COM > writes:



There should be two copies of crt1.o under that directory; one for
sparcv9 and one ordinary one; the linker determines the type of
binary from the first object it finds.





Hm, then there's something wrong with the spec file or are you not linking
with gcc -m64?


Casper

Similar Threads

1. Can't compile gcc-4.1.1 on Solaris 8 Sparc

2. 64bit passwd program for solaris 10 (64bit) on AMD opteron

Hi ALL,
Is there a 64bit 'passwd' program available for Solaris 10(64bit) AMD
opteron. We Installed Solaris 10 (64bit) on AMD opteron. kernel is in
64bit. Both 32 and 64 bit libraries are available. But there is only
32bit 'passwd' program. We need use a 64bit pam module. This cannot be
used with 32 bit passwd. 

Regards
Kiran

3. Arithmetic Error on Sun Solaris GCC compiled program

4. gcc 4 linking to a file compiled with gcc 2.96 question

Hi,

I've been told there is a switch for gcc which will match the ABI of 
code compiled with previous versions. I don't have the gcc manual to 
hand and man gcc isn't showing much (web access is down currently). 
Anyone know what the switch is?

Reason I'm asking is this.

If you've ever used the PS2 SDK from Sony, you'll know what an abhorent 
mess it is. Sony provide the object files without the source (which is a 
pain) and version 2.95.4 of gcc.

My idea is to use a modern Linux distro (Mandriva, FC or SuSE) on a dual 
boot machine, use KDevelop to build the software and test the resultant 
code on the PS2. To do that, I need to compile the source with ABI 
compatibility.

TTFN

Paul

5. Link error while compiling a gtk program for Solaris 10 x86

6. gcc -m32 on 64bit OS, missing links /usr/lib/lib....so's

I'm porting some 32 bit programs we have to our 64 bit OS. I need to
build them from source code, and existing makefiles (so they can still
be linked on the 32 bit systems, hopefully with just the 1 set of makefiles)

So, I am changing my makefiles to add the -m32 option. However, many
links fail to find libraries referenced with -lxxx, e.g. -lmysqlclient

I found that the system does not have these set up with the symbolic .so links.
But there are libaries, such as libxml2.so.2 libmysqlclient_r.so.14 etc.

Do I need to point some symbolic links to these? And why aren't they already
setup, like the ones in the 64 bit library directories?

And in some, there are multiple versions of  these, e.g. mysqlclient, and how
do I figure out which one to use?


$cat /proc/version
Linux version 2.6.9-34.ELsmp ( XXXX@XXXXX.COM )
(gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)) #1
SMP Fri Feb 24 16:56:28 EST 2006


7. Gcc On Solaris Sparc Versus Solaris Intel: Repost With Error Information Included

8. Gcc On Solaris Sparc Versus Solaris Intel

Gentle People?

    I am currently running gcc 3.1 on both my Ultra 5
Solaris 8 Sparc machine and on Solaris 8 Intel machine.
C source code that compiles and executes perfectly on
the Ultra 5 will not compile on the Intel machine!

    The compilation errors seem to relate to syntax errors,
and not simply missing files. Remember this same code compiles
perfectly on the Sparc machine.

    Why would there be such a difference in the between gcc on
Sparc versus Intel?

     Also I have noted that the Sparc and Intel assemblers use
different directives or pseudo-ops. This was a suprise! I of
course expected different neumonics to represent the Intel
Assembly Language, but different assembler directives or
pseudo-ops? I expected more cross platform commonality.

Thanks for the help.
Thomas Dineen