This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Bad PIC on Solaris
- To: Alexandre Oliva <aoliva at cygnus dot com>
- Subject: Re: Bad PIC on Solaris
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Wed, 12 Apr 2000 12:39:57 +0200
- Cc: gcc-patches at gcc dot gnu dot org,gcc-bugs at gcc dot gnu dot org
- References: <Alexandre Oliva's message of "26 Jan 2000 05:46:33 -0200"><orwvox46na.fsf@garnize.lsd.ic.unicamp.br>
At 22:40 10.04.00, Alexandre Oliva wrote:
>On Jan 26, 2000, Alexandre Oliva <oliva@lsd.ic.unicamp.br> wrote:
>
> > 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
>
>Here's a patch that fixes this problem. Tested on Solaris2.6/sparc
>and 7/x86, as well as RedHat Linux 6.2 /x86 and /alpha. Ok to
>install?
>
>Index: gcc/ChangeLog
>2000-04-10 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
>
> * config/elfos.h (SELECT_SECTION): Decide whether to use a data or
> const section to output a CONSTRUCTOR based on the same conditions
> used for VAR_DECLs.
What about all the other target-specific SELECT_SECTION macros? Do they
need changing as well? Eg. rs6000_select_section() in rs6000/rs6000.c?
Franz.