summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/ld
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>1999-05-21 01:20:46 +0000
committerMarc Espie <espie@cvs.openbsd.org>1999-05-21 01:20:46 +0000
commit4704f3de69c4a89ceef9efcde45c1277d9887908 (patch)
tree341a04b28595448e0d6ca89778295fc719661906 /gnu/usr.bin/ld
parentbc53f0652d1f0b0dedcc6ec00fa7a07188660ca0 (diff)
Be more specific about dynamic libraries: ldd does not know how to handle
them, but they should be `reasonable' objects to pass to it. Otherwise, collect2 will get confused if the gcc driver is used to build dynamic libraries.
Diffstat (limited to 'gnu/usr.bin/ld')
-rw-r--r--gnu/usr.bin/ld/ldd/ldd.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gnu/usr.bin/ld/ldd/ldd.c b/gnu/usr.bin/ld/ldd/ldd.c
index 011d8259c4a..c61de2a388f 100644
--- a/gnu/usr.bin/ld/ldd/ldd.c
+++ b/gnu/usr.bin/ld/ldd/ldd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldd.c,v 1.4 1998/03/26 19:46:55 niklas Exp $ */
+/* $OpenBSD: ldd.c,v 1.5 1999/05/21 01:20:45 espie Exp $ */
/* $NetBSD: ldd.c,v 1.12 1995/10/09 00:14:41 pk Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -105,8 +105,20 @@ char *argv[];
argv++;
continue;
}
- if (read(fd, &hdr, sizeof hdr) != sizeof hdr
- || (N_GETFLAG(hdr) & EX_DPMASK) != EX_DYNAMIC
+ if (read(fd, &hdr, sizeof hdr) != sizeof hdr) {
+ warnx("%s: not a dynamic executable", *argv);
+ (void)close(fd);
+ rval |= 1;
+ argv++;
+ continue;
+ }
+ if ((N_GETFLAG(hdr) & EX_DPMASK) == (EX_DYNAMIC | EX_PIC)) {
+ warnx("%s: no support for dynamic libraries", *argv);
+ (void)close(fd);
+ argv++;
+ continue;
+ }
+ if ((N_GETFLAG(hdr) & EX_DPMASK) != EX_DYNAMIC
#if 1 /* Compatibility */
|| hdr.a_entry < N_PAGSIZ(hdr)
#endif