openbsd-ports/lang/egcs/snapshot/files/ldd-patch
espie 1753c0da02 19990517 compiles and tests okay.
The recent changes to collect2 (needed by java) mean ldd must be updated,
the Makefile now checks for that problem.
1999-05-18 17:07:16 +00:00

41 lines
1.2 KiB
Plaintext

With this small patch, ldd does shut up (somewhat) when faced with
dynamic libraries.
The reason is that, when you build a dynamic library through gcc standard
interface, collect2 will try to invoke ldd on dynamic libraries
(which ldd should handle, but doesn't right now), and will abort if ldd
returns 1.
So we warn, but let ldd return 0 in such a case.
Index: ldd.c
===================================================================
RCS file: /cvs/src/gnu/usr.bin/ld/ldd/ldd.c,v
retrieving revision 1.4
diff -u -r1.4 ldd.c
--- ldd.c 1998/03/26 19:46:55 1.4
+++ ldd.c 1999/05/18 15:28:16
@@ -105,8 +105,20 @@
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