summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/ld/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/ld/lib.c')
-rw-r--r--gnu/usr.bin/ld/lib.c82
1 files changed, 47 insertions, 35 deletions
diff --git a/gnu/usr.bin/ld/lib.c b/gnu/usr.bin/ld/lib.c
index 550dedf..7741ea2 100644
--- a/gnu/usr.bin/ld/lib.c
+++ b/gnu/usr.bin/ld/lib.c
@@ -1,5 +1,36 @@
+/*-
+ * This code is derived from software copyrighted by the Free Software
+ * Foundation.
+ *
+ * Modified 1991 by Donn Seeley at UUNET Technologies, Inc.
+ *
+ * Modified 1993 by Paul Kranenburg, Erasmus University
+ */
+
+/* Derived from ld.c: "@(#)ld.c 6.10 (Berkeley) 5/22/91"; */
+
+/* Linker `ld' for GNU
+ Copyright (C) 1988 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+/* Written by Richard Stallman with some help from Eric Albert.
+ Set, indirect, and warning symbol features added by Randy Smith. */
+
/*
- * $Id: lib.c,v 1.16 1995/09/28 19:43:22 bde Exp $ - library routines
+ * $Id: lib.c,v 1.17 1996/07/12 19:08:23 jkh Exp $ - library routines
*/
#include <sys/param.h>
@@ -21,6 +52,7 @@
#include <ctype.h>
#include "ld.h"
+#include "dynamic.h"
static void linear_library __P((int, struct file_entry *));
static void symdef_library __P((int, struct file_entry *, int));
@@ -515,26 +547,12 @@ subfile_wanted_p(entry)
fprintf(stdout, " needed due to %s\n", sp->name);
}
return 1;
- } else {
+ } else if (!sp->defined && sp->sorefs) {
/*
* Check for undefined symbols or commons
* in shared objects.
*/
struct localsymbol *lsp;
- int wascommon = sp->defined && sp->common_size;
- int iscommon = type == (N_UNDF|N_EXT) && p->n_value;
-
- if (wascommon) {
- /*
- * sp was defined as common by shared object.
- */
- if (iscommon && p->n_value < sp->common_size)
- sp->common_size = p->n_value;
- continue;
- }
-
- if (sp->sorefs == NULL)
- continue;
for (lsp = sp->sorefs; lsp; lsp = lsp->next) {
int type = lsp->nzlist.nlist.n_type;
@@ -543,28 +561,22 @@ subfile_wanted_p(entry)
type != (N_UNDF | N_EXT))
break; /* We don't need it */
}
- if (lsp != NULL) {
- /* There's a real definition */
- if (iscommon)
- /*
- * But this member wants it to be
- * a common; ignore it.
- */
- continue;
-
- if (N_ISWEAK(&lsp->nzlist.nlist))
- /* Weak symbols don't pull archive members */
- continue;
- }
+ if (lsp != NULL)
+ /*
+ * We have a worthy definition in a shared
+ * object that was specified ahead of the
+ * archive we're examining now. So, punt.
+ */
+ continue;
/*
- * At this point, either the new symbol is a common
- * and the shared object reference is undefined --
- * in which case we note the common -- or the shared
- * object reference has a definition -- in which case
- * the library member takes precedence.
+ * At this point, we have an undefined shared
+ * object reference. Again, if the archive member
+ * defines a common we just note the its size.
+ * Otherwise, the member gets included.
*/
- if (iscommon) {
+
+ if (type == (N_UNDF|N_EXT) && p->n_value) {
/*
* New symbol is common, just takes its
* size, but don't load.
OpenPOWER on IntegriCloud