AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Operatingsystems
#Servers
#AIX
#AIX
#AIX
#AIX
#AppPerformanceManagement
#Power
 View Only
Expand all | Collapse all

gcc complie c++ code in aix7.1,how to configure the linker link the shared library with dependency order

  • 1.  gcc complie c++ code in aix7.1,how to configure the linker link the shared library with dependency order

    Posted Mon March 20, 2017 09:29 PM

    Originally posted by: ubxtl@163.com


    We met another issue  in AIX7.1 when we  run the code which is compiled by gcc4.8.2. The scenario just like this:

    1. We run a program  p1 which link libaaa1.so, and libaaa1 depends on libddd1.so, but when we run p1, we find that the libddd1.so is initialized before libaaa1,and the program is crashed.

     

    As we know that the  With GNU linker the shared libraries will be initialized one by one in the order of their dependencies, not in parallel. It means that if the binary depends on a shared library the shared library gets initialized before the dynamic initialization starts in the the binary. But the AIX linker works default is not the same as GNU linker.

    how to configure the AIX linker so that the shared libraries will be initialized one by one in the order of their dependencies? I think it should be one basic function the AIX linker.


    #AIX-Forum


  • 2.  Re: gcc complie c++ code in aix7.1,how to configure the linker link the shared library with dependency order

    Posted Tue March 21, 2017 06:17 PM

    Originally posted by: AncientAIXer


    I haven't encountered that, but I don't do a large amount of compiling and I don't have 7.1 yet either.  I have found this to be useful:

    http://www.perzl.org/aix/index.php?n=Main.Instructions

    I would also include -b32 or -b64 to ensure bitness.

    I don't know how much help this would be, but you might look at https://www.ibm.com/developerworks/aix/library/au-gnu.html.

    Another blog said to use '-Wl,-b64 -maix64'.


    #AIX-Forum