Re: AIX PIC shared library support

Peter O'Gorman <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <[email protected]>
Pushed. Thanks!

Peter

On 08/20/2012 12:12 PM, David Edelsohn wrote:
> The GCC -fpic/-fPIC option has evolved to mean code generation for a
> shared library and changes the optimization behavior of the compiler.
> Code for AIX PowerPC always is PIC, but the optimization behavior is
> affecting AIX.
>
> libtool exports all global symbols on AIX while GCC binds_local_p()
> determines that some function calls are local, causing GCC to emit the
> local (non-external) form of function calls, which generates AIX
> linker warnings.
>
> The IBM XL compiler defaults to the equivalent of -fpic.  GCC could
> try to match that, but it requires working around other GCC bootstrap
> problems and continually chasing compatibility.  The other option is
> to assume that developers using GCC to build shared libraries either
> are using libtool or copying FOSS Makefiles designed for GNU/Linux or
> expecting GNU/Linux compatibility.
>
> The following patch starts to implement the latter by adding "-fPIC"
> to the compiler command line options when building objects for a
> shared library.  Because this places control in the hands of the user
> with a command line option and matches GNU/Linux, this seems better
> than playing with defaults and fighting GCC semantics for building
> shared libraries.
>
> Comments?
>
> Thanks, David
>
>          * m4/libtool.m4 (_LT_COMPILER_PIC): Add -fPIC to GCC and GXX for AIX.
>
> diff --git a/m4/libtool.m4 b/m4/libtool.m4
> index a8ecbc3..d0a5577 100644
> --- a/m4/libtool.m4
> +++ b/m4/libtool.m4
> @@ -3874,6 +3874,7 @@ m4_if([$1], [CXX], [
>          # AIX 5 now supports IA64 processor
>          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
>         fi
> +      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
>         ;;
>
>       amigaos*)
> @@ -4191,6 +4192,7 @@ m4_if([$1], [CXX], [
>          # AIX 5 now supports IA64 processor
>          _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
>         fi
> +      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
>         ;;
>
>       amigaos*)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.