Hi,

This is AIX's ld's behavior:
----from man ld
       -LDirectory
            Adds Directory to the list of search directories used for
finding libraries designated by the -l
            (lowercase letter L) flag. The list of directories,
including the standard library directories, is also
            recorded in the output object file loader section for use
by the system loader unless you use
            the -blibpath, -bnolibpath, or -bsvr4 option. You can
repeat this flag.
----
So, this can not be resolved from gcc. Some open source projects are
affected this behavior (i.e.
http://archives.neohapsis.com/archives/bugtraq/2003-04/0385.html)

Since we are not able to remove -L. at this point, we need to use
-blibpath to avoid including '.' from search path.

% gcc -print-search-dirs
install: /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.7.2/
programs: =3D/opt/freeware/libexec/gcc/powerpc-ibm-aix7.1.0.0/4.7.2/:/opt/f=
reeware/libexec/gcc/powerpc-ibm-aix7.1.0.0/4.7.2/:/opt/freeware/libexec/gcc=
/powerpc-ibm-aix7.1.0.0/:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.7.2=
/:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/:/opt/freeware/lib/gcc/power=
pc-ibm-aix7.1.0.0/4.7.2/../../../../powerpc-ibm-aix7.1.0.0/bin/powerpc-ibm-=
aix7.1.0.0/4.7.2/:/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.7.2/../../=
../../powerpc-ibm-aix7.1.0.0/bin/
libraries: =3D/opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.7.2/:/opt/free=
ware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.7.2/../../../../powerpc-ibm-aix7.1.0.=
0/lib/powerpc-ibm-aix7.1.0.0/4.7.2/:/opt/freeware/lib/gcc/powerpc-ibm-aix7.=
1.0.0/4.7.2/../../../../powerpc-ibm-aix7.1.0.0/lib/:/opt/freeware/lib/gcc/p=
owerpc-ibm-aix7.1.0.0/4.7.2/../../../powerpc-ibm-aix7.1.0.0/4.7.2/:/opt/fre=
eware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.7.2/../../../:/lib/powerpc-ibm-aix7.=
1.0.0/4.7.2/:/lib/:/usr/lib/powerpc-ibm-aix7.1.0.0/4.7.2/:/usr/lib/

Should we add all of these directories listed in "libraries:" ?


--=20
Yutaka KANEMOTO
http://d.hatena.ne.jp/kinpoco/