This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld option for setting runtime libpath for AIX
- To: Tom Rix <trix at redhat dot com>
- Subject: Re: ld option for setting runtime libpath for AIX
- From: Kevin Heatwole <kdh at ocsystems dot com>
- Date: Thu, 25 Oct 2001 09:47:11 -0400
- Cc: binutils at sources dot redhat dot com
Thanks for the reply, but...
This is the way it works on AIX, but the GNU ld cross (I'm running on
LinuxPPC) doesn't do anything with LIBPATH.
For example, I just tried:
$ export LIBPATH=/usr/lib:/lib
$ /work/build/gcc-aix-cross/rs6000-ibm-aix4.2.1.0/bin/gcc hello.c
on the LinuxPPC box and then dumped the a.out header on the AIX box:
$ dump -H a.out
a.out:
***Loader Section***
Loader Header Information
VERSION# #SYMtableENT #RELOCent LENidSTR
0x00000001 0x00000007 0x00000017 0x0000010c
#IMPfilID OFFidSTR LENstrTBL OFFstrTBL
0x00000002 0x000001dc 0x0000000d 0x000002e8
***Import File Strings***
INDEX PATH BASE MEMBER
0 /work/build/gcc-aix-cross/lib/gcc-lib/rs6000-ibm-
aix4.2.1.0/2.95.3:/work/build/gcc-aix-cross/rs6000-ibm-
aix4.2.1.0/lib/rs6000-ibm-aix4.2.1.0/2.95.3:/work/build/gcc-aix-
cross/rs6000-ibm-aix4.2.1.0/lib:/work/build/gcc-aix-
cross/rs6000-ibm-aix4.2.1.0/lib
1 libc.a shr.o
The default search path is still stored in the binary and no sign of
/usr/lib or /lib.
Now, if I set LIBPATH at runtime, the a.out will load, but I want to be
able to set this default path at bind time so the user doesn't have to
do anything special to get it to load.
I do have the workaround of specifying -L/usr/lib and -L/lib on the
bind, but this just adds to the default libpath and does not clear it.
I really want the equivalent of -blibpath option that AIX ld has (or
like the rpath option for ELF binaries). I suppose I could start
looking at the source. It would seem to be a trivial option to
implement, if it is not supported now.
Any other ideas?
Kevin
On Wednesday, October 24, 2001, at 10:55 PM, Tom Rix wrote:
> I believe you can do something like
>
> export LIBPATH=$NEWLIBPATH.
> And this string will appear as the first and default library path to be
> used as the system loader. See Loader Section Import File ID's in the
> xcoff spec.
>
> Tom
>
>
> Kevin Heatwole wrote:
>
>> I'm looking for the equivalent AIX ld to option -blibpath:/lib:/usr/lib
>> for GNU ld for AIX. Specifically, I want to override the default
>> LIBPATH stored in executables to just look in the directories
>> "/lib:/usr/lib".
>>
>> Does anyone know if there is such an equivalent option or linker
>> command
>> to set this value in executables bound with GNU ld for AIX?
>>
>> I know about adding directories with -L or SEARCH_DIR, but I want to
>> replace the whole default LIBPATH. I also know that the AIX loader
>> uses
>> the environment variable LIBPATH to override the value stored in the
>> binary.
>>
>> But, neither of these workarounds is quite what I want to do.
>>
>> Hope someone can point me to something that allows, at link-time, to
>> set
>> the runtime LIBPATH for AIX executables that is stored in the
>> executables. Thanks in advance for any help here.
>>
>> I'm using a snapshot of binutils (binutils-011017.tar) built as a cross
>> to rs6000-ibm-aix4.2.1.0 hosted on a LinuxPPC machine (since
>> binutils-2.11 seemed to indicate that there are bad bugs in ld for
>> AIX).
>>
>> Kevin Heatwole
>> OC Systems, Inc.
>
> --
> Tom Rix
> GCC Engineer
> trix@redhat.com
> 256.704.9201
>
>
>