summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/ld/ld.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2002-04-17 15:33:17 +0000
committerMarc Espie <espie@cvs.openbsd.org>2002-04-17 15:33:17 +0000
commit5f82d294c5ae4e85adc7a0603d0cd85036d3d37a (patch)
treee7b4377971c9559fdc46b7aa2a39a63198a68684 /gnu/usr.bin/ld/ld.c
parent7a2857d648cfe99a897d6b9313d6aba3e181b00a (diff)
Ld speed-up patch.
This reduces the memory requirements to build any recent big libtool package, like kde. Tested by miod, fries, naddy, and various.
Diffstat (limited to 'gnu/usr.bin/ld/ld.c')
-rw-r--r--gnu/usr.bin/ld/ld.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index d1bf0914d2c..319be0a3f4a 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.c,v 1.21 2002/03/31 20:48:16 fgsch Exp $ */
+/* $OpenBSD: ld.c,v 1.22 2002/04/17 15:33:16 espie Exp $ */
/* $NetBSD: ld.c,v 1.52 1998/02/20 03:12:51 jonathan Exp $ */
/*-
@@ -1237,19 +1237,37 @@ read_entry_relocation(fd, entry)
/*---------------------------------------------------------------------------*/
+int current_file;
+
+/*
+ * Check whether a library name appears in the list of files
+ * still to link in: used to avoid linking dependent libraries
+ * that will be pulled in anyways.
+ */
+int
+will_see_later(const char *name)
+{
+ int i;
+
+ for (i = current_file+1; i < number_of_files; i++)
+ if ((file_table[i].flags & E_SEARCH_DIRS) &&
+ strcmp(name, file_table[i].filename) == 0)
+ return 1;
+ return 0;
+}
+
/*
* Read in the symbols of all input files.
*/
static void
load_symbols()
{
- register int i;
if (trace_files)
fprintf(stderr, "Loading symbols:\n\n");
- for (i = 0; i < number_of_files; i++)
- read_file_symbols(&file_table[i]);
+ for (current_file = 0; current_file < number_of_files; current_file++)
+ read_file_symbols(&file_table[current_file]);
if (trace_files)
fprintf(stderr, "\n");