[csw-maintainers] ld: fatal: relocations remain against allocatable but non-writable sections

Rafael Ostertag raos at opencsw.org
Mon Jun 18 12:29:00 CEST 2012


Hi Maciej
On Sat, Jun 16, 2012 at 09:02:55PM +0100, Maciej (Matchek) Blizi??ski wrote:
> When building gcc-4.7.1, I ran against this error:
> 
> ld: fatal: relocations remain against allocatable but non-writable sections
> collect2: error: ld returned 1 exit status
> 
> It happens when linking the libgnat shared object. It's reproducible,
> try a gcc4 build from the repository and you'll see it.
> 
> I found an old discussion about the problem, and Mike's workaround was
> to use the GNU linker. A blog post I found[1] was to add
> ???-mimpure-text -lrt??? to LDFLAGS. In case of GCC it's not that easy,
> because of nested builds with redefined environments.
> 
> Does anyone have any insight about this problem?

I let the build run in script(1) and searched the output for an object file
that is causing the error (I took adaint.o).

I found no -fPIC anywhere, where adaint.o has been compiled. On the other hand,
when they create libgnat-4.7.so, they specify -fPIC. The way I see it, it is a
case for the GCC Devs, perhaps it is a bug in the build system...

I even did a build today which has explicitely passed `--enable-shared' to configure,
to no avail. Same error occurred.

Cheers
rafi

P.S.: The entire output of the build can be found in /home/raos/mgar/gcc4/trunk/typescript


More information about the maintainers mailing list