-L<path> on AIX

Perry Smith pedzsan@gmail.com
Sat Jan 31 10:15:00 GMT 2009


Lets suppose I build GNU's sed using gcc 4.2.0 on AIX.  At link time,  
the flag -L/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0/../../.. is  
passed along with -L/usr/local/lib/gcc/powerpc-ibm-aix5.3.0.0/4.2.0 to  
ld.  sed links and runs fine.

In the executable, this list of paths is kept and is the default  
search path for shared libraries.  It can be overridden with the  
LIBPATH environment variable but often that brings up more issues than  
it solves.

As it is now, it requires the user of sed to have not only gcc's  
libraries installed but the 4.2.0 version of the libraries.  And, if  
you ask ldd to dump out the libraries that sed uses, it actually does  
not use any gcc libraries.  But if the /usr/local/lib/gcc/powerpc-ibm- 
aix5.3.0.0/4.2.0 directory is gone, then the loader can't find  
libintl.a in /usr/local/lib and sed won't execute.

Looking at the code, it appears like spec_path might be a good place  
to collapse these paths and remove the ..'s.

Is this a good idea?

Thanks,
Perry
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems





More information about the Gcc mailing list