This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: 4.7.1 on Solaris 10: ld: fatal: relocations remain against allocatable but non-writable sections
- From: Dennis Clarke <dclarke at blastwave dot org>
- To: Maciej BliziÅ?ski <maciej at opencsw dot org>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 18 Jun 2012 14:22:37 -0400 (EDT)
- Subject: Re: 4.7.1 on Solaris 10: ld: fatal: relocations remain against allocatable but non-writable sections
- Reply-to: dclarke at blastwave dot org
I hit the exact same problem on Solaris 8/9/10 and simply tossed
it over my shoulder and ignored it for a while. I know that some
folks will say "use gas/gld from binutils" however that simply is
not reasonable on Solaris systems.
Dennis
ps: sorry for the top post
> I've hit a build problem when upgrading from 4.7.0 to 4.7.1. I'm using
> the same build recipe[1], so it's most probably a change in GCC code.
> The immediate error I'm hitting is this:
>
> rm -f rts/libgna*.so
> cd rts; `echo
> "/home/raos/mgar/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/objdir/./gcc/xgcc
> -B/home/raos/mgar/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/objdir/./gcc/
> -B/opt/csw/sparc-sun-solaris2.10/bin/
> -B/opt/csw/sparc-sun-solaris2.10/lib/ -isystem
> /opt/csw/sparc-sun-solaris2.10/include -isystem
> /opt/csw/sparc-sun-solaris2.10/sys-include " \
> | sed -e 's,\./xgcc,../../xgcc,' -e
> 's,-B\./,-B../../,'` -shared -g -O2 \
> -fPIC \
> -o libgnat-4.7.so \
> a-assert.o (...) raise-gcc.o \
> -Wl,-h,libgnat-4.7.so \
> -lposix4 -lnsl -lsocket -lm
> Text relocation remains referenced
> against symbol offset in file
> <unknown> 0x0 raise-gcc.o
> (...many, many lines...)
> memcpy 0x4c sysdep.o
> ld: fatal: relocations remain against allocatable but non-writable sections
> collect2: error: ld returned 1 exit status
> gmake[5]: *** [gnatlib-shared-default] Error 1
> gmake[5]: Leaving directory
> `/home/raos/mgar/gcc4/trunk/work/solaris10-sparc/build-isa-sparcv8plus/objdir/gcc/ada'
> gmake[4]: *** [gnatlib-shared-dual] Error 2
>
> From asking around so far, it's similar to this minimal example:
>
> static int c = 1;
>
> int f(int a) {
> return a+c;
> }
>
> gcc -shared -o liba.so liba.c
>
> Text relocation remains referenced
> against symbol offset in file
> c 0x4 /var/tmp//ccqHaWcX.o
> ld: fatal: relocations remain against allocatable but non-writable sections
> collect2: ld returned 1 exit status
>
> In this case, the fix is to add -fpic to the invocation. But in the
> build logs I do see -fPIC, and it still fails, so I'm not sure if it's
> really the same kind of problem.
>
> Has anyone else encountered this error?
>
> Maciej
>
> [1]
> https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/gcc4/trunk/Makefile
>