aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-09-08 21:11:40 +0000
committerIan Lance Taylor <ian@airs.com>1995-09-08 21:11:40 +0000
commitb8345a37ac5d8c5cc103d73cc6e2a31fbecb3fa5 (patch)
treed07423d5ef5605ce8b92b893b5634a5f804f3e3d /ld
parentffb8885bb00650f861cd1a5100a4b1bb98382255 (diff)
downloadfsf-binutils-gdb-b8345a37ac5d8c5cc103d73cc6e2a31fbecb3fa5.zip
fsf-binutils-gdb-b8345a37ac5d8c5cc103d73cc6e2a31fbecb3fa5.tar.gz
fsf-binutils-gdb-b8345a37ac5d8c5cc103d73cc6e2a31fbecb3fa5.tar.bz2
* configure.in: Call AC_HEADER_DIRENT.
* configure, config.in: Rebuild. * emultempl/sunos.em: Use autoconf recommend mechanism to define DIR and struct dirent.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/emultempl/sunos.em32
2 files changed, 25 insertions, 12 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 8684e4b..3ca55a2 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,10 @@
Fri Sep 8 16:32:43 1995 Ian Lance Taylor <ian@cygnus.com>
+ * configure.in: Call AC_HEADER_DIRENT.
+ * configure, config.in: Rebuild.
+ * emultempl/sunos.em: Use autoconf recommend mechanism to define
+ DIR and struct dirent.
+
* configure.tgt (mips*-*-bsd*): New case.
* configure.host (i[345]86-sequent-ptx* | i[345]86-sequent-sysv*)
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index e18b2fc..ffdf098 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -29,18 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <sys/types.h>
#include <sys/stat.h>
-/* FIXME: On some hosts we will need to include a different file.
- This is correct for SunOS, which is the only place this file will
- typically be compiled. However, if somebody configures the linker
- for all targets, they will run into trouble here. */
-#include <dirent.h>
-
#include "bfd.h"
#include "sysdep.h"
#include "bfdlink.h"
#include "ld.h"
-#include "config.h"
#include "ldmain.h"
#include "ldemul.h"
#include "ldfile.h"
@@ -48,6 +41,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "ldexp.h"
#include "ldlang.h"
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+#else
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
static void gld${EMULATION_NAME}_create_output_section_statements
PARAMS ((void));
@@ -82,8 +90,7 @@ gld${EMULATION_NAME}_before_parse()
static void
gld${EMULATION_NAME}_create_output_section_statements ()
{
- if (config.dynamic_link)
- lang_for_each_input_file (gld${EMULATION_NAME}_find_so);
+ lang_for_each_input_file (gld${EMULATION_NAME}_find_so);
}
/* Search the directory for a .so file for each library search. */
@@ -104,7 +111,8 @@ gld${EMULATION_NAME}_find_so (inp)
struct stat st;
if (! inp->search_dirs_flag
- || ! inp->is_archive)
+ || ! inp->is_archive
+ || ! inp->dynamic)
return;
ASSERT (strncmp (inp->local_sym_name, "-l", 2) == 0);
@@ -118,7 +126,7 @@ gld${EMULATION_NAME}_find_so (inp)
{
force_maj = atoi (dot + 1);
len = dot - filename;
- alc = (char *) alloca (len + 1);
+ alc = (char *) xmalloc (len + 1);
strncpy (alc, filename, len);
alc[len] = '\0';
filename = alc;
@@ -213,7 +221,7 @@ gld${EMULATION_NAME}_find_so (inp)
/* Now look for the same file name, but with .sa instead of .so. If
found, add it to the list of input files. */
- alc = (char *) alloca (strlen (inp->filename) + 1);
+ alc = (char *) xmalloc (strlen (inp->filename) + 1);
strcpy (alc, inp->filename);
strstr (alc, ".so.")[2] = 'a';
if (stat (alc, &st) == 0)