aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-04-05 21:22:31 +0000
committerIan Lance Taylor <ian@airs.com>1996-04-05 21:22:31 +0000
commit6cc7365e2b682389efdaf16431189f7762805bc3 (patch)
tree1be5639c48ed98f8ed897dd7189dfb828f64d523 /ld
parent13e4a17e769a77867b9c43c58e54800244a72ea2 (diff)
downloadgdb-6cc7365e2b682389efdaf16431189f7762805bc3.zip
gdb-6cc7365e2b682389efdaf16431189f7762805bc3.tar.gz
gdb-6cc7365e2b682389efdaf16431189f7762805bc3.tar.bz2
* emultempl/elf32.em (gld${EMULATION_NAME}_check_ld_so_conf): New
static function, if ${host} = ${target}. (gld${EMULATION_NAME}_after_open): Call check_ld_so_conf to find a needed shared library if ${host} = $[target}.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/emultempl/elf32.em97
2 files changed, 105 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 00e4a41..3a08e5d 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,14 @@
Fri Apr 5 14:30:14 1996 Ian Lance Taylor <ian@cygnus.com>
+ * emultempl/elf32.em (gld${EMULATION_NAME}_check_ld_so_conf): New
+ static function, if ${host} = ${target}.
+ (gld${EMULATION_NAME}_after_open): Call check_ld_so_conf to find a
+ needed shared library if ${host} = $[target}.
+
+ * configure.host (i[345]86-*-linux*): Add -dynamic-linker to
+ HOSTING_CRT0. Search -lgcc both before and after -lc in
+ HOSTING_LIBS.
+
* configure.tgt: Add i[345]86-*-freebsdelf* target; from John
Polstra <jdp@polstra.com>.
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 728b8d3..71e34b5 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -131,6 +131,93 @@ gld${EMULATION_NAME}_open_dynamic_archive (arch, search, entry)
return true;
}
+EOF
+if [ "x${host}" = "x${target}" ] ; then
+cat >>e${EMULATION_NAME}.c <<EOF
+
+/* For a native linker, check the file /etc/ld.so.conf for directories
+ in which we may find shared libraries. /etc/ld.so.conf is really
+ only meaningful on Linux, but we check it on other systems anyhow. */
+
+static boolean gld${EMULATION_NAME}_check_ld_so_conf PARAMS ((const char *));
+
+static boolean
+gld${EMULATION_NAME}_check_ld_so_conf (name)
+ const char *name;
+{
+ static boolean initialized;
+ static char *ld_so_conf;
+
+ if (! initialized)
+ {
+ FILE *f;
+
+ f = fopen ("/etc/ld.so.conf", FOPEN_RT);
+ if (f != NULL)
+ {
+ char *b;
+ size_t len, alloc;
+ int c;
+
+ len = 0;
+ alloc = 100;
+ b = (char *) xmalloc (alloc);
+
+ while ((c = getc (f)) != EOF)
+ {
+ if (len + 1 >= alloc)
+ {
+ alloc *= 2;
+ b = (char *) xrealloc (b, alloc);
+ }
+ if (c != ':'
+ && c != ' '
+ && c != '\t'
+ && c != '\n'
+ && c != ',')
+ {
+ b[len] = c;
+ ++len;
+ }
+ else
+ {
+ if (len > 0 && b[len - 1] != ':')
+ {
+ b[len] = ':';
+ ++len;
+ }
+ }
+ }
+
+ if (len > 0 && b[len - 1] == ':')
+ --len;
+
+ if (len > 0)
+ b[len] = '\0';
+ else
+ {
+ free (b);
+ b = NULL;
+ }
+
+ fclose (f);
+
+ ld_so_conf = b;
+ }
+
+ initialized = true;
+ }
+
+ if (ld_so_conf == NULL)
+ return false;
+
+ return gld${EMULATION_NAME}_search_needed (ld_so_conf, name);
+}
+
+EOF
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
+
/* These variables are required to pass information back and forth
between after_open and check_needed and stat_needed. */
@@ -222,6 +309,14 @@ cat >>e${EMULATION_NAME}.c <<EOF
}
if (search != NULL)
continue;
+EOF
+if [ "x${host}" = "x${target}" ] ; then
+cat >>e${EMULATION_NAME}.c <<EOF
+ if (gld${EMULATION_NAME}_check_ld_so_conf (l->name))
+ continue;
+EOF
+fi
+cat >>e${EMULATION_NAME}.c <<EOF
einfo ("%P: warning: %s, needed by %B, not found\n",
l->name, l->by);
@@ -596,7 +691,7 @@ gld${EMULATION_NAME}_find_exp_assignment (exp)
break;
case etree_trinary:
- gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs);
+ gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.cond);
gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.lhs);
gld${EMULATION_NAME}_find_exp_assignment (exp->trinary.rhs);
break;