2
votes

I have a Solaris sparc machine and when i build my programs, it generates 32bit code which should be 64bit. How to check the cause?

$uname -a
SunOS sol 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Fire-V240
$/usr/sfw/bin/gcc --version
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$/usr/sfw/bin/gcc test.c
$file a.out
a.out: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped, no debugging information available $

2

2 Answers

1
votes

OSNews - SPARC Optimizations With GCC

The creation of 64-bit code requires using the -m64 flag (-m32 for 32-bit code is implied by default).

(Yes, this is different than GCC for x86_64, which defaults to -m64 unless overridden with -m32.)

1
votes

You should be able to force a 64-bit build using the -m64 option.

If that fails, you can download and install a prebuilt GCC package with 64-bit SPARC support for Solaris 10 from SunFreeware.com (download, gunzip, install with pkgadd -d gcc-...-sparc-local) which will run from /usr/local/bin/gcc.