Subject: Re: py-qt3-sip on Solaris and ld: fatal: relocations remain against
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 12/16/2004 11:07:21
> > Building py-qt3-sip under Solaris is failing with:
> >
> > Text relocation remains                         referenced
> >     against symbol                  offset      in file
> > PyEval_CallObjectWithKeywords       0x654       qtlib.o
> > PyMethod_New                        0x5ac       qtlib.o
> ...
> > ld: fatal: relocations remain against allocatable but non-writable
> > sections
>
> My work-around is:
>
> -CONFIGURE_ARGS+=       LFLAGS_SHLIB=-shared
> +#CONFIGURE_ARGS+=      LFLAGS_SHLIB=-shared
> +# gcc3 uses -mimpure-text to not pass -assert pure-text to the linker
> +# this may be needed on solaris using gcc
> +CONFIGURE_ARGS+=       LFLAGS_SHLIB="-shared -mimpure-text"
>
> I don't know if this is correct or what, but it did build and was packaged
> fine.
>
> Anyone have any suggestions on if using -mimpure-text is okay for Solaris?
>
> Also, I assume this should only be done if using GCC. What is the best way
> to only do this for GCC?

And some more information ... from the gcc man-page:

 -mimpure-text
     -mimpure-text, used in addition to -shared, tells the compiler to
     not pass -z text to the linker when linking a shared object.  Using
     this option, you can link position-dependent code into a shared
     object.

     -mimpure-text suppresses the ``relocations remain against allocat-
     able but non-writable sections'' linker error message.  However,
     the necessary relocations will trigger copy-on-write, and the
     shared object is not actually shared across processes.  Instead of
     using -mimpure-text, you should compile all source code with -fpic
     or -fPIC.

     This option is only available on SunOS and Solaris.

My PR# is pkg/28671

 Jeremy C. Reed

 	  	 	 BSD News, BSD tutorials, BSD links
	  	 	 http://www.bsdnewsletter.com/