https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63478
--- Comment #1 from Dennis Clarke <dev at cor0 dot com> ---
The option "-mptr64" seems to be the issue here because :
$ /opt/intermediate/gcc4/bin/gcc -v -save-temps -mcpu=v8 -mno-app-regs -m32
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -D_TS_ERRNO -S -o
hello_sparcv8_gcc-4.7.4.s hello.c
Using built-in specs.
COLLECT_GCC=/opt/intermediate/gcc4/bin/gcc
Target: sparc64-sun-solaris2.10
Configured with: ../gcc-4.7.4/configure --build=sparc64-sun-solaris2.10
--prefix=/opt/intermediate/gcc4 --libdir=/opt/intermediate/gcc4/lib
--libexecdir=/opt/intermediate/gcc4/lib --without-gnu-as --without-gnu-ld
--with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/sparcv9/ld
--with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local
--disable-nls --enable-threads=posix --enable-shared --with-cpu=v9
--enable-bootstrap --enable-languages=ada,c,c++ --enable-stage1-languages=c
--with-pkgversion='genunix Tue Oct 7 02:05:39 GMT 2014'
Thread model: posix
gcc version 4.7.4 (genunix Tue Oct 7 02:05:39 GMT 2014)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mcpu=v8' '-mno-app-regs' '-m32' '-D'
'_POSIX_PTHREAD_SEMANTICS' '-D' '_LARGEFILE64_SOURCE' '-D' '_TS_ERRNO' '-S'
'-o' 'hello_sparcv8_gcc-4.7.4.s'
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/cc1 -E -quiet -v
-imultilib sparcv8plus -D__sparcv8 -D _POSIX_PTHREAD_SEMANTICS -D
_LARGEFILE64_SOURCE -D _TS_ERRNO hello.c -mptr32 -mno-stack-bias -mcpu=v8
-mno-app-regs -m32 -fpch-preprocess -o hello.i
ignoring nonexistent directory
"/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/../../../../sparc64-sun-solaris2.10/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/include
/usr/local/include
/opt/intermediate/gcc4/include
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/include-fixed
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mcpu=v8' '-mno-app-regs' '-m32' '-D'
'_POSIX_PTHREAD_SEMANTICS' '-D' '_LARGEFILE64_SOURCE' '-D' '_TS_ERRNO' '-S'
'-o' 'hello_sparcv8_gcc-4.7.4.s'
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/cc1
-fpreprocessed hello.i -mptr32 -mno-stack-bias -quiet -dumpbase hello.c
-mcpu=v8 -mno-app-regs -m32 -auxbase-strip hello_sparcv8_gcc-4.7.4.s -version
-o hello_sparcv8_gcc-4.7.4.s
GNU C (genunix Tue Oct 7 02:05:39 GMT 2014) version 4.7.4
(sparc64-sun-solaris2.10)
compiled by GNU C version 4.7.4, GMP version 6.0.0, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C (genunix Tue Oct 7 02:05:39 GMT 2014) version 4.7.4
(sparc64-sun-solaris2.10)
compiled by GNU C version 4.7.4, GMP version 6.0.0, MPFR version 3.1.2,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 6c00354b9ef0a393ae7d72f614661fa3
COMPILER_PATH=/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/usr/ccs/bin/
LIBRARY_PATH=/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/sparcv8plus/:/usr/ccs/lib/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/../../../:/lib/:/usr/lib/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mcpu=v8' '-mno-app-regs' '-m32' '-D'
'_POSIX_PTHREAD_SEMANTICS' '-D' '_LARGEFILE64_SOURCE' '-D' '_TS_ERRNO' '-S'
'-o' 'hello_sparcv8_gcc-4.7.4.s'
$
$
$ cat hello_sparcv8_gcc-4.7.4.s
.file "hello.c"
.section ".rodata"
.align 8
.LLC0:
.asciz "Hello World!"
.section ".text"
.align 4
.global main
.type main, #function
.proc 04
main:
save %sp, -96, %sp
st %i0, [%fp+68]
st %i1, [%fp+72]
sethi %hi(.LLC0), %g1
or %g1, %lo(.LLC0), %o0
call puts, 0
nop
mov 0, %g1
mov %g1, %i0
restore
jmp %o7+8
nop
.size main, .-main
.ident "GCC: (genunix Tue Oct 7 02:05:39 GMT 2014) 4.7.4"
$
$ /usr/ccs/bin/as -V -Qy -s -xarch=v8 -o hello_sparcv8_gcc-4.7.4.o
hello_sparcv8_gcc-4.7.4.s
/usr/ccs/bin/as: SunOS 5.10 118683-13 Patch 08/06/2014
$
$ /opt/intermediate/gcc4/bin/gcc -v -save-temps -mcpu=v8 -mno-app-regs -m32
-D_POSIX_PTHREAD_SEMANTICS -D_LARGEFILE64_SOURCE -D_TS_ERRNO -o
hello_sparcv8_gcc-4.7.4 hello_sparcv8_gcc-4.7.4.o
Using built-in specs.
COLLECT_GCC=/opt/intermediate/gcc4/bin/gcc
COLLECT_LTO_WRAPPER=/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/lto-wrapper
Target: sparc64-sun-solaris2.10
Configured with: ../gcc-4.7.4/configure --build=sparc64-sun-solaris2.10
--prefix=/opt/intermediate/gcc4 --libdir=/opt/intermediate/gcc4/lib
--libexecdir=/opt/intermediate/gcc4/lib --without-gnu-as --without-gnu-ld
--with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/sparcv9/ld
--with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local
--disable-nls --enable-threads=posix --enable-shared --with-cpu=v9
--enable-bootstrap --enable-languages=ada,c,c++ --enable-stage1-languages=c
--with-pkgversion='genunix Tue Oct 7 02:05:39 GMT 2014'
Thread model: posix
gcc version 4.7.4 (genunix Tue Oct 7 02:05:39 GMT 2014)
COMPILER_PATH=/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/:/usr/ccs/bin/
LIBRARY_PATH=/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/sparcv8plus/:/usr/ccs/lib/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/../../../:/lib/:/usr/lib/:/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-mcpu=v8' '-mno-app-regs' '-m32' '-D'
'_POSIX_PTHREAD_SEMANTICS' '-D' '_LARGEFILE64_SOURCE' '-D' '_TS_ERRNO' '-o'
'hello_sparcv8_gcc-4.7.4'
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/collect2 -V -Y
P,/usr/ccs/lib:/lib:/usr/lib -Qy -o hello_sparcv8_gcc-4.7.4
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/sparcv8plus/crt1.o
/usr/lib/crti.o /usr/ccs/lib/values-Xa.o
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/sparcv8plus/crtbegin.o
-L/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/sparcv8plus
-L/usr/ccs/lib
-L/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/../../..
-L/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4
hello_sparcv8_gcc-4.7.4.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc
/opt/intermediate/gcc4/lib/gcc/sparc64-sun-solaris2.10/4.7.4/sparcv8plus/crtend.o
/usr/lib/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1520
$
$ mcs -p hello_sparcv8_gcc-4.7.4
hello_sparcv8_gcc-4.7.4:
as: SunOS 5.10 118683-13 Patch 08/06/2014
@(#)SunOS 5.10 Generic January 2005
GCC: (genunix Tue Oct 7 02:05:39 GMT 2014) 4.7.4
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1520
$
$ ./hello_sparcv8_gcc-4.7.4
Hello World!
$
$ elfdump -devl hello_sparcv8_gcc-4.7.4
ELF Header
ei_magic: { 0x7f, E, L, F }
ei_class: ELFCLASS32 ei_data: ELFDATA2MSB
ei_osabi: ELFOSABI_SOLARIS ei_abiversion: EAV_SUNW_CURRENT
e_machine: EM_SPARC32PLUS e_version: EV_CURRENT
e_type: ET_EXEC
e_flags: [ EF_SPARC_32PLUS ]
e_entry: 0x10740 e_ehsize: 52 e_shstrndx: 27
e_shoff: 0x162c e_shentsize: 40 e_shnum: 28
e_phoff: 0x34 e_phentsize: 32 e_phnum: 6
Version Needed Section: .SUNW_version
index file version
[2] libc.so.1 SYSVABI_1.3
Dynamic Section: .dynamic
index tag value
[0] NEEDED 0x105 libc.so.1
[1] INIT 0x10a74
[2] FINI 0x10a90
[3] HASH 0x10114
[4] STRTAB 0x10344
[5] STRSZ 0x31b
[6] SYMTAB 0x101d4
[7] SYMENT 0x10
[8] CHECKSUM 0x9969
[9] VERNEED 0x10660
[10] VERNEEDNUM 0x1
[11] PLTRELSZ 0x48
[12] PLTREL 0x7
[13] JMPREL 0x106f8
[14] RELA 0x106b0
[15] RELASZ 0x90
[16] RELAENT 0xc
[17] DEBUG 0
[18] FLAGS 0 0
[19] FLAGS_1 0 0
[20] SUNW_STRPAD 0x200
[21] SUNW_LDMACH 0x2b EM_SPARCV9
[22] PLTGOT 0x20ad8
[23-33] NULL 0
$
$
Looks just fine.