summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2006-04-05 15:40:40 +0000
committerAlan Modra <amodra@bigpond.net.au>2006-04-05 15:40:40 +0000
commitb19a4bb077f142aa6bedc10be4ed4c91e9726421 (patch)
tree207c9f5dbfe24a5e6f1d5eb2b1812ed1b689dc89
parent25e2ec32e297b65f64d6546272c4ed91fadf7962 (diff)
downloadbinutils-redhat-b19a4bb077f142aa6bedc10be4ed4c91e9726421.tar.gz
* Makefile.am (GENSCRIPTS): Pass prefix.
* Makefile.in: Regenerate. * genscripts.sh: Adjust for extra parameter. * emultempl/elf32.em (parse_ld_so_conf): Return true iff file exists. (check_ld_so_conf): Use ${prefix}/etc/ld.so.conf if it exists. * NEWS: Update.
-rw-r--r--ld/ChangeLog10
-rw-r--r--ld/Makefile.am2
-rw-r--r--ld/Makefile.in2
-rw-r--r--ld/NEWS6
-rw-r--r--ld/emultempl/elf32.em19
-rwxr-xr-xld/genscripts.sh23
6 files changed, 42 insertions, 20 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7ce60d92fa..300fb6b5ee 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,13 @@
+2006-04-05 Alan Modra <amodra@bigpond.net.au>
+
+ * Makefile.am (GENSCRIPTS): Pass prefix.
+ * Makefile.in: Regenerate.
+ * genscripts.sh: Adjust for extra parameter.
+ * emultempl/elf32.em (parse_ld_so_conf): Return true iff file
+ exists.
+ (check_ld_so_conf): Use ${prefix}/etc/ld.so.conf if it exists.
+ * NEWS: Update.
+
2006-04-05 Richard Sandiford <richard@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 758dc7e2d9..3d8d08b8f0 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -475,7 +475,7 @@ stringify.sed: ${srcdir}/emultempl/$(STRINGIFY)
# These all start with e so 'make clean' can find them.
-GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@
+GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
@TDIRS@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 4564a8bf6b..5208e68d3c 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -657,7 +657,7 @@ EMULATION_FILES = emultempl/pe.em emultempl/armcoff.em
POTFILES = $(CFILES) $(HFILES) $(EMULATION_FILES)
# These all start with e so 'make clean' can find them.
-GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh ${srcdir} ${libdir} "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@
+GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @target_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@
GEN_DEPENDS = $(srcdir)/genscripts.sh stringify.sed
# We need this for automake to use YLWRAP.
diff --git a/ld/NEWS b/ld/NEWS
index 77659b686b..27fb0ae115 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -2,8 +2,10 @@
* Support for the Infineon XC16X has been added by KPIT Cummins Infosystems.
-* Modify the Linux linker to seach /etc/ld.so.conf first before
- checking default search directories for DT_NEEDED entries.
+* Modify the Linux linker search order to better match ld.so search order.
+ Look for DT_NEEDED libraries in paths specified by ld.so.conf before
+ searching the default directories, rather than vice versa.
+ Use $prefix/etc/ld.so.conf if it exists, otherwise /etc/ld.so.conf.
* PE-COFF: Forward exports from DLL's can now be specified in .def files
passed directly to ld.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 048917f3b5..537d9dc993 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -13,7 +13,7 @@ cat >e${EMULATION_NAME}.c <<EOF
/* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
ELF support by Ian Lance Taylor <ian@cygnus.com>
@@ -541,7 +541,7 @@ struct gld${EMULATION_NAME}_ld_so_conf
size_t len, alloc;
};
-static void
+static bfd_boolean
gld${EMULATION_NAME}_parse_ld_so_conf
(struct gld${EMULATION_NAME}_ld_so_conf *info, const char *filename);
@@ -584,7 +584,7 @@ gld${EMULATION_NAME}_parse_ld_so_conf_include
free (newp);
}
-static void
+static bfd_boolean
gld${EMULATION_NAME}_parse_ld_so_conf
(struct gld${EMULATION_NAME}_ld_so_conf *info, const char *filename)
{
@@ -593,7 +593,7 @@ gld${EMULATION_NAME}_parse_ld_so_conf
size_t linelen;
if (f == NULL)
- return;
+ return FALSE;
linelen = 256;
line = xmalloc (linelen);
@@ -691,6 +691,7 @@ gld${EMULATION_NAME}_parse_ld_so_conf
while (! feof (f));
free (line);
fclose (f);
+ return TRUE;
}
static bfd_boolean
@@ -705,11 +706,17 @@ gld${EMULATION_NAME}_check_ld_so_conf (const char *name, int force)
char *tmppath;
struct gld${EMULATION_NAME}_ld_so_conf info;
- tmppath = concat (ld_sysroot, "/etc/ld.so.conf", NULL);
info.path = NULL;
info.len = info.alloc = 0;
- gld${EMULATION_NAME}_parse_ld_so_conf (&info, tmppath);
+ tmppath = concat (ld_sysroot, "${prefix}/etc/ld.so.conf", NULL);
+ if (!gld${EMULATION_NAME}_parse_ld_so_conf (&info, tmppath))
+ {
+ free (tmppath);
+ tmppath = concat (ld_sysroot, "/etc/ld.so.conf", NULL);
+ gld${EMULATION_NAME}_parse_ld_so_conf (&info, tmppath);
+ }
free (tmppath);
+
if (info.path)
{
char *d = gld${EMULATION_NAME}_add_sysroot (info.path);
diff --git a/ld/genscripts.sh b/ld/genscripts.sh
index 76d5dd2560..e9d4f153a7 100755
--- a/ld/genscripts.sh
+++ b/ld/genscripts.sh
@@ -4,6 +4,7 @@
# Usage: genscripts_extra.sh \
# srcdir \
# libdir \
+# prefix \
# exec_prefix \
# host \
# target \
@@ -22,6 +23,7 @@
# /sources/ld \
# /usr/local/lib \
# /usr/local \
+# /usr/local \
# sparc-sun-sunos4.1.3 \
# sparc-sun-sunos4.1.3 \
# sparc-sun-sunos4.1.3 \
@@ -59,17 +61,18 @@
srcdir=$1
libdir=$2
-exec_prefix=$3
-host=$4
-target=$5
-target_alias=$6
-EMULATION_LIBPATH=$7
-NATIVE_LIB_DIRS=$8
-use_sysroot=$9
+prefix=$3
+exec_prefix=$4
+host=$5
+target=$6
+target_alias=$7
+EMULATION_LIBPATH=$8
+NATIVE_LIB_DIRS=$9
shift 9
-EMULATION_NAME=$1
-TOOL_LIB=$2
-CUSTOMIZER_SCRIPT=$3
+use_sysroot=$1
+EMULATION_NAME=$2
+TOOL_LIB=$3
+CUSTOMIZER_SCRIPT=$4
# Can't use ${TOOL_LIB:-$target_alias} here due to an Ultrix shell bug.
if [ "x${TOOL_LIB}" = "x" ] ; then