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

Maciej Bliziński maciej at opencsw.org
Mon Jun 18 20:15:30 CEST 2012


On Mon, Jun 18, 2012 at 12:29:00PM +0200, Rafael Ostertag wrote:
> 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.

Thanks for the research.

I sent a question to gcc-help. It's a high traffic list so I try to keep
unsubscribed, but in this case I decided to subscribe again. I used your
log file, I hope you don't mind.

I'm kinda reluctant to dive into the gcc build scripts, because of the
multi-level builds, where the top-level Makefile calls multiple
configure scripts with different options to build different targets.
I mean, you can debug it if you really want, but it takes a long time
and you have to keep a lot of state in your head.

I'll wait for a response from gcc-help, guys over there have always been
helpful (and also think I'm crazy, but that's another issue).

Maciej


More information about the maintainers mailing list