Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

AIX 6.1 kload()

280 views
Skip to first unread message

goto...@gmail.com

unread,
Jan 17, 2013, 4:02:45 AM1/17/13
to
Hi Everyone,

My application has
one executable: example.exe
one library:libcapt.so
libcapt.so links to libsub.so.

example.exe loads libcapt.so using dlopen().
libcapt.so and libsub.so has both 32 bit and 64 bit versions.
/opt/example/lib - contains 32 bit versions
/opt/example64/lib - contains 64 bit versions.

I have two AIX 6.1 setups where I am seeing a difference in loading libcapt.so library.

LIBPATH="/opt/example/lib:/opt/example64/lib" is exported on both machines.
Just before dlopen() call I am doing chdir() to /opt/example64/lib path.

Problem:
While loading libcapt.so on MC2, i am getting bad magic number error and loading library fails. on this machine it is trying load libsub.so from /opt/example/lib 32 bit directory.

Below are truss output findings on both machines:

On MC1:
kload("/opt/simpana/Base64/libCvIbsad.so", 17367680, "") = 648518346072921824
Here no LIBPATh is passed to kload().



On MC2:
kload("/opt/example64/lib/libcapt.so", 17367680, "/opt/example/lib:/opt/example64/lib:/usr/lib") = 0
Here, I am receiving bad magic number error as it is referring libsub.so from /opt/example/lib while loading libcapt.so.


1. I am calling dlopen(), will it call kload() on AIX?
2. any idea why LIBPATH is not being passed to kload() in MC1?

If I set the LIBPATH to /opt/example64/lib, it works fine in MC2. But I could not understand why it is not failing on MC1. The only difference I see is kload() does not get the LIBPATH value.

Thank you.

Regards,
Ravi Thati

Uli Link

unread,
Jan 17, 2013, 5:40:22 AM1/17/13
to
goto...@gmail.com schrieb:
When you link example use the -blibpath:/opt/example64/lib:/usr/lib:/lib
linker flag for the 64bit executable and
-blibpath:/opt/example/lib:/usr/lib:/lib for the 32bit one.

Better way: archive both the 64- and 32bit .so shared libs into a single
.a archive and link against the .a instead. Then the loader will find
the correct object. But you have to do this for all predependencies
bottom up.
As long as the objects are not stripped, you can relink them with ld.

Another question: Why do you still build a 32bit application on AIX 6.1?
AIX 6.1 does not run on 32bit hardware, so it is safe to assume 64bit.
If you want/must support AIX 5.x too, to must build on AIX 5.x too. It
also safe to assume that a 32bit only system is running AIX 5.3 or
earlier and is End-of-Life.

--
Uli Link

goto...@gmail.com

unread,
Jan 18, 2013, 3:57:33 AM1/18/13
to

Thank you Uli Link.
It has several other library which make it difficult to make .a library. So we are going with .so files.
>
> As long as the objects are not stripped, you can relink them with ld.
>
>
>
> Another question: Why do you still build a 32bit application on AIX 6.1?
32 bit are built for older versions.
>
> AIX 6.1 does not run on 32bit hardware, so it is safe to assume 64bit.
>
> If you want/must support AIX 5.x too, to must build on AIX 5.x too. It
>
> also safe to assume that a 32bit only system is running AIX 5.3 or
>
> earlier and is End-of-Life.
>
Yes, the program is compiled for all AIX versions include AIX5.3.
If the application example.exe interacts is of 32 bit software running on AIX6.1, it will have to load from 32 bit version even though it is AIX6.1 64 bit running.

Any inputs on kload() functionality? where does it take the LIBPATH values from?
>
>
> --
>
> Uli Link

Gerard H. Pille

unread,
Jan 22, 2013, 4:47:18 PM1/22/13
to
goto...@gmail.com wrote:
> 2. any idea why LIBPATH is not being passed to kload() in MC1?
>

example.exe wouldn't be setuid root on MC1, wouldn't it?
0 new messages