This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bad PIC on Solaris
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Bad PIC on Solaris
- From: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Date: 26 Jan 2000 05:46:33 -0200
GCC won't emit PIC typeinfo nodes on Solaris, both /sparc and /x86.
GNU ld doesn't complain when a shared library is created with an
object file containing such typeinfo nodes, but Sun ld does, when run
with `-z text'. For example, given the following file:
class foo {};
class bar : foo {};
#include <typeinfo>
int main() {
typeid(bar);
}
% g++ -shared -fPIC test.cc -o /dev/null
ld: Software Generation Utilities - Solaris/ELF (3.0)
Text relocation remains referenced
against symbol offset in file
foo type_info node 0x0 test.o
ld: fatal: relocations remain against allocatable but non-writable sections
collect2: ld returned 1 exit status
Several people have reported this problem before, when building on
Solaris with --enable-shared, but they usually forgot to mention that
they were not using GNU ld. And then, since our installation
instructions currently recommend the native ld for Solaris, people end
up not being able to build C++ shared libraries; not even libstdc++
will build correctly.
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them