This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld and GNU/Linux ld.so disagree on dependent library search order (?)
On Thu, Feb 09, 2006 at 09:51:20AM +1030, Alan Modra wrote:
> On Tue, Feb 07, 2006 at 08:42:22AM -0800, H. J. Lu wrote:
> > PR ld/2290
> > * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Call
> > gld${EMULATION_NAME}_check_ld_so_conf before checking default
> > search directories for DT_NEEDED entries.
>
> OK. A NEWS entry would be nice too.
>
I am going to check this in shortly.
Thanks.
H.J.
----
2006-02-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/2290
* NEWS: Updated for the Linux linker search order change.
* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Call
gld${EMULATION_NAME}_check_ld_so_conf before checking default
search directories for DT_NEEDED entries.
--- ld/NEWS.ld.so 2006-02-01 09:37:06.000000000 -0800
+++ ld/NEWS 2006-02-08 16:10:10.000000000 -0800
@@ -1,5 +1,8 @@
-*- text -*-
+* Modify the Linux linker to seach /etc/ld.so.conf first before
+ checking default search directories for DT_NEEDED entries.
+
* PE-COFF: Forward exports from DLL's can now be specified in .def files
passed directly to ld.
--- ld/emultempl/elf32.em.ld.so 2005-12-08 07:06:38.000000000 -0800
+++ ld/emultempl/elf32.em 2006-02-08 16:08:55.000000000 -0800
@@ -919,6 +919,18 @@ cat >>e${EMULATION_NAME}.c <<EOF
EOF
fi
+if [ "x${USE_LIBPATH}" = xyes ] ; then
+ case ${target} in
+ *-*-linux-* | *-*-k*bsd*-*)
+ # Linux
+ cat >>e${EMULATION_NAME}.c <<EOF
+ if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
+ break;
+
+EOF
+ ;;
+ esac
+fi
cat >>e${EMULATION_NAME}.c <<EOF
len = strlen (l->name);
for (search = search_head; search != NULL; search = search->next)
@@ -937,17 +949,6 @@ cat >>e${EMULATION_NAME}.c <<EOF
if (search != NULL)
break;
EOF
-if [ "x${USE_LIBPATH}" = xyes ] ; then
- case ${target} in
- *-*-linux-* | *-*-k*bsd*-*)
- cat >>e${EMULATION_NAME}.c <<EOF
- if (gld${EMULATION_NAME}_check_ld_so_conf (l->name, force))
- break;
-EOF
- # Linux
- ;;
- esac
-fi
cat >>e${EMULATION_NAME}.c <<EOF
}