[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AIX PIC shared library support

From: Peter O'Gorman
Subject: Re: AIX PIC shared library support
Date: Tue, 21 Aug 2012 20:55:51 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

Pushed. Thanks!


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.


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'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'

@@ -4191,6 +4192,7 @@ m4_if([$1], [CXX], [
         # AIX 5 now supports IA64 processor
         _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'


reply via email to

[Prev in Thread] Current Thread [Next in Thread]