Bad PIC on Solaris
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Wed Apr 12 03:40:00 GMT 2000
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.
More information about the Gcc-patches
mailing list