This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/8022: gcc 3.2 Solaris 64 bit shared libraries
- From: hyc at symas dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 24 Sep 2002 16:27:52 -0000
- Subject: c/8022: gcc 3.2 Solaris 64 bit shared libraries
- Reply-to: hyc at symas dot com
>Number: 8022
>Category: c
>Synopsis: gcc 3.2 Solaris 64 bit shared libraries
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Tue Sep 24 09:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: hyc@symas.com
>Release: gcc-3.2, binutils 2.11.2
>Organization:
>Environment:
Solaris 2.8 Ultrasparc
>Description:
64 bit binaries produced by gcc 3.x "-m64" option and compiled by gas are unusable for shared libraries, by default. The gas --help says "-TSO" is the default but it actually defaults to "-RMO". /usr/ccs/bin/ld will link the object files without any complaint, but the runtime linker barfs. This issue was first reported on
http://gcc.gnu.org/ml/gcc-help/2002-06/msg00005.html
Adding "-TSO" to the specs file for the appropriate -m64 clauses fixes the problem.
>How-To-Repeat:
$ gcc -m64 -c foo.c (any valid C code will do)
$ /usr/ccs/bin/ld -G -o foo.so foo.o
$ gcc -m64 -o main main.c ./foo.so
$ ./main
ld.so.1: ./main: fatal: ./foo.so: bad ELF flags value: 2
>Fix:
lute:/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2# diff -c specs{.O,}
*** specs.O Tue Sep 24 04:46:03 2002
--- specs Tue Sep 24 09:08:17 2002
***************
*** 120,129 ****
%{pthreads:-D_REENTRANT -D_PTHREADS} %{!pthreads:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}} %{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude}
*asm_cpu:
! %{mcpu=ultrasparc:%{!m64:-xarch=v8plusa}%{m64:-xarch=v9a}} %{mcpu=v9:%{!m64:-xarch=v8plus}%{m64:-xarch=v9}} %{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:%{!m64:-xarch=v8}%{m64:-xarch=v9}}}} %{!mcpu*:%(asm_cpu_default)}
*asm_cpu_default:
! %{m64:-xarch=v9} %{!m64:}
*asm_arch32:
--- 120,129 ----
%{pthreads:-D_REENTRANT -D_PTHREADS} %{!pthreads:%{threads:-D_REENTRANT -D_SOLARIS_THREADS}} %{compat-bsd:-iwithprefixbefore ucbinclude -I/usr/ucbinclude}
*asm_cpu:
! %{mcpu=ultrasparc:%{!m64:-xarch=v8plusa}%{m64:-xarch=v9a -TSO}} %{mcpu=v9:%{!m64:-xarch=v8plus}%{m64:-xarch=v9 -TSO}} %{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:%{!m64:-xarch=v8}%{m64:-xarch=v9 -TSO}}}} %{!mcpu*:%(asm_cpu_default)}
*asm_cpu_default:
! %{m64:-xarch=v9 -TSO} %{!m64:}
*asm_arch32:
>Release-Note:
>Audit-Trail:
>Unformatted: