* emultempl/elf32.em (gld${EMULATION_NAME}_check_ld_so_conf): New
authorIan Lance Taylor <ian@airs.com>
Fri, 5 Apr 1996 21:22:31 +0000 (21:22 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 5 Apr 1996 21:22:31 +0000 (21:22 +0000)
static function, if ${host} = ${target}.
(gld${EMULATION_NAME}_after_open): Call check_ld_so_conf to find a
needed shared library if ${host} = $[target}.

ld/ChangeLog
ld/emultempl/elf32.em

index 00e4a41010d0e60365cf332bd47d36bac3f89869..3a08e5d8605898037467772f61b41606ef7ea85e 100644 (file)
@@ -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>.
 
index 728b8d394ac8e4cd4b28258dad99d04b160d3cec..71e34b5abc0039ccbcb17c49f8fe6ffa81c98f67 100644 (file)
@@ -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;
This page took 0.030351 seconds and 4 git commands to generate.